lib/chef/knife/cookbook_site_vendor.rb in chef-0.9.6 vs lib/chef/knife/cookbook_site_vendor.rb in chef-0.9.8.beta.1
- old
+ new
@@ -21,11 +21,12 @@
class Chef
class Knife
class CookbookSiteVendor < Knife
- banner "Sub-Command: cookbook site vendor COOKBOOK [VERSION] (options)"
+ banner "knife cookbook site vendor COOKBOOK [VERSION] (options)"
+ category "cookbook site"
option :deps,
:short => "-d",
:long => "--dependencies",
:boolean => true,
@@ -56,10 +57,10 @@
Chef::Log.info("Checking out the master branch.")
Chef::Mixin::Command.run_command(:command => "git checkout master", :cwd => vendor_path)
Chef::Log.info("Checking the status of the vendor branch.")
status, branch_output, branch_error = Chef::Mixin::Command.output_of_command("git branch --no-color | grep #{branch_name}", :cwd => vendor_path)
- if branch_output =~ /#{branch_name}$/m
+ if branch_output =~ /#{Regexp.escape(branch_name)}$/m
Chef::Log.info("Vendor branch found.")
Chef::Mixin::Command.run_command(:command => "git checkout #{branch_name}", :cwd => vendor_path)
else
Chef::Log.info("Creating vendor branch.")
Chef::Mixin::Command.run_command(:command => "git checkout -b #{branch_name}", :cwd => vendor_path)