Class: KnifeSpork::SporkUpload

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

Constant Summary collapse

CHECKSUM =
'checksum'
MATCH_CHECKSUM =
/[0-9a-f]{32,}/

Instance Method Summary collapse

Instance Method Details

#runObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/chef/knife/spork-upload.rb', line 43

def run
  self.class.send(:include, KnifeSpork::Runner)
  self.config = Chef::Config.merge!(config)
  config[:cookbook_path] ||= Chef::Config[:cookbook_path]

  if @name_args.empty?
    show_usage
    ui.error("You must specify the --all flag or at least one cookbook name")
    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

  #First load so plugins etc know what to work with
  @cookbooks = load_cookbooks(name_args)
  include_dependencies if config[:depends]

  run_plugins(:before_upload)

  #Reload cookbook in case a VCS plugin found updates
  @cookbooks = load_cookbooks(name_args)
  include_dependencies if config[:depends]

  upload
  run_plugins(:after_upload)
end