Skip to content

Commit

Permalink
Changed nomenclature from shell_command to shell_runner.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimweirich committed May 25, 2009
1 parent 5f52524 commit 2865311
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rake/file_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module FileUtils
#
def sh(*cmd, &block)
options = (Hash === cmd.last) ? cmd.pop : {}
block = create_shell_command(cmd) unless block_given?
shell_runner = block_given? ? block : create_shell_runner(cmd)
set_verbose_option(options)
options[:noop] ||= RakeFileUtils.nowrite_flag
rake_check_options options, :noop, :verbose
Expand All @@ -38,17 +38,18 @@ def sh(*cmd, &block)
res = rake_system(*cmd)
status = $?
status = PseudoStatus.new(1) if !res && status.nil?
block.call(res, status)
shell_runner.call(res, status)
end
end

def create_shell_command(cmd)
def create_shell_runner(cmd)
show_command = cmd.join(" ")
show_command = show_command[0,42] + "..." unless $trace
block = lambda { |ok, status|
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
}
end
private :create_shell_runner

def set_verbose_option(options)
if options[:verbose].nil?
Expand Down

0 comments on commit 2865311

Please sign in to comment.