Sha256: 709a84a5c347f770a774e509c92a972a2abcddccfe0607dbf8b1280b8f80eb8b

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

#encoding: utf-8
require 'vagabond/uploader/knife'

module Vagabond
  class Uploader
    class Librarian < Knife

      def initialize(*args)
        super
        unless(options[:cheffile])
          raise ArgumentError.new "Option 'cheffile' is required!"
        end
        unless(File.exists?(options[:cheffile]))
          raise ArgumentError.new "Option 'cheffile' is not a valid path!"
        end
      end

      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(options[:cheffile])})
        cmd.run_command
        cmd.error!
        options[:cookbook_paths] = [File.join(store, 'cookbooks')]
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagabond-0.2.10 lib/vagabond/uploader/librarian.rb