Skip to content

Commit

Permalink
Add librarian-chef support
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Apr 30, 2013
1 parent 64ca33e commit 9ab3a6e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/capistrano-paratrooper-chef.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,27 @@ def generate_solo_json
end

namespace :kitchen do
namespace :librarian_chef do
def fetch
require 'librarian/action'
require 'librarian/chef'

if File.exist? 'Cheffile'
logger.debug("executing librarian-chef")
Librarian::Action::Resolve.new(librarian_env).run
Librarian::Action::Install.new(librarian_env).run
end
rescue LoadError
# pass
end

def librarian_env
@librarian_env ||= Librarian::Chef::Environment.new
@librarian_env.config_db.local["path"] = cookbooks_paths[0]
@librarian_env
end
end

def ensure_cookbooks
abort "No cookbooks found in #{fetch(:cookbooks_directory).inspect}" if kitchen.cookbooks_paths.empty?
end
Expand All @@ -198,6 +219,8 @@ def ensure_working_dir

desc "Upload files in kitchen"
task :upload, :except => { :no_release => true } do
librarian_chef.fetch

kitchen_paths = [cookbooks_paths, roles_path, databags_path].flatten.compact.select{|d| File.exists?(d)}
tarball = Tempfile.new("kitchen.tar")
begin
Expand Down

0 comments on commit 9ab3a6e

Please sign in to comment.