Class: Chef::Knife::PinningsLocalCookbook

Inherits:
Chef::Knife
  • Object
show all
Defined in:
lib/chef/knife/pinnings_local_cookbook.rb

Overview

This class implements knife pinnings get local METADATA_ITEM

Instance Method Summary collapse

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/chef/knife/pinnings_local_cookbook.rb', line 23

def run
  @metadata = Chef::Cookbook::Metadata.new
  @metadata.from_file(File.join(Dir.pwd, 'metadata.rb'))

  result = ''
  name_args.each do |name|
    if @metadata.respond_to?(name)
      result += @metadata.send(name).to_s + ' '
    else
      result += '_undefined_ '
    end
  end
  ui.info result.chomp
end