Skip to content

Commit

Permalink
Comment reformatting for FileUtilsExt
Browse files Browse the repository at this point in the history
  • Loading branch information
jimweirich committed Mar 6, 2011
1 parent afaccbf commit 148d6f2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
3 changes: 2 additions & 1 deletion lib/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@

$trace = false

# Alias FileList to be available at the top level.
# Some top level Constants.
FileList = Rake::FileList
RakeFileUtils = Rake::FileUtilsExt
50 changes: 30 additions & 20 deletions lib/rake/file_utils_ext.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
require 'rake/file_utils'

module Rake
# ###########################################################################
# FileUtilsExt provides a custom version of the FileUtils methods that
# respond to the <tt>verbose</tt> and <tt>nowrite</tt> commands.
#
# FileUtilsExt provides a custom version of the FileUtils methods
# that respond to the <tt>verbose</tt> and <tt>nowrite</tt>
# commands.
#
module FileUtilsExt
include FileUtils
Expand Down Expand Up @@ -37,14 +38,17 @@ def #{name}( *args, &block )
EOS
end

# Get/set the verbose flag controlling output from the FileUtils utilities.
# If verbose is true, then the utility method is echoed to standard output.
# Get/set the verbose flag controlling output from the FileUtils
# utilities. If verbose is true, then the utility method is
# echoed to standard output.
#
# Examples:
# verbose # return the current value of the verbose flag
# verbose # return the current value of the
# # verbose flag
# verbose(v) # set the verbose flag to _v_.
# verbose(v) { code } # Execute code with the verbose flag set temporarily to _v_.
# # Return to the original value when code is done.
# verbose(v) { code } # Execute code with the verbose flag set
# # temporarily to _v_. Return to the
# # original value when code is done.
def verbose(value=nil)
oldvalue = FileUtilsExt.verbose_flag
FileUtilsExt.verbose_flag = value unless value.nil?
Expand All @@ -58,14 +62,17 @@ def verbose(value=nil)
FileUtilsExt.verbose_flag
end

# Get/set the nowrite flag controlling output from the FileUtils utilities.
# If verbose is true, then the utility method is echoed to standard output.
# Get/set the nowrite flag controlling output from the FileUtils
# utilities. If verbose is true, then the utility method is
# echoed to standard output.
#
# Examples:
# nowrite # return the current value of the nowrite flag
# nowrite # return the current value of the
# # nowrite flag
# nowrite(v) # set the nowrite flag to _v_.
# nowrite(v) { code } # Execute code with the nowrite flag set temporarily to _v_.
# # Return to the original value when code is done.
# nowrite(v) { code } # Execute code with the nowrite flag set
# # temporarily to _v_. Return to the
# # original value when code is done.
def nowrite(value=nil)
oldvalue = FileUtilsExt.nowrite_flag
FileUtilsExt.nowrite_flag = value unless value.nil?
Expand All @@ -79,18 +86,21 @@ def nowrite(value=nil)
oldvalue
end

# Use this function to prevent potentially destructive ruby code from
# running when the :nowrite flag is set.
# Use this function to prevent potentially destructive ruby code
# from running when the :nowrite flag is set.
#
# Example:
#
# when_writing("Building Project") do
# project.build
# end
#
# The following code will build the project under normal conditions. If the
# nowrite(true) flag is set, then the example will print:
# The following code will build the project under normal
# conditions. If the nowrite(true) flag is set, then the example
# will print:
#
# DRYRUN: Building Project
#
# instead of actually building the project.
#
def when_writing(msg=nil)
Expand All @@ -116,8 +126,9 @@ def rake_output_message(message)
$stderr.puts(message)
end

# Check that the options do not contain options not listed in +optdecl+. An
# ArgumentError exception is thrown if non-declared options are found.
# Check that the options do not contain options not listed in
# +optdecl+. An ArgumentError exception is thrown if non-declared
# options are found.
def rake_check_options(options, *optdecl)
h = options.dup
optdecl.each do |name|
Expand All @@ -128,5 +139,4 @@ def rake_check_options(options, *optdecl)

extend self
end

end

0 comments on commit 148d6f2

Please sign in to comment.