Permalink
Browse files

pretend mode fixes

  • Loading branch information...
1 parent b33568c commit e519057e7963a590e9a7abecb2812538a12b4f1e Aditya Sanghi committed with josevalim Oct 9, 2010
Showing with 5 additions and 4 deletions.
  1. +3 −2 lib/thor/actions.rb
  2. +1 −1 spec/actions/directory_spec.rb
  3. +1 −1 thor.gemspec
View
5 lib/thor/actions.rb
@@ -158,17 +158,18 @@ def find_in_source_paths(file)
#
def inside(dir='', config={}, &block)
verbose = config.fetch(:verbose, false)
+ pretend = options[:pretend] || config.fetch(:pretend, false)
say_status :inside, dir, verbose
shell.padding += 1 if verbose
@destination_stack.push File.expand_path(dir, destination_root)
# If the directory doesnt exist and we're not pretending
- if !File.exist?(destination_root) && !config[:pretend]
+ if !File.exist?(destination_root) && !pretend
FileUtils.mkdir_p(destination_root)
end
- if config[:pretend]
+ if pretend
# In pretend mode, just yield down to the block
block.arity == 1 ? yield(destination_root) : yield
else
View
2 spec/actions/directory_spec.rb
@@ -41,7 +41,7 @@ def exists_and_identical?(source_path, destination_path)
end
it "should not create a directory in pretend mode" do
- invoke! "doc", "ghost"
+ invoke! "doc", "ghost", :pretend => true
File.exists?("ghost").must be_false
end
View
2 thor.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Yehuda Katz", "Jos\303\251 Valim"]
- s.date = %q{2010-10-04}
+ s.date = %q{2010-10-09}
s.description = %q{A scripting framework that replaces rake, sake and rubigen}
s.email = %q{ruby-thor@googlegroups.com}
s.executables = ["thor", "rake2thor"]

0 comments on commit e519057

Please sign in to comment.