Class: Jammit::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/jammit-core/cli.rb

Constant Summary collapse

ARGV =
::ARGV.dup

Instance Method Summary collapse

Constructor Details

#initialize(args = ARGV, options = {}, config = {}) ⇒ CLI


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/jammit-core/cli.rb', line 31

def initialize(args=ARGV, options={}, config={})
          
  Jammit.ui = UI::Shell.new(shell)
  super

  #@options = {
  #  :config_path    => Jammit::DEFAULT_CONFIG_PATH,
  #  :output_folder  => nil,
  #  :base_url       => nil,
  #  :force          => false
  #}
  
  if options.kind_of? Hash
    Jammit.options = options
  end
  
  #Jammit.packager.force = @options[:force]
  #Jammit.packager.precache_all(@options[:output_folder], @options[:base_url])
  
end

Instance Method Details

#build(package = :all, *params) ⇒ Object


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jammit-core/cli.rb', line 19

def build(package = :all, *params)
  package = package.to_s    
  case package
  when "all"
    Jammit.packager.force = true #Jammit.configuration[:force]
    Jammit.packager.precache_all(Jammit.config[:output_folder], Jammit.config[:base_url])
  else
    Jammit.packager.force = true
    Jammit.packager.precache(package, Jammit.config[:output_folder], Jammit.config[:base_url])
  end
end

#config(cmd, *params) ⇒ Object


14
15
16
# File 'lib/jammit-core/cli.rb', line 14

def config(cmd, *params)
  Jammit::Config.dispatch(cmd.to_sym, *params)
end

#initObject


9
10
11
# File 'lib/jammit-core/cli.rb', line 9

def init
  Jammit::Config.dispatch(:create)
end