class KnifeSpork::SporkOmni

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/spork-omni.rb, line 50
def run
  self.class.send(:include, KnifeSpork::Runner)
  self.config = Chef::Config.merge!(config)

  if name_args.empty?
    ui.fatal 'You must specify a cookbook name!'
    show_usage
    exit(1)
  end

  # Temporary fix for #138 to allow Berkshelf functionality
  # to be bypassed until #85 has been completed and Berkshelf 3 support added
  unload_berkshelf_if_specified

  cookbook = name_args.first

  run_plugins(:before_omni)
  omni(cookbook)
  run_plugins(:after_omni)
end

Private Instance Methods

bump(cookbook) click to toggle source
# File lib/chef/knife/spork-omni.rb, line 73
def bump(cookbook)
  ui.msg "OMNI: Bumping #{cookbook}"
  bump = SporkBump.new
  bump.name_args = [cookbook,config[:bump_level]]
  bump.run
end
omni(cookbook) click to toggle source
# File lib/chef/knife/spork-omni.rb, line 104
def omni(cookbook)
  bump(cookbook)
  ui.msg ""
  upload(cookbook)
  ui.msg ""
  promote(cookbook)
end
promote(cookbook) click to toggle source
# File lib/chef/knife/spork-omni.rb, line 89
def promote(cookbook)
  ui.msg "OMNI: Promoting #{cookbook}"
  promote = SporkPromote.new
  if config[:omni_environment]
    promote.name_args = [config[:omni_environment],cookbook]
  else
    promote.name_args = [cookbook]
  end
  promote.config[:remote] = config[:remote]
  if defined?(::Berkshelf)
    promote.config[:berksfile] = config[:berksfile]
  end
  promote.run
end
upload(cookbook) click to toggle source
# File lib/chef/knife/spork-omni.rb, line 80
def upload(cookbook)
  ui.msg "OMNI: Uploading #{cookbook}"
  upload = SporkUpload.new
  upload.name_args = [cookbook]
  upload.config[:cookbook_path] = config[:cookbook_path]
  upload.config[:depends] = config[:depends]
  upload.run
end