summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsdelano <stephen@opscode.com>2012-12-03 20:31:13 -0800
committersdelano <stephen@opscode.com>2012-12-04 22:36:34 -0800
commit202043286e751b82ba4a83cc99f1eefe0cccf905 (patch)
tree8bec8ab108dd66af9ef5d1e00455c35575480ae7
parent703ed50c0fcce8b054fc90cebaa2a8962c8a8b30 (diff)
downloadchef-202043286e751b82ba4a83cc99f1eefe0cccf905.tar.gz
CHEF-3660: use FileUtils.cp_r to copy directories in deploy_provider
-rw-r--r--chef/lib/chef/provider/deploy.rb2
-rw-r--r--chef/spec/unit/provider/deploy/revision_spec.rb4
-rw-r--r--chef/spec/unit/provider/deploy_spec.rb4
3 files changed, 5 insertions, 5 deletions
diff --git a/chef/lib/chef/provider/deploy.rb b/chef/lib/chef/provider/deploy.rb
index d05ab73f92..4c189b4cb1 100644
--- a/chef/lib/chef/provider/deploy.rb
+++ b/chef/lib/chef/provider/deploy.rb
@@ -262,7 +262,7 @@ class Chef
target_dir_path = @new_resource.deploy_to + "/releases"
converge_by("deploy from repo to #{@target_dir_path} ") do
FileUtils.mkdir_p(target_dir_path)
- run_command(:command => "cp -RPp #{::File.join(@new_resource.destination, ".")} #{release_path}")
+ FileUtils.cp_r(::File.join(@new_resource.destination, "."), release_path, :preserve => true)
Chef::Log.info "#{@new_resource} copied the cached checkout to #{release_path}"
release_created(release_path)
end
diff --git a/chef/spec/unit/provider/deploy/revision_spec.rb b/chef/spec/unit/provider/deploy/revision_spec.rb
index 3287c085d5..d42235600f 100644
--- a/chef/spec/unit/provider/deploy/revision_spec.rb
+++ b/chef/spec/unit/provider/deploy/revision_spec.rb
@@ -53,7 +53,7 @@ describe Chef::Provider::Deploy::Revision do
it "stores the release dir in the file cache when copying the cached repo" do
FileUtils.stub!(:mkdir_p)
- @provider.stub!(:run_command).and_return(true)
+ FileUtils.stub!(:cp_r)
@provider.copy_cached_repo
@provider.stub!(:release_slug).and_return("73219b87e977d9c7ba1aa57e9ad1d88fa91a0ec2")
@provider.load_current_resource
@@ -65,7 +65,7 @@ describe Chef::Provider::Deploy::Revision do
it "removes a release from the file cache when it's used again in another release and append it to the end" do
FileUtils.stub!(:mkdir_p)
- @provider.stub!(:run_command).and_return(true)
+ FileUtils.stub!(:cp_r)
@provider.copy_cached_repo
@provider.stub!(:release_slug).and_return("73219b87e977d9c7ba1aa57e9ad1d88fa91a0ec2")
@provider.load_current_resource
diff --git a/chef/spec/unit/provider/deploy_spec.rb b/chef/spec/unit/provider/deploy_spec.rb
index ebbc6e2823..ef4aed800d 100644
--- a/chef/spec/unit/provider/deploy_spec.rb
+++ b/chef/spec/unit/provider/deploy_spec.rb
@@ -320,13 +320,13 @@ describe Chef::Provider::Deploy do
it "makes a copy of the cached repo in releases dir" do
FileUtils.should_receive(:mkdir_p).with("/my/deploy/dir/releases")
- @provider.should_receive(:run_command).with({:command => "cp -RPp /my/deploy/dir/shared/cached-copy/. #{@expected_release_dir}"})
+ FileUtils.should_receive(:cp_r).with("/my/deploy/dir/shared/cached-copy/.", @expected_release_dir, :preserve => true)
@provider.copy_cached_repo
end
it "calls the internal callback :release_created when copying the cached repo" do
FileUtils.stub!(:mkdir_p)
- @provider.stub!(:run_command).and_return(true)
+ FileUtils.stub!(:cp_r)
@provider.should_receive(:release_created)
@provider.copy_cached_repo
end