Class: KnifeTable::TableSet

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

Instance Method Summary collapse

Methods included from Helpers

#cookbook_path, #git

Constructor Details

#initialize(*args) ⇒ TableSet

Returns a new instance of TableSet.



32
33
34
35
# File 'lib/chef/knife/table_set.rb', line 32

def initialize(*args)
  super
  @cookbooks = config[:cookbooks].to_s.split(',').map(&:strip)
end

Instance Method Details

#runObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chef/knife/table_set.rb', line 37

def run
  ui.msg ui.highline.color("#{' ' * 10}** Knife Table: New place setting  **", [HighLine::GREEN, HighLine::BOLD])
  branch_name = "#{config[:branch_prefix]}#{name_args.join('_').downcase}"
  ui.highline.say "Creating new work branch (#{branch_name}): "
  git.branch(branch_name).create
  ui.highline.say "done"
  git.checkout(branch_name)

  unless(@cookbooks.empty?)
    bumper = KnifeSpork::SporkBump.new
    @cookbooks.each do |cookbook|
      bumper.patch(cookbook_path, cookbook, config[:bump_type])
    end
  end
end