Module: R10K::CLI::Puppetfile::Install

Defined in:
lib/r10k/cli/puppetfile.rb

Class Method Summary collapse

Class Method Details

.commandObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/r10k/cli/puppetfile.rb', line 27

def self.command
  @cmd ||= Cri::Command.define do
    name    'install'
    usage   'install'
    summary 'Install all modules from a Puppetfile'

    run do |opts, args, cmd|
      puppetfile_root = Dir.getwd
      puppetfile_path = ENV['PUPPETFILE_DIR']
      puppetfile      = ENV['PUPPETFILE']

      puppetfile = R10K::Puppetfile.new(puppetfile_root, puppetfile_path, puppetfile)

      runner = R10K::TaskRunner.new(:trace => opts[:trace])
      task   = R10K::Task::Puppetfile::Sync.new(puppetfile)
      runner.append_task task

      runner.run

      exit runner.exit_value
    end
  end
end