Skip to content

Commit

Permalink
pretend mode fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Sanghi authored and josevalim committed Oct 27, 2010
1 parent b33568c commit e519057
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/thor/actions.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/actions/directory_spec.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion thor.gemspec
Expand Up @@ -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"]
Expand Down

0 comments on commit e519057

Please sign in to comment.