Method: Geoffrey::CLI#install

Defined in:
lib/geoffrey/cli.rb

#install(*names) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/geoffrey/cli.rb', line 20

def install(*names)

  templates_to_install = []

  # if a remote flag is on, then we'll take the parameter as an url, and will
  # then fetch it directly instead of looking for it in the filesystem
  # templates.
  if options[:remote]
    templates_to_install << names.join
  else
    names.each do |name|
      if file = file_for_template(name)
        templates_to_install << file
      end
    end
  end

  if templates_to_install.empty?
    puts "Template not found"
    exit 1
  else
    templates_to_install.each do |template|
      package = Geoffrey::Template.new(template).package
      package.verbose(true) if options[:verbose]
      package.process
    end
  end
end