Permalink
Browse files

Do not copy empty directories twice.

  • Loading branch information...
1 parent cb381a2 commit 09390eedd804fd53bacd986f01033e1e3b7ef712 @josevalim josevalim committed Oct 21, 2009
Showing with 9 additions and 2 deletions.
  1. +3 −1 lib/thor/actions/directory.rb
  2. +5 −0 spec/actions/directory_spec.rb
  3. +1 −1 spec/rake_compat_spec.rb
@@ -73,7 +73,9 @@ def execute!
case file_source
when /\.empty_directory$/
- base.empty_directory(File.dirname(file_destination), config)
+ dirname = File.dirname(file_destination).gsub(/\/\.$/, '')
+ next if dirname == given_destination
+ base.empty_directory(dirname, config)
when /\.tt$/
base.template(file_source, file_destination[0..-4], config)
else
@@ -96,6 +96,11 @@ def exists_and_identical?(source_path, destination_path)
File.exists?(file).must be_true
end
+ it "does not copy empty directories twice" do
+ content = invoke!("doc/components", "docs/components")
+ content.must_not =~ /exist/
+ end
+
it "logs status" do
content = invoke!("doc")
content.must =~ /create doc\/README/
@@ -28,7 +28,7 @@ class ThorTask < Thor
describe Thor::RakeCompat do
it "sets the rakefile application" do
- Rake.application.rakefile.must == "rake_compat_spec.rb"
+ ["rake_compat_spec.rb", "Thorfile"].must include(Rake.application.rakefile)
end
it "adds rake tasks to thor classes too" do

0 comments on commit 09390ee

Please sign in to comment.