Class: Vagrant::Puppetfile::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/puppetfile.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



73
74
75
# File 'lib/vagrant/puppetfile.rb', line 73

def Command.synopsis
  'installs all modules listed in a Puppetfile'
end

Instance Method Details

#executeObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vagrant/puppetfile.rb', line 45

def execute
  puppetfile = DEFAULT_PUPPETFILE_PATH
  evaluator  = DEFAULT_PUPPETFILE_EVALUATOR

  options = OptionParser.new do |o|
    o.banner = 'Usage: vagrant puppetfile install'
    o.separator ''
    o.separator 'Options:'
    o.on('-h', '--help', 'Print this help') do
      return @env.ui.info(o.help)
    end
    o.on('-e', '--evaluator TYPE', 'Specify the Puppetfile evaluator') do |type|
      evaluator = type
    end
    o.on('-f', '--file PUPPETFILE', 'Specify an alternative Puppetfile') do |path|
      puppetfile = path
    end
  end

  case parse_options(options)
  when ['install']
    Evaluator.create(evaluator, @env.ui).install(puppetfile)
  else
    @env.ui.warn(options.help)
    exit 1
  end
end