Skip to content

Commit

Permalink
Pulled verbose calculation into its own private method in file_utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimweirich committed May 25, 2009
1 parent 6afd6fa commit 34ddd30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions lib/rake/file_utils.rb
Expand Up @@ -37,11 +37,7 @@ def sh(*cmd, &block)
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
}
end
if RakeFileUtils.verbose_flag == :default && options[:verbose].nil?
options[:verbose] = true
elsif options[:verbose].nil?
options[:verbose] ||= RakeFileUtils.verbose_flag
end
set_verbose_option(options)
options[:noop] ||= RakeFileUtils.nowrite_flag
rake_check_options options, :noop, :verbose
rake_output_message cmd.join(" ") if options[:verbose]
Expand All @@ -53,6 +49,15 @@ def sh(*cmd, &block)
end
end

def set_verbose_option(options)
if RakeFileUtils.verbose_flag.nil? && options[:verbose].nil?
options[:verbose] = true
elsif options[:verbose].nil?
options[:verbose] ||= RakeFileUtils.verbose_flag
end
end
private :set_verbose_option

def rake_system(*cmd)
Rake::AltSystem.system(*cmd)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rake/rake_file_utils.rb
Expand Up @@ -10,7 +10,7 @@ module RakeFileUtils
class << self
attr_accessor :verbose_flag, :nowrite_flag
end
RakeFileUtils.verbose_flag = :default
RakeFileUtils.verbose_flag = nil
RakeFileUtils.nowrite_flag = false

$fileutils_verbose = true
Expand Down

0 comments on commit 34ddd30

Please sign in to comment.