Class: MultiScript::Packager

Inherits:
Object
  • Object
show all
Defined in:
lib/multiscript/packager.rb

Class Method Summary collapse

Class Method Details

.package_config(root_folder, config_file) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/multiscript/packager.rb', line 11

def package_config(root_folder, config_file)
  require "yaml" #lazy_load
  config = YAML::load(File.read(File.join(root_folder, config_file)))
  coffee, js = [], []
  config['packages'].each do |package|
    if package.end_with?('.coffee')
      coffee << package
    elsif package.end_with?('.js')
      js << package
    end
  end
  package(root_folder, coffee, js)
end

.package_folder(folder) ⇒ Object



4
5
6
7
8
9
# File 'lib/multiscript/packager.rb', line 4

def package_folder(folder)
  entires = Dir.entries(folder)
  coffee = entires.select{ |ent| ent.end_with?('.coffee')}
  js = entires.select{ |ent| ent.end_with?('.js')}
  package(folder, coffee, js)
end