33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/chef/knife/spork-bump.rb', line 33
def run
self.class.send(:include, KnifeSpork::Runner)
self.config = Chef::Config.merge!(config)
config[:cookbook_path] ||= Chef::Config[:cookbook_path]
cookbook_name = ""
if @name_args.empty? && File.exists?("#{Dir.pwd}/metadata.rb")
cookbook_name = File.read("#{Dir.pwd}/metadata.rb").split("\n").select{|l|l.start_with?("name")}.first.split.last.gsub("\"","").gsub("'","")
ui.info "Cookbook name omitted, but metadata.rb for cookbook #{cookbook_name} found - bumping that."
elsif @name_args.empty?
show_usage
ui.error("You must specify at least a cookbook name")
exit 1
else
cookbook_name = name_args.first
end
unload_berkshelf_if_specified
@cookbook = load_cookbook(cookbook_name)
run_plugins(:before_bump)
@cookbook = load_cookbook(cookbook_name)
bump
run_plugins(:after_bump)
end
|