lib/cuken/api/chef.rb in cuken-0.1.10 vs lib/cuken/api/chef.rb in cuken-0.1.11
- old
+ new
@@ -41,10 +41,16 @@
announce_or_puts(%{WARNING: cookbooks path: #{lp} does not contain any Git repositories.}) if @announce_env
end
end
end
+ def clone_pull_error_check(repo, res)
+ if res[/Could not find Repository /]
+ raise RuntimeError, "Could not find Cookbook in Repository #{repo}", caller
+ end
+ end
+
def chef_clone_repo(ckbk_path, cookbook = false, repo = chef.remote_chef_repo, type = {'branch' => 'master'})
in_current_dir do
pth = Pathname(ckbk_path).expand_path
gritty = ::Grit::Git.new(current_dir)
announce_or_puts gritty.inspect
@@ -57,9 +63,10 @@
res = gritty.pull(clone_opts, repo, pth.to_s)
else
announce_or_puts "Cloning: #{repo} into #{pth}"
res = gritty.clone(clone_opts, repo, pth.to_s)
end
+ clone_pull_error_check(repo, res) if res
update_cookbook_paths(pth, cookbook)
unless chef.cookbooks_paths.empty? # is empty after cloning default chef-repo
grotty = ::Grit::Git.new((pth + '.git').to_s)
grotty.checkout( { :b => true }, clone_opts[:branch] )
if !type['tag'].empty? || !type['ref'].empty?