rake 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rake might be problematic. Click here for more details.
- data/Rakefile +12 -2
- data/doc/release_notes/rake-0.8.4.rdoc +10 -0
- data/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/lib/rake.rb +53 -29
- data/lib/rake/alt_system.rb +108 -0
- data/lib/rake/rdoctask.rb +3 -3
- data/lib/rake/testtask.rb +2 -2
- data/lib/rake/win32.rb +4 -5
- data/test/check_no_expansion.rb +5 -0
- data/test/test_application.rb +1 -39
- data/test/test_filelist.rb +5 -2
- data/test/test_fileutils.rb +23 -34
- data/test/test_pseudo_status.rb +26 -0
- data/test/test_tasks.rb +1 -1
- metadata +10 -3
- data/lib/rake/repaired_system.rb +0 -145
data/Rakefile
CHANGED
@@ -128,17 +128,26 @@ end
|
|
128
128
|
|
129
129
|
# Create a task to build the RDOC documentation tree.
|
130
130
|
|
131
|
-
|
131
|
+
begin
|
132
|
+
require 'darkfish-rdoc'
|
133
|
+
DARKFISH_ENABLED = true
|
134
|
+
rescue LoadError => ex
|
135
|
+
DARKFISH_ENABLED = false
|
136
|
+
end
|
137
|
+
|
138
|
+
rd = Rake::RDocTask.new("rdoc") do |rdoc|
|
132
139
|
rdoc.rdoc_dir = 'html'
|
133
140
|
rdoc.template = 'doc/jamis.rb'
|
134
141
|
rdoc.title = "Rake -- Ruby Make"
|
135
142
|
rdoc.options << '--line-numbers' << '--inline-source' <<
|
136
143
|
'--main' << 'README' <<
|
137
144
|
'--title' << 'Rake -- Ruby Make'
|
145
|
+
rdoc.options << '-SHN' << '-f' << 'darkfish' if DARKFISH_ENABLED
|
146
|
+
|
138
147
|
rdoc.rdoc_files.include('README', 'MIT-LICENSE', 'TODO', 'CHANGES')
|
139
148
|
rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
|
140
149
|
rdoc.rdoc_files.exclude(/\bcontrib\b/)
|
141
|
-
|
150
|
+
end
|
142
151
|
|
143
152
|
# ====================================================================
|
144
153
|
# Create a task that will package the Rake software into distributable
|
@@ -157,6 +166,7 @@ PKG_FILES = FileList[
|
|
157
166
|
'doc/**/*'
|
158
167
|
]
|
159
168
|
PKG_FILES.exclude('doc/example/*.o')
|
169
|
+
PKG_FILES.exclude('TAGS')
|
160
170
|
PKG_FILES.exclude(%r{doc/example/main$})
|
161
171
|
|
162
172
|
if ! defined?(Gem)
|
@@ -8,6 +8,16 @@ NOTE: The version of Rake that comes with Ruby 1.9 has diverged
|
|
8
8
|
comes with Ruby 1.9. A (near) future release of Rake will unify
|
9
9
|
those two codebases.
|
10
10
|
|
11
|
+
== Letter Writing Campaign
|
12
|
+
|
13
|
+
Thanks to Aaron Patterson (@tenderlove) and Eric Hodel (@drbrain) for
|
14
|
+
their encouraging support in organizing a letter writing campaign to
|
15
|
+
lobby for the "Warning Free" release of rake 0.8.4. A special callout
|
16
|
+
goes to Jonathan D. Lord, Sr (Dr. Wingnut) whose postcard was the
|
17
|
+
first to actually reach me. (see
|
18
|
+
http://tenderlovemaking.com/2009/02/26/we-need-a-new-version-of-rake/
|
19
|
+
for details)
|
20
|
+
|
11
21
|
== Changes
|
12
22
|
|
13
23
|
=== New Features / Enhancements in Version 0.8.4
|
@@ -0,0 +1,53 @@
|
|
1
|
+
= Rake 0.8.5 Released
|
2
|
+
|
3
|
+
Rake version 0.8.5 is a new release of Rake with greatly improved
|
4
|
+
support for executing commands on Windows. The "sh" command now has
|
5
|
+
the same semantics on Windows that it has on Unix based platforms.
|
6
|
+
|
7
|
+
== Changes
|
8
|
+
|
9
|
+
=== New Features / Enhancements in Version 0.8.5
|
10
|
+
|
11
|
+
* Improved implementation of the Rake system command for Windows.
|
12
|
+
(patch from James M. Lawrence/quix)
|
13
|
+
|
14
|
+
* Support for Ruby 1.9's improved system command. (patch from James
|
15
|
+
M. Lawrence/quix)
|
16
|
+
|
17
|
+
* Rake now includes the configured extension when invoking an
|
18
|
+
executable (Config::CONFIG['EXEEXT])
|
19
|
+
|
20
|
+
=== Bug Fixes in Version 0.8.5
|
21
|
+
|
22
|
+
* Environment variable keys are now correctly cased (it matters in
|
23
|
+
some implementations).
|
24
|
+
|
25
|
+
== What is Rake
|
26
|
+
|
27
|
+
Rake is a build tool similar to the make program in many ways. But
|
28
|
+
instead of cryptic make recipes, Rake uses standard Ruby code to
|
29
|
+
declare tasks and dependencies. You have the full power of a modern
|
30
|
+
scripting language built right into your build tool.
|
31
|
+
|
32
|
+
== Availability
|
33
|
+
|
34
|
+
The easiest way to get and install rake is via RubyGems ...
|
35
|
+
|
36
|
+
gem install rake (you may need root/admin privileges)
|
37
|
+
|
38
|
+
Otherwise, you can get it from the more traditional places:
|
39
|
+
|
40
|
+
Home Page:: http://rake.rubyforge.org/
|
41
|
+
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
42
|
+
GitHub:: git://github.com/jimweirich/rake.git
|
43
|
+
|
44
|
+
== Thanks
|
45
|
+
|
46
|
+
As usual, it was input from users that drove a alot of these changes. The
|
47
|
+
following people either contributed patches, made suggestions or made
|
48
|
+
otherwise helpful comments. Thanks to ...
|
49
|
+
|
50
|
+
* James M. Lawrence/quix
|
51
|
+
* Luis Lavena
|
52
|
+
|
53
|
+
-- Jim Weirich
|
data/lib/rake.rb
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
# as a library via a require statement, but it can be distributed
|
30
30
|
# independently as an application.
|
31
31
|
|
32
|
-
RAKEVERSION = '0.8.
|
32
|
+
RAKEVERSION = '0.8.5'
|
33
33
|
|
34
34
|
require 'rbconfig'
|
35
35
|
require 'fileutils'
|
@@ -40,6 +40,8 @@ require 'ostruct'
|
|
40
40
|
|
41
41
|
require 'rake/win32'
|
42
42
|
|
43
|
+
$trace = false
|
44
|
+
|
43
45
|
######################################################################
|
44
46
|
# Rake extensions to Module.
|
45
47
|
#
|
@@ -60,7 +62,7 @@ class Module
|
|
60
62
|
# end
|
61
63
|
#
|
62
64
|
def rake_extension(method)
|
63
|
-
if
|
65
|
+
if method_defined?(method)
|
64
66
|
$stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists"
|
65
67
|
else
|
66
68
|
yield
|
@@ -84,7 +86,7 @@ class String
|
|
84
86
|
if newext != ''
|
85
87
|
newext = (newext =~ /^\./) ? newext : ("." + newext)
|
86
88
|
end
|
87
|
-
|
89
|
+
self.chomp(File.extname(self)) << newext
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
@@ -161,7 +163,7 @@ class String
|
|
161
163
|
# 'a/b/c/d/file.txt'.pathmap("%2d") => 'a/b'
|
162
164
|
# 'a/b/c/d/file.txt'.pathmap("%-2d") => 'c/d'
|
163
165
|
#
|
164
|
-
# Also the %d, %p,
|
166
|
+
# Also the %d, %p, %f, %n, %x, and %X operators can take a
|
165
167
|
# pattern/replacement argument to perform simple string substititions on a
|
166
168
|
# particular part of the path. The pattern and replacement are speparated
|
167
169
|
# by a comma and are enclosed by curly braces. The replacement spec comes
|
@@ -207,13 +209,9 @@ class String
|
|
207
209
|
when '%d'
|
208
210
|
result << File.dirname(self)
|
209
211
|
when '%x'
|
210
|
-
result <<
|
212
|
+
result << File.extname(self)
|
211
213
|
when '%X'
|
212
|
-
|
213
|
-
result << $1
|
214
|
-
else
|
215
|
-
result << self
|
216
|
-
end
|
214
|
+
result << self.ext
|
217
215
|
when '%p'
|
218
216
|
result << self
|
219
217
|
when '%s'
|
@@ -308,6 +306,27 @@ module Rake
|
|
308
306
|
end
|
309
307
|
end
|
310
308
|
|
309
|
+
####################################################################
|
310
|
+
# Exit status class for times the system just gives us a nil.
|
311
|
+
class PseudoStatus
|
312
|
+
attr_reader :exitstatus
|
313
|
+
def initialize(code=0)
|
314
|
+
@exitstatus = code
|
315
|
+
end
|
316
|
+
def to_i
|
317
|
+
@exitstatus << 8
|
318
|
+
end
|
319
|
+
def >>(n)
|
320
|
+
to_i >> n
|
321
|
+
end
|
322
|
+
def stopped?
|
323
|
+
false
|
324
|
+
end
|
325
|
+
def exited?
|
326
|
+
true
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
311
330
|
####################################################################
|
312
331
|
# TaskAguments manage the arguments passed to a task.
|
313
332
|
#
|
@@ -804,6 +823,7 @@ module Rake
|
|
804
823
|
# parallel using Ruby threads.
|
805
824
|
#
|
806
825
|
class MultiTask < Task
|
826
|
+
private
|
807
827
|
def invoke_prerequisites(args, invocation_chain)
|
808
828
|
threads = @prerequisites.collect { |p|
|
809
829
|
Thread.new(p) { |r| application[r].invoke_with_call_chain(args, invocation_chain) }
|
@@ -937,7 +957,9 @@ end
|
|
937
957
|
# added to the FileUtils utility functions.
|
938
958
|
#
|
939
959
|
module FileUtils
|
940
|
-
RUBY = File.join(
|
960
|
+
RUBY = File.join(
|
961
|
+
Config::CONFIG['bindir'],
|
962
|
+
Config::CONFIG['ruby_install_name'] + Config::CONFIG['EXEEXT']).
|
941
963
|
sub(/.*\s.*/m, '"\&"')
|
942
964
|
|
943
965
|
OPT_TABLE['sh'] = %w(noop verbose)
|
@@ -963,7 +985,7 @@ module FileUtils
|
|
963
985
|
options = (Hash === cmd.last) ? cmd.pop : {}
|
964
986
|
unless block_given?
|
965
987
|
show_command = cmd.join(" ")
|
966
|
-
show_command = show_command[0,42] + "..."
|
988
|
+
show_command = show_command[0,42] + "..." unless $trace
|
967
989
|
# TODO code application logic heref show_command.length > 45
|
968
990
|
block = lambda { |ok, status|
|
969
991
|
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
|
@@ -979,16 +1001,14 @@ module FileUtils
|
|
979
1001
|
rake_output_message cmd.join(" ") if options[:verbose]
|
980
1002
|
unless options[:noop]
|
981
1003
|
res = rake_system(*cmd)
|
982
|
-
|
1004
|
+
status = $?
|
1005
|
+
status = PseudoStatus.new(1) if !res && status.nil?
|
1006
|
+
block.call(res, status)
|
983
1007
|
end
|
984
1008
|
end
|
985
1009
|
|
986
1010
|
def rake_system(*cmd)
|
987
|
-
|
988
|
-
Rake::Win32.rake_system(*cmd)
|
989
|
-
else
|
990
|
-
system(*cmd)
|
991
|
-
end
|
1011
|
+
Rake::AltSystem.system(*cmd)
|
992
1012
|
end
|
993
1013
|
private :rake_system
|
994
1014
|
|
@@ -1461,7 +1481,7 @@ module Rake
|
|
1461
1481
|
collect { |fn| fn.pathmap(spec) }
|
1462
1482
|
end
|
1463
1483
|
|
1464
|
-
# Return a new
|
1484
|
+
# Return a new FileList with <tt>String#ext</tt> method applied
|
1465
1485
|
# to each member of the array.
|
1466
1486
|
#
|
1467
1487
|
# This method is a shortcut for:
|
@@ -1479,9 +1499,9 @@ module Rake
|
|
1479
1499
|
# name, line number, and the matching line of text. If no block is given,
|
1480
1500
|
# a standard emac style file:linenumber:line message will be printed to
|
1481
1501
|
# standard out.
|
1482
|
-
def egrep(pattern)
|
1502
|
+
def egrep(pattern, *options)
|
1483
1503
|
each do |fn|
|
1484
|
-
open(fn) do |inf|
|
1504
|
+
open(fn, "rb", *options) do |inf|
|
1485
1505
|
count = 0
|
1486
1506
|
inf.each do |line|
|
1487
1507
|
count += 1
|
@@ -2044,10 +2064,10 @@ module Rake
|
|
2044
2064
|
yield
|
2045
2065
|
rescue SystemExit => ex
|
2046
2066
|
# Exit silently with current status
|
2047
|
-
|
2048
|
-
rescue
|
2067
|
+
raise
|
2068
|
+
rescue OptionParser::InvalidOption => ex
|
2049
2069
|
# Exit silently
|
2050
|
-
exit(
|
2070
|
+
exit(false)
|
2051
2071
|
rescue Exception => ex
|
2052
2072
|
# Exit with error message
|
2053
2073
|
$stderr.puts "#{name} aborted!"
|
@@ -2058,7 +2078,7 @@ module Rake
|
|
2058
2078
|
$stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
|
2059
2079
|
$stderr.puts "(See full trace by running task with --trace)"
|
2060
2080
|
end
|
2061
|
-
exit(
|
2081
|
+
exit(false)
|
2062
2082
|
end
|
2063
2083
|
end
|
2064
2084
|
|
@@ -2377,8 +2397,6 @@ module Rake
|
|
2377
2397
|
begin
|
2378
2398
|
if ENV['RAKE_SYSTEM']
|
2379
2399
|
ENV['RAKE_SYSTEM']
|
2380
|
-
elsif Win32.windows?
|
2381
|
-
Win32.win32_system_dir
|
2382
2400
|
else
|
2383
2401
|
standard_system_dir
|
2384
2402
|
end
|
@@ -2386,8 +2404,14 @@ module Rake
|
|
2386
2404
|
end
|
2387
2405
|
|
2388
2406
|
# The standard directory containing system wide rake files.
|
2389
|
-
|
2390
|
-
|
2407
|
+
if Win32.windows?
|
2408
|
+
def standard_system_dir #:nodoc:
|
2409
|
+
Win32.win32_system_dir
|
2410
|
+
end
|
2411
|
+
else
|
2412
|
+
def standard_system_dir #:nodoc:
|
2413
|
+
File.join(File.expand_path('~'), '.rake')
|
2414
|
+
end
|
2391
2415
|
end
|
2392
2416
|
private :standard_system_dir
|
2393
2417
|
|
@@ -0,0 +1,108 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2008 James M. Lawrence
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person
|
5
|
+
# obtaining a copy of this software and associated documentation files
|
6
|
+
# (the "Software"), to deal in the Software without restriction,
|
7
|
+
# including without limitation the rights to use, copy, modify, merge,
|
8
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
9
|
+
# and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
19
|
+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
20
|
+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
#
|
24
|
+
|
25
|
+
require 'rbconfig'
|
26
|
+
|
27
|
+
#
|
28
|
+
# Alternate implementations of system() and backticks `` on Windows
|
29
|
+
# for ruby-1.8 and earlier.
|
30
|
+
#
|
31
|
+
module Rake::AltSystem
|
32
|
+
WINDOWS = Config::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def define_module_function(name, &block)
|
36
|
+
define_method(name, &block)
|
37
|
+
module_function(name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
if WINDOWS and RUBY_VERSION < "1.9.0"
|
42
|
+
RUNNABLE_EXTS = %w[com exe bat cmd]
|
43
|
+
RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i
|
44
|
+
|
45
|
+
define_module_function :kernel_system, &Kernel.method(:system)
|
46
|
+
define_module_function :kernel_backticks, &Kernel.method(:'`')
|
47
|
+
|
48
|
+
module_function
|
49
|
+
|
50
|
+
def repair_command(cmd)
|
51
|
+
"call " + (
|
52
|
+
if cmd =~ %r!\A\s*\".*?\"!
|
53
|
+
# already quoted
|
54
|
+
cmd
|
55
|
+
elsif match = cmd.match(%r!\A\s*(\S+)!)
|
56
|
+
if match[1] =~ %r!/!
|
57
|
+
# avoid x/y.bat interpretation as x with option /y
|
58
|
+
%Q!"#{match[1]}"! + match.post_match
|
59
|
+
else
|
60
|
+
# a shell command will fail if quoted
|
61
|
+
cmd
|
62
|
+
end
|
63
|
+
else
|
64
|
+
# empty or whitespace
|
65
|
+
cmd
|
66
|
+
end
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def find_runnable(file)
|
71
|
+
if file =~ RUNNABLE_PATTERN
|
72
|
+
file
|
73
|
+
else
|
74
|
+
RUNNABLE_EXTS.each { |ext|
|
75
|
+
if File.exist?(test = "#{file}.#{ext}")
|
76
|
+
return test
|
77
|
+
end
|
78
|
+
}
|
79
|
+
nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def system(cmd, *args)
|
84
|
+
repaired = (
|
85
|
+
if args.empty?
|
86
|
+
[repair_command(cmd)]
|
87
|
+
elsif runnable = find_runnable(cmd)
|
88
|
+
[File.expand_path(runnable), *args]
|
89
|
+
else
|
90
|
+
# non-existent file
|
91
|
+
[cmd, *args]
|
92
|
+
end
|
93
|
+
)
|
94
|
+
kernel_system(*repaired)
|
95
|
+
end
|
96
|
+
|
97
|
+
def backticks(cmd)
|
98
|
+
kernel_backticks(repair_command(cmd))
|
99
|
+
end
|
100
|
+
|
101
|
+
define_module_function :'`', &method(:backticks)
|
102
|
+
else
|
103
|
+
# Non-Windows or ruby-1.9+: same as Kernel versions
|
104
|
+
define_module_function :system, &Kernel.method(:system)
|
105
|
+
define_module_function :backticks, &Kernel.method(:'`')
|
106
|
+
define_module_function :'`', &Kernel.method(:'`')
|
107
|
+
end
|
108
|
+
end
|
data/lib/rake/rdoctask.rb
CHANGED
@@ -10,7 +10,7 @@ module Rake
|
|
10
10
|
#
|
11
11
|
# The RDocTask will create the following targets:
|
12
12
|
#
|
13
|
-
# [<b
|
13
|
+
# [<b><em>rdoc</em></b>]
|
14
14
|
# Main task for this RDOC task.
|
15
15
|
#
|
16
16
|
# [<b>:clobber_<em>rdoc</em></b>]
|
@@ -21,7 +21,7 @@ module Rake
|
|
21
21
|
# Rebuild the rdoc files from scratch, even if they are not out
|
22
22
|
# of date.
|
23
23
|
#
|
24
|
-
# Simple
|
24
|
+
# Simple Example:
|
25
25
|
#
|
26
26
|
# Rake::RDocTask.new do |rd|
|
27
27
|
# rd.main = "README.rdoc"
|
@@ -134,7 +134,7 @@ module Rake
|
|
134
134
|
args = option_list + @rdoc_files
|
135
135
|
if @external
|
136
136
|
argstring = args.join(' ')
|
137
|
-
sh %{ruby -Ivendor
|
137
|
+
sh %{ruby -Ivendor vendor/rd #{argstring}}
|
138
138
|
else
|
139
139
|
require 'rdoc/rdoc'
|
140
140
|
RDoc::RDoc.new.document(args)
|
data/lib/rake/testtask.rb
CHANGED
@@ -95,7 +95,7 @@ module Rake
|
|
95
95
|
|
96
96
|
# Create the tasks defined by this task lib.
|
97
97
|
def define
|
98
|
-
lib_path = @libs.
|
98
|
+
lib_path = @libs.join(File::PATH_SEPARATOR)
|
99
99
|
desc "Run tests" + (@name==:test ? "" : " for #{@name}")
|
100
100
|
task @name do
|
101
101
|
run_code = ''
|
@@ -109,7 +109,7 @@ module Rake
|
|
109
109
|
when :rake
|
110
110
|
rake_loader
|
111
111
|
end
|
112
|
-
@ruby_opts.unshift( lib_path )
|
112
|
+
@ruby_opts.unshift( "-I\"#{lib_path}\"" )
|
113
113
|
@ruby_opts.unshift( "-w" ) if @warning
|
114
114
|
ruby @ruby_opts.join(" ") +
|
115
115
|
" \"#{run_code}\" " +
|
data/lib/rake/win32.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
|
2
|
-
require 'rake/repaired_system'
|
3
|
-
|
4
2
|
module Rake
|
5
|
-
|
3
|
+
require 'rake/alt_system'
|
4
|
+
|
6
5
|
# Win 32 interface methods for Rake. Windows specific functionality
|
7
6
|
# will be placed here to collect that knowledge in one spot.
|
8
7
|
module Win32
|
@@ -15,12 +14,12 @@ module Rake
|
|
15
14
|
class << self
|
16
15
|
# True if running on a windows system.
|
17
16
|
def windows?
|
18
|
-
|
17
|
+
AltSystem::WINDOWS
|
19
18
|
end
|
20
19
|
|
21
20
|
# Run a command line on windows.
|
22
21
|
def rake_system(*cmd)
|
23
|
-
|
22
|
+
AltSystem.system(*cmd)
|
24
23
|
end
|
25
24
|
|
26
25
|
# The standard directory containing system wide rake files on
|
data/test/test_application.rb
CHANGED
@@ -171,48 +171,10 @@ class TestApplication < Test::Unit::TestCase
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
-
def test_load_from_system_rakefile_on_unix
|
175
|
-
flexmock(Rake::Win32, :windows? => false,
|
176
|
-
:win32_system_dir => nil)
|
177
|
-
flexmock(@app, :load => nil)
|
178
|
-
flexmock(File).should_receive(:expand_path).with("~").and_return("/HOME")
|
179
|
-
flexmock(File).should_receive(:expand_path).and_return { |fn| fn }
|
180
|
-
|
181
|
-
in_environment('RAKE_SYSTEM' => nil) do
|
182
|
-
@app.options.rakelib = []
|
183
|
-
@app.instance_eval do
|
184
|
-
handle_options
|
185
|
-
options.silent = true
|
186
|
-
options.load_system = true
|
187
|
-
options.rakelib = []
|
188
|
-
load_rakefile
|
189
|
-
end
|
190
|
-
assert_equal "/HOME/.rake", @app.system_dir
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
174
|
def test_windows
|
195
175
|
assert ! (@app.windows? && @app.unix?)
|
196
176
|
end
|
197
177
|
|
198
|
-
def test_load_from_system_rakefile_on_windows
|
199
|
-
flexmock(Rake::Win32, :windows? => true)
|
200
|
-
flexmock(@app, :standard_system_dir => "XX")
|
201
|
-
flexmock(@app).should_receive(:load).and_return(nil)
|
202
|
-
flexmock(File).should_receive(:directory?).with("C:/AD/Rake").and_return(true)
|
203
|
-
in_environment('RAKE_SYSTEM' => nil, 'HOME' => nil, 'HOMEDRIVE' => 'C:', 'HOMEPATH' => '\\AD') do
|
204
|
-
@app.options.rakelib = []
|
205
|
-
@app.instance_eval do
|
206
|
-
handle_options
|
207
|
-
options.silent = true
|
208
|
-
options.load_system = true
|
209
|
-
options.rakelib = []
|
210
|
-
load_rakefile
|
211
|
-
end
|
212
|
-
assert_equal "C:/AD/Rake", @app.system_dir
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
178
|
def test_loading_imports
|
217
179
|
mock = flexmock("loader")
|
218
180
|
mock.should_receive(:load).with("x.dummy").once
|
@@ -235,7 +197,7 @@ class TestApplication < Test::Unit::TestCase
|
|
235
197
|
end
|
236
198
|
end
|
237
199
|
|
238
|
-
def
|
200
|
+
def test_handle_options_should_strip_options_from_ARGV
|
239
201
|
assert !@app.options.trace
|
240
202
|
|
241
203
|
valid_option = '--trace'
|
data/test/test_filelist.rb
CHANGED
@@ -285,9 +285,7 @@ class TestFileList < Test::Unit::TestCase
|
|
285
285
|
assert_equal "one.two.net", "one.two.c".ext(".net")
|
286
286
|
assert_equal "one/two.net", "one/two.c".ext(".net")
|
287
287
|
assert_equal "one.x/two.net", "one.x/two.c".ext(".net")
|
288
|
-
assert_equal "one.x\\two.net", "one.x\\two.c".ext(".net")
|
289
288
|
assert_equal "one.x/two.net", "one.x/two".ext(".net")
|
290
|
-
assert_equal "one.x\\two.net", "one.x\\two".ext(".net")
|
291
289
|
assert_equal ".onerc.net", ".onerc.dot".ext("net")
|
292
290
|
assert_equal ".onerc.net", ".onerc".ext("net")
|
293
291
|
assert_equal ".a/.onerc.net", ".a/.onerc".ext("net")
|
@@ -297,6 +295,11 @@ class TestFileList < Test::Unit::TestCase
|
|
297
295
|
assert_equal ".one", ".one".ext
|
298
296
|
assert_equal ".", ".".ext("c")
|
299
297
|
assert_equal "..", "..".ext("c")
|
298
|
+
# These only need to work in windows
|
299
|
+
if Rake::Win32.windows?
|
300
|
+
assert_equal "one.x\\two.net", "one.x\\two.c".ext(".net")
|
301
|
+
assert_equal "one.x\\two.net", "one.x\\two".ext(".net")
|
302
|
+
end
|
300
303
|
end
|
301
304
|
|
302
305
|
def test_filelist_ext
|
data/test/test_fileutils.rb
CHANGED
@@ -139,15 +139,17 @@ class TestFileUtils < Test::Unit::TestCase
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
def
|
142
|
+
def test_sh_with_a_single_string_argument
|
143
143
|
ENV['RAKE_TEST_SH'] = 'someval'
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
144
|
+
verbose(false) {
|
145
|
+
sh %{ruby test/check_expansion.rb #{env_var} someval}
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_sh_with_multiple_arguments
|
150
|
+
ENV['RAKE_TEST_SH'] = 'someval'
|
151
|
+
verbose(false) {
|
152
|
+
Sh.run 'ruby', 'test/check_no_expansion.rb', env_var, 'someval'
|
151
153
|
}
|
152
154
|
end
|
153
155
|
|
@@ -204,35 +206,18 @@ class TestFileUtils < Test::Unit::TestCase
|
|
204
206
|
assert_equal '', out
|
205
207
|
end
|
206
208
|
|
207
|
-
def
|
208
|
-
|
209
|
-
|
209
|
+
def test_ruby_with_a_single_string_argument
|
210
|
+
ENV['RAKE_TEST_SH'] = 'someval'
|
211
|
+
verbose(false) {
|
212
|
+
ruby %{test/check_expansion.rb #{env_var} someval}
|
210
213
|
}
|
211
|
-
assert_equal '', out
|
212
214
|
end
|
213
215
|
|
214
|
-
def
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
env_var = windows? ? '%RAKE_TEST_RUBY%' : '$RAKE_TEST_RUBY'
|
220
|
-
ruby %{-e "exit #{env_var}"} do |ok, status| # " (emacs wart)
|
221
|
-
assert(!ok)
|
222
|
-
assert_equal 123, status.exitstatus
|
223
|
-
block_run = true
|
224
|
-
end
|
225
|
-
assert block_run, "The block must be run"
|
226
|
-
|
227
|
-
# This one does not get expanded
|
228
|
-
block_run = false
|
229
|
-
ruby '-e', %{exit %{#{env_var}}.length} do |ok, status| # " (emacs wart)
|
230
|
-
assert(!ok)
|
231
|
-
assert_equal env_var.length, status.exitstatus
|
232
|
-
block_run = true
|
233
|
-
end
|
234
|
-
assert block_run, "The block must be run"
|
235
|
-
end
|
216
|
+
def test_ruby_with_multiple_arguments
|
217
|
+
ENV['RAKE_TEST_SH'] = 'someval'
|
218
|
+
verbose(false) {
|
219
|
+
ruby 'test/check_no_expansion.rb', env_var, 'someval'
|
220
|
+
}
|
236
221
|
end
|
237
222
|
|
238
223
|
def test_split_all
|
@@ -259,4 +244,8 @@ class TestFileUtils < Test::Unit::TestCase
|
|
259
244
|
! File::ALT_SEPARATOR.nil?
|
260
245
|
end
|
261
246
|
|
247
|
+
def env_var
|
248
|
+
windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
|
249
|
+
end
|
250
|
+
|
262
251
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
require 'test/capture_stdout'
|
7
|
+
require 'test/rake_test_setup'
|
8
|
+
|
9
|
+
class PseudoStatusTest < Test::Unit::TestCase
|
10
|
+
def test_with_zero_exit_status
|
11
|
+
s = Rake::PseudoStatus.new
|
12
|
+
assert_equal 0, s.exitstatus
|
13
|
+
assert_equal 0, s.to_i
|
14
|
+
assert_equal 0, s >> 8
|
15
|
+
assert ! s.stopped?
|
16
|
+
assert s.exited?
|
17
|
+
end
|
18
|
+
def test_with_99_exit_status
|
19
|
+
s = Rake::PseudoStatus.new(99)
|
20
|
+
assert_equal 99, s.exitstatus
|
21
|
+
assert_equal 25344, s.to_i
|
22
|
+
assert_equal 99, s >> 8
|
23
|
+
assert ! s.stopped?
|
24
|
+
assert s.exited?
|
25
|
+
end
|
26
|
+
end
|
data/test/test_tasks.rb
CHANGED
@@ -181,7 +181,7 @@ class TestTask < Test::Unit::TestCase
|
|
181
181
|
out = t1.investigation
|
182
182
|
assert_match(/class:\s*Rake::Task/, out)
|
183
183
|
assert_match(/needed:\s*true/, out)
|
184
|
-
assert_match(/pre-requisites:\s*--
|
184
|
+
assert_match(/pre-requisites:\s*--t[23]/, out)
|
185
185
|
end
|
186
186
|
|
187
187
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-06 00:00:00 -07:00
|
13
13
|
default_executable: rake
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -43,6 +43,7 @@ extra_rdoc_files:
|
|
43
43
|
- doc/release_notes/rake-0.8.2.rdoc
|
44
44
|
- doc/release_notes/rake-0.8.3.rdoc
|
45
45
|
- doc/release_notes/rake-0.8.4.rdoc
|
46
|
+
- doc/release_notes/rake-0.8.5.rdoc
|
46
47
|
files:
|
47
48
|
- install.rb
|
48
49
|
- CHANGES
|
@@ -51,6 +52,7 @@ files:
|
|
51
52
|
- README
|
52
53
|
- TODO
|
53
54
|
- bin/rake
|
55
|
+
- lib/rake/alt_system.rb
|
54
56
|
- lib/rake/classic_namespace.rb
|
55
57
|
- lib/rake/clean.rb
|
56
58
|
- lib/rake/contrib/compositepublisher.rb
|
@@ -64,7 +66,6 @@ files:
|
|
64
66
|
- lib/rake/packagetask.rb
|
65
67
|
- lib/rake/rake_test_loader.rb
|
66
68
|
- lib/rake/rdoctask.rb
|
67
|
-
- lib/rake/repaired_system.rb
|
68
69
|
- lib/rake/ruby182_test_unit_fix.rb
|
69
70
|
- lib/rake/runtest.rb
|
70
71
|
- lib/rake/tasklib.rb
|
@@ -73,6 +74,7 @@ files:
|
|
73
74
|
- lib/rake.rb
|
74
75
|
- test/capture_stdout.rb
|
75
76
|
- test/check_expansion.rb
|
77
|
+
- test/check_no_expansion.rb
|
76
78
|
- test/contrib/test_sys.rb
|
77
79
|
- test/data/rakelib/test1.rb
|
78
80
|
- test/data/rbext/rakefile.rb
|
@@ -100,6 +102,7 @@ files:
|
|
100
102
|
- test/test_namespace.rb
|
101
103
|
- test/test_package_task.rb
|
102
104
|
- test/test_pathmap.rb
|
105
|
+
- test/test_pseudo_status.rb
|
103
106
|
- test/test_rake.rb
|
104
107
|
- test/test_rdoc_task.rb
|
105
108
|
- test/test_require.rb
|
@@ -151,6 +154,7 @@ files:
|
|
151
154
|
- doc/release_notes/rake-0.8.2.rdoc
|
152
155
|
- doc/release_notes/rake-0.8.3.rdoc
|
153
156
|
- doc/release_notes/rake-0.8.4.rdoc
|
157
|
+
- doc/release_notes/rake-0.8.5.rdoc
|
154
158
|
has_rdoc: true
|
155
159
|
homepage: http://rake.rubyforge.org
|
156
160
|
post_install_message:
|
@@ -161,6 +165,9 @@ rdoc_options:
|
|
161
165
|
- README
|
162
166
|
- --title
|
163
167
|
- Rake -- Ruby Make
|
168
|
+
- -SHN
|
169
|
+
- -f
|
170
|
+
- darkfish
|
164
171
|
require_paths:
|
165
172
|
- lib
|
166
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/lib/rake/repaired_system.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2008 James M. Lawrence
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person
|
5
|
-
# obtaining a copy of this software and associated documentation files
|
6
|
-
# (the "Software"), to deal in the Software without restriction,
|
7
|
-
# including without limitation the rights to use, copy, modify, merge,
|
8
|
-
# publish, distribute, sublicense, and/or sell copies of the Software,
|
9
|
-
# and to permit persons to whom the Software is furnished to do so,
|
10
|
-
# subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
19
|
-
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
20
|
-
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
# SOFTWARE.
|
23
|
-
#
|
24
|
-
|
25
|
-
require 'rbconfig'
|
26
|
-
|
27
|
-
module Rake
|
28
|
-
end
|
29
|
-
|
30
|
-
#
|
31
|
-
# Alternate implementations of system() and backticks `` for Windows.
|
32
|
-
#
|
33
|
-
module Rake::RepairedSystem
|
34
|
-
class << self
|
35
|
-
def define_module_function(name, &block)
|
36
|
-
define_method(name, &block)
|
37
|
-
module_function(name)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
if Config::CONFIG["host_os"] !~ %r!(msdos|mswin|djgpp|mingw)!
|
42
|
-
define_module_function :system, &Kernel.method(:system)
|
43
|
-
define_module_function :'`', &Kernel.method(:'`')
|
44
|
-
else
|
45
|
-
BINARY_EXTS = %w[com exe]
|
46
|
-
|
47
|
-
BATCHFILE_EXTS = %w[bat] +
|
48
|
-
if (t = ENV["COMSPEC"]) and t =~ %r!command\.exe\Z!i
|
49
|
-
[]
|
50
|
-
else
|
51
|
-
%w[cmd]
|
52
|
-
end
|
53
|
-
|
54
|
-
RUNNABLE_EXTS = BINARY_EXTS + BATCHFILE_EXTS
|
55
|
-
|
56
|
-
RUNNABLE_PATTERN, BINARY_PATTERN, BATCHFILE_PATTERN =
|
57
|
-
[RUNNABLE_EXTS, BINARY_EXTS, BATCHFILE_EXTS].map { |exts|
|
58
|
-
if exts.size > 1
|
59
|
-
%r!\.(#{exts.join('|')})\Z!i
|
60
|
-
else
|
61
|
-
%r!\.#{exts.first}\Z!i
|
62
|
-
end
|
63
|
-
}
|
64
|
-
|
65
|
-
define_module_function :system_previous, &Kernel.method(:system)
|
66
|
-
define_module_function :backticks_previous, &Kernel.method(:'`')
|
67
|
-
|
68
|
-
module_function
|
69
|
-
|
70
|
-
def repair_command(cmd)
|
71
|
-
if (match = cmd.match(%r!\A\s*\"(.*?)\"!)) or
|
72
|
-
(match = cmd.match(%r!\A(\S+)!))
|
73
|
-
if runnable = find_runnable(match.captures.first)
|
74
|
-
quote(to_backslashes(runnable)) + match.post_match
|
75
|
-
else
|
76
|
-
cmd
|
77
|
-
end
|
78
|
-
else
|
79
|
-
cmd
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def join_command(*args)
|
84
|
-
first =
|
85
|
-
if args.first =~ %r!\s!
|
86
|
-
quote(args.first)
|
87
|
-
else
|
88
|
-
args.first
|
89
|
-
end
|
90
|
-
[to_backslashes(first), *tail(args)].join(" ")
|
91
|
-
end
|
92
|
-
|
93
|
-
def to_backslashes(string)
|
94
|
-
string.gsub("/", "\\")
|
95
|
-
end
|
96
|
-
|
97
|
-
def quote(string)
|
98
|
-
%Q!"#{string}"!
|
99
|
-
end
|
100
|
-
|
101
|
-
def tail(array)
|
102
|
-
array[1..-1]
|
103
|
-
end
|
104
|
-
|
105
|
-
def find_runnable(file)
|
106
|
-
if file =~ RUNNABLE_PATTERN
|
107
|
-
file
|
108
|
-
else
|
109
|
-
[nil, ".", *ENV["PATH"].split(";")].each { |path|
|
110
|
-
RUNNABLE_EXTS.each { |ext|
|
111
|
-
test = (path ? "#{path}/" : "") + "#{file}.#{ext}"
|
112
|
-
if File.exist?(test)
|
113
|
-
return test
|
114
|
-
end
|
115
|
-
}
|
116
|
-
}
|
117
|
-
nil
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def system(cmd, *args)
|
122
|
-
file = cmd.to_s
|
123
|
-
repaired_args =
|
124
|
-
if args.empty?
|
125
|
-
[repair_command(file)]
|
126
|
-
elsif file =~ BATCHFILE_PATTERN
|
127
|
-
[ENV["COMSPEC"], "/c", to_backslashes(File.expand_path(file)), *args]
|
128
|
-
elsif runnable = find_runnable(file)
|
129
|
-
[to_backslashes(File.expand_path(runnable)), *args]
|
130
|
-
else
|
131
|
-
# maybe a built-in shell command
|
132
|
-
[join_command(file, *args)]
|
133
|
-
end
|
134
|
-
if repaired_args.size == 1
|
135
|
-
system_previous("call #{repaired_args.first}")
|
136
|
-
else
|
137
|
-
system_previous(*repaired_args)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def `(cmd) #`
|
142
|
-
backticks_previous(repair_command(cmd))
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|