summaryrefslogtreecommitdiff
path: root/lib/rake/ext
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-15 03:07:37 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-15 03:07:37 +0000
commit6361928083d01906ab9d8782b6533b4ed7c834a0 (patch)
tree172488be8a74c9313d35b9cd7d53999cd55f561d /lib/rake/ext
parent031e1570b934d6b3a1e17ae8eb78a44dac8186d3 (diff)
* lib/rake.rb, lib/rake/*.rb: Upgrade to rake-10.3.2
[fix GH-668] * test/rake/*.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake/ext')
-rw-r--r--lib/rake/ext/core.rb7
-rw-r--r--lib/rake/ext/module.rb1
-rw-r--r--lib/rake/ext/string.rb63
-rw-r--r--lib/rake/ext/time.rb2
4 files changed, 39 insertions, 34 deletions
diff --git a/lib/rake/ext/core.rb b/lib/rake/ext/core.rb
index c924c7e..7575df1 100644
--- a/lib/rake/ext/core.rb
+++ b/lib/rake/ext/core.rb
@@ -1,8 +1,5 @@
-######################################################################
-# Core extension library
-#
class Module
- # Check for an existing method in the current class before extending. IF
+ # Check for an existing method in the current class before extending. If
# the method already exists, then a warning is printed and the extension is
# not added. Otherwise the block is yielded and any definitions in the
# block will take effect.
@@ -17,7 +14,7 @@ class Module
# end
# end
#
- def rake_extension(method)
+ def rake_extension(method) # :nodoc:
if method_defined?(method)
$stderr.puts "WARNING: Possible conflict with Rake extension: " +
"#{self}##{method} already exists"
diff --git a/lib/rake/ext/module.rb b/lib/rake/ext/module.rb
index 8b13789..3ee155f 100644
--- a/lib/rake/ext/module.rb
+++ b/lib/rake/ext/module.rb
@@ -1 +1,2 @@
+# TODO: remove in Rake 11
diff --git a/lib/rake/ext/string.rb b/lib/rake/ext/string.rb
index 07ef167..34ee328 100644
--- a/lib/rake/ext/string.rb
+++ b/lib/rake/ext/string.rb
@@ -1,8 +1,5 @@
require 'rake/ext/core'
-######################################################################
-# Rake extension methods for String.
-#
class String
rake_extension("ext") do
@@ -11,6 +8,8 @@ class String
# is not given, or is the empty string, remove any existing extension.
#
# +ext+ is a user added method for the String class.
+ #
+ # This String extension comes from Rake
def ext(newext='')
return self.dup if ['.', '..'].include? self
newext = (newext =~ /^\./) ? newext : ("." + newext) if newext != ''
@@ -20,6 +19,8 @@ class String
rake_extension("pathmap") do
# Explode a path into individual components. Used by +pathmap+.
+ #
+ # This String extension comes from Rake
def pathmap_explode
head, tail = File.split(self)
return [self] if head == self
@@ -32,6 +33,8 @@ class String
# Extract a partial path from the path. Include +n+ directories from the
# front end (left hand side) if +n+ is positive. Include |+n+|
# directories from the back end (right hand side) if +n+ is negative.
+ #
+ # This String extension comes from Rake
def pathmap_partial(n)
dirs = File.dirname(self).pathmap_explode
partial_dirs =
@@ -48,6 +51,8 @@ class String
# Preform the pathmap replacement operations on the given path. The
# patterns take the form 'pat1,rep1;pat2,rep2...'.
+ #
+ # This String extension comes from Rake
def pathmap_replace(patterns, &block)
result = self
patterns.split(';').each do |pair|
@@ -69,35 +74,36 @@ class String
# controls the details of the mapping. The following special patterns are
# recognized:
#
- # * <b>%p</b> -- The complete path.
- # * <b>%f</b> -- The base file name of the path, with its file extension,
- # but without any directories.
- # * <b>%n</b> -- The file name of the path without its file extension.
- # * <b>%d</b> -- The directory list of the path.
- # * <b>%x</b> -- The file extension of the path. An empty string if there
- # is no extension.
- # * <b>%X</b> -- Everything *but* the file extension.
- # * <b>%s</b> -- The alternate file separator if defined, otherwise use
- # the standard file separator.
- # * <b>%%</b> -- A percent sign.
- #
- # The %d specifier can also have a numeric prefix (e.g. '%2d'). If the
- # number is positive, only return (up to) +n+ directories in the path,
- # starting from the left hand side. If +n+ is negative, return (up to)
- # |+n+| directories from the right hand side of the path.
+ # <tt>%p</tt> :: The complete path.
+ # <tt>%f</tt> :: The base file name of the path, with its file extension,
+ # but without any directories.
+ # <tt>%n</tt> :: The file name of the path without its file extension.
+ # <tt>%d</tt> :: The directory list of the path.
+ # <tt>%x</tt> :: The file extension of the path. An empty string if there
+ # is no extension.
+ # <tt>%X</tt> :: Everything *but* the file extension.
+ # <tt>%s</tt> :: The alternate file separator if defined, otherwise use #
+ # the standard file separator.
+ # <tt>%%</tt> :: A percent sign.
+ #
+ # The <tt>%d</tt> specifier can also have a numeric prefix (e.g. '%2d').
+ # If the number is positive, only return (up to) +n+ directories in the
+ # path, starting from the left hand side. If +n+ is negative, return (up
+ # to) +n+ directories from the right hand side of the path.
#
# Examples:
#
# 'a/b/c/d/file.txt'.pathmap("%2d") => 'a/b'
# 'a/b/c/d/file.txt'.pathmap("%-2d") => 'c/d'
#
- # Also the %d, %p, %f, %n, %x, and %X operators can take a
- # pattern/replacement argument to perform simple string substitutions on a
- # particular part of the path. The pattern and replacement are separated
- # by a comma and are enclosed by curly braces. The replacement spec comes
- # after the % character but before the operator letter. (e.g.
- # "%{old,new}d"). Multiple replacement specs should be separated by
- # semi-colons (e.g. "%{old,new;src,bin}d").
+ # Also the <tt>%d</tt>, <tt>%p</tt>, <tt>%f</tt>, <tt>%n</tt>,
+ # <tt>%x</tt>, and <tt>%X</tt> operators can take a pattern/replacement
+ # argument to perform simple string substitutions on a particular part of
+ # the path. The pattern and replacement are separated by a comma and are
+ # enclosed by curly braces. The replacement spec comes after the %
+ # character but before the operator letter. (e.g. "%{old,new}d").
+ # Multiple replacement specs should be separated by semi-colons (e.g.
+ # "%{old,new;src,bin}d").
#
# Regular expressions may be used for the pattern, and back refs may be
# used in the replacement text. Curly braces, commas and semi-colons are
@@ -106,11 +112,11 @@ class String
#
# For example:
#
- # "src/org/onestepback/proj/A.java".pathmap("%{^src,bin}X.class")
+ # "src/org/onestepback/proj/A.java".pathmap("%{^src,class}X.class")
#
# returns:
#
- # "bin/org/onestepback/proj/A.class"
+ # "class/org/onestepback/proj/A.class"
#
# If the replacement text is '*', then a block may be provided to perform
# some arbitrary calculation for the replacement.
@@ -125,6 +131,7 @@ class String
#
# "/path/to/file.txt"
#
+ # This String extension comes from Rake
def pathmap(spec=nil, &block)
return self if spec.nil?
result = ''
diff --git a/lib/rake/ext/time.rb b/lib/rake/ext/time.rb
index ea8b037..c058649 100644
--- a/lib/rake/ext/time.rb
+++ b/lib/rake/ext/time.rb
@@ -3,7 +3,7 @@
require 'rake/early_time'
-class Time
+class Time # :nodoc: all
alias rake_original_time_compare :<=>
def <=>(other)
if Rake::EarlyTime === other