Class: HeadChef::List

Inherits:
Object
  • Object
show all
Defined in:
lib/head_chef/tasks/list.rb

Class Method Summary collapse

Class Method Details

.list(environment) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/head_chef/tasks/list.rb', line 3

def self.list(environment)
  chef_environment = HeadChef.chef_server.environment.find(environment)

  unless chef_environment
    HeadChef.ui.error "Environment #{environment} not found on chef server."
    Kernel.exit(1337)
  end

  HeadChef.ui.say("COOKBOOKS:")
  chef_environment.cookbook_versions.sort.each do |cookbook, version|
    HeadChef.ui.say("  #{cookbook}: #{version}")
  end
end