Class: Vagabond::Uploader::Librarian
- Inherits:
-
Knife
- Object
- Vagabond::Uploader
- Knife
- Vagabond::Uploader::Librarian
- Defined in:
- lib/vagabond/uploader/librarian.rb
Instance Attribute Summary
Attributes inherited from Vagabond::Uploader
#options, #store, #ui, #vagabondfile
Instance Method Summary collapse
-
#initialize(*args) ⇒ Librarian
constructor
A new instance of Librarian.
- #prepare ⇒ Object
Methods inherited from Knife
Methods inherited from Vagabond::Uploader
Methods included from Helpers
Constructor Details
#initialize(*args) ⇒ Librarian
Returns a new instance of Librarian.
8 9 10 11 12 13 14 15 16 |
# File 'lib/vagabond/uploader/librarian.rb', line 8 def initialize(*args) super unless([:cheffile]) raise ArgumentError.new "Option 'cheffile' is required!" end unless(File.exists?([:cheffile])) raise ArgumentError.new "Option 'cheffile' is not a valid path!" end end |
Instance Method Details
#prepare ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagabond/uploader/librarian.rb', line 18 def prepare if(File.directory?(File.join(store, 'cookbooks'))) com = 'librarian-chef update' # TODO: Check path in .librarian config else com = "librarian-chef install --path=#{File.join(store, 'cookbooks')}" end cmd = build_command(com, :shellout => {:cwd => File.dirname([:cheffile])}) cmd.run_command cmd.error! [:cookbook_paths] = [File.join(store, 'cookbooks')] end |