class Megam::WorkArea

a class which manages the work area, ie find the files in workarea, packaging script in it.

Attributes

del_if_exists[RW]
dir_glob_files[RW]
directory[RW]
msg[RW]

Public Class Methods

new(options) click to toggle source
   # File lib/megam/workarea.rb
26 def initialize (options)
27   @del_if_exists = false
28   @directory      = options[:directory] if options[:directory]
29   @del_if_exists  = options[:del_if_exists] if options[:del_if_exists]
30   @msg            = options[:message] if options[:message]
31 end
workarea_install_directory() click to toggle source
   # File lib/megam/workarea.rb
54 def self.workarea_install_directory
55   File.dirname(Megam::Config[:install_file])
56 end

Public Instance Methods

directory_avail?() click to toggle source
   # File lib/megam/workarea.rb
33 def directory_avail?
34   directory
35 end
find_files_via_dirglob(i_dir) click to toggle source

Lists all the files under the dir

   # File lib/megam/workarea.rb
45 def find_files_via_dirglob(i_dir)
46   dir_files = {}
47   Megam::Birr.text.info(Megam::Birr.text.color("GLOB :", :green, :bold) + "#{i_dir}")
48   if Dir.exists?(i_dir)
49     dir_files[i_dir] = Dir.glob("#{i_dir}/**/*")
50   end
51   dir_files
52 end
list_directory(i_dir) click to toggle source

Lists all the files under the workarea_installer/<directory> using a helper

   # File lib/megam/workarea.rb
39 def list_directory(i_dir)
40   @dir_glob_files = {}
41   @dir_glob_files ||= (find_files_via_dirglob(i_dir).values).flatten
42 end
workarea_install(i_dir) click to toggle source
   # File lib/megam/workarea.rb
58 def workarea_install(i_dir)
59   unless workarea_install_not_found!(i_dir)
60     File.join(workarea_install_directory,i_dir)
61   end
62 end