Class: Builderator::Tasks::Berkshelf
- Includes:
- Thor::Actions
- Defined in:
- lib/builderator/tasks/berkshelf.rb
Overview
Wrap Berkshelf commands
Class Method Summary collapse
Instance Method Summary collapse
- #clean ⇒ Object
- #configure ⇒ Object
- #metadata(cookbook) ⇒ Object
- #uncache ⇒ Object
- #upload ⇒ Object
- #vendor ⇒ Object
Methods included from Thor::Actions
#run, #run_with_input, #run_without_bundler, #template, #thor_run
Class Method Details
.exit_on_failure? ⇒ Boolean
17 18 19 |
# File 'lib/builderator/tasks/berkshelf.rb', line 17 def self.exit_on_failure? true end |
Instance Method Details
#clean ⇒ Object
76 77 78 79 80 |
# File 'lib/builderator/tasks/berkshelf.rb', line 76 def clean remove_dir Interface.berkshelf.vendor remove_file Interface.berkshelf.source remove_file Interface.berkshelf.lockfile end |
#configure ⇒ Object
22 23 24 |
# File 'lib/builderator/tasks/berkshelf.rb', line 22 def configure Interface.berkshelf.write end |
#metadata(cookbook) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/builderator/tasks/berkshelf.rb', line 27 def (cookbook) fail "Cookbook #{ cookbook } does not have a path!" unless Config.cookbook.depends.has?(cookbook) && !Config.cookbook.depends[cookbook].path.nil? cookbook_path = Config.cookbook.depends[cookbook].path = Chef::Cookbook::Metadata.new .from_file(::File.join(cookbook_path, 'metadata.rb')) say_status :metadata, "for cookbook #{ .name }@#{ .version }" create_file ::File.join(cookbook_path, 'metadata.json'), .to_json, :force => true end |
#uncache ⇒ Object
71 72 73 |
# File 'lib/builderator/tasks/berkshelf.rb', line 71 def uncache remove_dir File.join(ENV['HOME'], '.berkshelf/cookbooks') end |
#upload ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/builderator/tasks/berkshelf.rb', line 57 def upload vendor command = "#{Interface.berkshelf.command} upload " command << "-d " if [:debug] command << "-c #{Interface.berkshelf.berkshelf_config} " unless Interface.berkshelf.berkshelf_config.nil? command << "-b #{Interface.berkshelf.source}" inside Interface.berkshelf.directory do run command end end |
#vendor ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/builderator/tasks/berkshelf.rb', line 41 def vendor invoke :configure, [], empty_directory Interface.berkshelf.vendor command = "#{Interface.berkshelf.command} vendor #{Interface.berkshelf.vendor} " command << "-d " if [:debug] command << "-c #{Interface.berkshelf.berkshelf_config} " unless Interface.berkshelf.berkshelf_config.nil? command << "-b #{Interface.berkshelf.source}" remove_file Interface.berkshelf.lockfile inside Interface.berkshelf.directory do run command end end |