rake 10.5.0 → 11.0.1
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.
- checksums.yaml +4 -4
- data/History.rdoc +34 -0
- data/Manifest.txt +1 -13
- data/README.rdoc +20 -2
- data/Rakefile +3 -2
- data/lib/rake.rb +2 -8
- data/lib/rake/application.rb +2 -5
- data/lib/rake/contrib/sshpublisher.rb +0 -1
- data/lib/rake/cpu_counter.rb +4 -9
- data/lib/rake/dsl_definition.rb +0 -7
- data/lib/rake/ext/fixnum.rb +18 -0
- data/lib/rake/file_list.rb +22 -14
- data/lib/rake/file_utils.rb +1 -6
- data/lib/rake/linked_list.rb +23 -15
- data/lib/rake/task.rb +9 -1
- data/lib/rake/task_arguments.rb +4 -0
- data/lib/rake/task_manager.rb +0 -4
- data/lib/rake/tasklib.rb +0 -13
- data/lib/rake/testtask.rb +3 -11
- data/lib/rake/thread_pool.rb +1 -2
- data/lib/rake/trace_output.rb +1 -1
- data/lib/rake/win32.rb +2 -8
- data/test/helper.rb +15 -10
- data/test/support/rakefile_definitions.rb +1 -3
- data/test/test_rake_application.rb +16 -0
- data/test/test_rake_application_options.rb +1 -1
- data/test/test_rake_file_list.rb +17 -0
- data/test/test_rake_file_list_path_map.rb +7 -0
- data/test/test_rake_file_utils.rb +4 -0
- data/test/test_rake_functional.rb +4 -2
- data/test/test_rake_task.rb +37 -0
- data/test/test_rake_task_arguments.rb +7 -0
- data/test/test_rake_test_task.rb +8 -23
- metadata +7 -17
- data/lib/rake/alt_system.rb +0 -110
- data/lib/rake/contrib/publisher.rb +0 -81
- data/lib/rake/contrib/rubyforgepublisher.rb +0 -18
- data/lib/rake/contrib/sys.rb +0 -4
- data/lib/rake/ext/module.rb +0 -2
- data/lib/rake/ext/time.rb +0 -18
- data/lib/rake/gempackagetask.rb +0 -4
- data/lib/rake/pathmap.rb +0 -3
- data/lib/rake/rdoctask.rb +0 -4
- data/lib/rake/ruby182_test_unit_fix.rb +0 -29
- data/lib/rake/runtest.rb +0 -27
- data/rakelib/publish.rake +0 -20
- data/test/test_rake_task_lib.rb +0 -9
data/lib/rake/linked_list.rb
CHANGED
@@ -4,14 +4,8 @@ module Rake
|
|
4
4
|
# structures in Rake.
|
5
5
|
class LinkedList
|
6
6
|
include Enumerable
|
7
|
-
|
8
7
|
attr_reader :head, :tail
|
9
8
|
|
10
|
-
def initialize(head, tail=EMPTY)
|
11
|
-
@head = head
|
12
|
-
@tail = tail
|
13
|
-
end
|
14
|
-
|
15
9
|
# Polymorphically add a new element to the head of a list. The
|
16
10
|
# type of head node will be the same list type as the tail.
|
17
11
|
def conj(item)
|
@@ -19,6 +13,9 @@ module Rake
|
|
19
13
|
end
|
20
14
|
|
21
15
|
# Is the list empty?
|
16
|
+
# .make guards against a list being empty making any instantiated LinkedList
|
17
|
+
# object not empty by default
|
18
|
+
# You should consider overriding this method if you implement your own .make method
|
22
19
|
def empty?
|
23
20
|
false
|
24
21
|
end
|
@@ -26,7 +23,7 @@ module Rake
|
|
26
23
|
# Lists are structurally equivalent.
|
27
24
|
def ==(other)
|
28
25
|
current = self
|
29
|
-
while !
|
26
|
+
while !current.empty? && !other.empty?
|
30
27
|
return false if current.head != other.head
|
31
28
|
current = current.tail
|
32
29
|
other = other.tail
|
@@ -36,20 +33,20 @@ module Rake
|
|
36
33
|
|
37
34
|
# Convert to string: LL(item, item...)
|
38
35
|
def to_s
|
39
|
-
items = map
|
36
|
+
items = map(&:to_s).join(", ")
|
40
37
|
"LL(#{items})"
|
41
38
|
end
|
42
39
|
|
43
40
|
# Same as +to_s+, but with inspected items.
|
44
41
|
def inspect
|
45
|
-
items = map
|
42
|
+
items = map(&:inspect).join(", ")
|
46
43
|
"LL(#{items})"
|
47
44
|
end
|
48
45
|
|
49
46
|
# For each item in the list.
|
50
47
|
def each
|
51
48
|
current = self
|
52
|
-
while !
|
49
|
+
while !current.empty?
|
53
50
|
yield(current.head)
|
54
51
|
current = current.tail
|
55
52
|
end
|
@@ -59,11 +56,16 @@ module Rake
|
|
59
56
|
# Make a list out of the given arguments. This method is
|
60
57
|
# polymorphic
|
61
58
|
def self.make(*args)
|
62
|
-
|
63
|
-
args
|
64
|
-
|
59
|
+
# return an EmptyLinkedList if there are no arguments
|
60
|
+
return empty if !args || args.empty?
|
61
|
+
|
62
|
+
# build a LinkedList by starting at the tail and iterating
|
63
|
+
# through each argument
|
64
|
+
# inject takes an EmptyLinkedList to start
|
65
|
+
args.reverse.inject(empty) do |list, item|
|
66
|
+
list = cons(item, list)
|
67
|
+
list # return the newly created list for each item in the block
|
65
68
|
end
|
66
|
-
result
|
67
69
|
end
|
68
70
|
|
69
71
|
# Cons a new head onto the tail list.
|
@@ -76,6 +78,13 @@ module Rake
|
|
76
78
|
self::EMPTY
|
77
79
|
end
|
78
80
|
|
81
|
+
protected
|
82
|
+
|
83
|
+
def initialize(head, tail=EMPTY)
|
84
|
+
@head = head
|
85
|
+
@tail = tail
|
86
|
+
end
|
87
|
+
|
79
88
|
# Represent an empty list, using the Null Object Pattern.
|
80
89
|
#
|
81
90
|
# When inheriting from the LinkedList class, you should implement
|
@@ -99,5 +108,4 @@ module Rake
|
|
99
108
|
|
100
109
|
EMPTY = EmptyLinkedList.new
|
101
110
|
end
|
102
|
-
|
103
111
|
end
|
data/lib/rake/task.rb
CHANGED
@@ -29,6 +29,10 @@ module Rake
|
|
29
29
|
# location option set).
|
30
30
|
attr_reader :locations
|
31
31
|
|
32
|
+
# Has this task already been invoked? Already invoked tasks
|
33
|
+
# will be skipped unless you reenable them.
|
34
|
+
attr_reader :already_invoked
|
35
|
+
|
32
36
|
# Return task name
|
33
37
|
def to_s
|
34
38
|
name
|
@@ -54,7 +58,11 @@ module Rake
|
|
54
58
|
end
|
55
59
|
|
56
60
|
def lookup_prerequisite(prerequisite_name) # :nodoc:
|
57
|
-
application[prerequisite_name, @scope]
|
61
|
+
scoped_prerequisite_task = application[prerequisite_name, @scope]
|
62
|
+
if scoped_prerequisite_task == self
|
63
|
+
unscoped_prerequisite_task = application[prerequisite_name]
|
64
|
+
end
|
65
|
+
unscoped_prerequisite_task || scoped_prerequisite_task
|
58
66
|
end
|
59
67
|
private :lookup_prerequisite
|
60
68
|
|
data/lib/rake/task_arguments.rb
CHANGED
data/lib/rake/task_manager.rb
CHANGED
@@ -5,10 +5,6 @@ module Rake
|
|
5
5
|
# Track the last comment made in the Rakefile.
|
6
6
|
attr_accessor :last_description
|
7
7
|
|
8
|
-
# TODO: Remove in Rake 11
|
9
|
-
|
10
|
-
alias :last_comment :last_description # :nodoc: Backwards compatibility
|
11
|
-
|
12
8
|
def initialize # :nodoc:
|
13
9
|
super
|
14
10
|
@tasks = Hash.new
|
data/lib/rake/tasklib.rb
CHANGED
@@ -6,19 +6,6 @@ module Rake
|
|
6
6
|
class TaskLib
|
7
7
|
include Cloneable
|
8
8
|
include Rake::DSL
|
9
|
-
|
10
|
-
# Make a symbol by pasting two strings together.
|
11
|
-
#
|
12
|
-
# NOTE: DEPRECATED! This method is kinda stupid. I don't know why
|
13
|
-
# I didn't just use string interpolation. But now other task
|
14
|
-
# libraries depend on this so I can't remove it without breaking
|
15
|
-
# other people's code. So for now it stays for backwards
|
16
|
-
# compatibility. BUT DON'T USE IT.
|
17
|
-
#--
|
18
|
-
# TODO: Remove in Rake 11
|
19
|
-
def paste(a, b) # :nodoc:
|
20
|
-
(a.to_s + b.to_s).intern
|
21
|
-
end
|
22
9
|
end
|
23
10
|
|
24
11
|
end
|
data/lib/rake/testtask.rb
CHANGED
@@ -85,7 +85,7 @@ module Rake
|
|
85
85
|
@options = nil
|
86
86
|
@test_files = nil
|
87
87
|
@verbose = false
|
88
|
-
@warning =
|
88
|
+
@warning = true
|
89
89
|
@loader = :rake
|
90
90
|
@ruby_opts = []
|
91
91
|
@description = "Run tests" + (@name == :test ? "" : " for #{@name}")
|
@@ -128,6 +128,7 @@ module Rake
|
|
128
128
|
opts = @ruby_opts.dup
|
129
129
|
opts.unshift("-I\"#{lib_path}\"") unless @libs.empty?
|
130
130
|
opts.unshift("-w") if @warning
|
131
|
+
opts.unshift('--verbose') if @verbose
|
131
132
|
opts.join(" ")
|
132
133
|
end
|
133
134
|
|
@@ -150,15 +151,6 @@ module Rake
|
|
150
151
|
end
|
151
152
|
end
|
152
153
|
|
153
|
-
def fix # :nodoc:
|
154
|
-
case ruby_version
|
155
|
-
when '1.8.2'
|
156
|
-
"\"#{find_file 'rake/ruby182_test_unit_fix'}\""
|
157
|
-
else
|
158
|
-
nil
|
159
|
-
end || ''
|
160
|
-
end
|
161
|
-
|
162
154
|
def ruby_version # :nodoc:
|
163
155
|
RUBY_VERSION
|
164
156
|
end
|
@@ -168,7 +160,7 @@ module Rake
|
|
168
160
|
when :direct
|
169
161
|
"-e \"ARGV.each{|f| require f}\""
|
170
162
|
when :testrb
|
171
|
-
"-S testrb
|
163
|
+
"-S testrb"
|
172
164
|
when :rake
|
173
165
|
"#{rake_include_arg} \"#{rake_loader}\""
|
174
166
|
end
|
data/lib/rake/thread_pool.rb
CHANGED
@@ -57,8 +57,7 @@ module Rake
|
|
57
57
|
$stderr.puts e.backtrace.join("\n")
|
58
58
|
@threads.each do |t|
|
59
59
|
$stderr.print "Thread #{t} status = #{t.status}\n"
|
60
|
-
|
61
|
-
$stderr.puts t.backtrace.join("\n") if t.respond_to? :backtrace
|
60
|
+
$stderr.puts t.backtrace.join("\n")
|
62
61
|
end
|
63
62
|
raise e
|
64
63
|
end
|
data/lib/rake/trace_output.rb
CHANGED
data/lib/rake/win32.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
+
require 'rbconfig'
|
1
2
|
|
2
3
|
module Rake
|
3
|
-
require 'rake/alt_system'
|
4
|
-
|
5
4
|
# Win 32 interface methods for Rake. Windows specific functionality
|
6
5
|
# will be placed here to collect that knowledge in one spot.
|
7
6
|
module Win32 # :nodoc: all
|
@@ -14,12 +13,7 @@ module Rake
|
|
14
13
|
class << self
|
15
14
|
# True if running on a windows system.
|
16
15
|
def windows?
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
# Run a command line on windows.
|
21
|
-
def rake_system(*cmd)
|
22
|
-
AltSystem.system(*cmd)
|
16
|
+
RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
|
23
17
|
end
|
24
18
|
|
25
19
|
# The standard directory containing system wide rake files on
|
data/test/helper.rb
CHANGED
@@ -11,15 +11,8 @@ require 'rake'
|
|
11
11
|
require 'tmpdir'
|
12
12
|
require File.expand_path('../file_creation', __FILE__)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
require_relative 'support/ruby_runner'
|
17
|
-
require_relative 'support/rakefile_definitions'
|
18
|
-
rescue NoMethodError, LoadError
|
19
|
-
# ruby 1.8
|
20
|
-
require 'test/support/ruby_runner'
|
21
|
-
require 'test/support/rakefile_definitions'
|
22
|
-
end
|
14
|
+
require_relative 'support/ruby_runner'
|
15
|
+
require_relative 'support/rakefile_definitions'
|
23
16
|
|
24
17
|
class Rake::TestCase < Minitest::Test
|
25
18
|
include FileCreation
|
@@ -30,7 +23,7 @@ class Rake::TestCase < Minitest::Test
|
|
30
23
|
include Rake::TaskManager
|
31
24
|
end
|
32
25
|
|
33
|
-
RUBY =
|
26
|
+
RUBY = Gem.ruby
|
34
27
|
|
35
28
|
def setup
|
36
29
|
ARGV.clear
|
@@ -125,5 +118,17 @@ end
|
|
125
118
|
end
|
126
119
|
end
|
127
120
|
|
121
|
+
def jruby?
|
122
|
+
defined?(JRUBY_VERSION)
|
123
|
+
end
|
124
|
+
|
125
|
+
def jruby17?
|
126
|
+
jruby? && (JRUBY_VERSION < '9.0.0.0')
|
127
|
+
end
|
128
|
+
|
129
|
+
def jruby9?
|
130
|
+
jruby? && (JRUBY_VERSION >= '9.0.0.0')
|
131
|
+
end
|
132
|
+
|
128
133
|
include RakefileDefinitions
|
129
134
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#encoding: UTF-8
|
1
2
|
require File.expand_path('../helper', __FILE__)
|
2
3
|
|
3
4
|
class TestRakeApplication < Rake::TestCase
|
@@ -34,6 +35,20 @@ class TestRakeApplication < Rake::TestCase
|
|
34
35
|
assert_match __method__.to_s, err
|
35
36
|
end
|
36
37
|
|
38
|
+
def test_display_exception_details_bad_encoding
|
39
|
+
begin
|
40
|
+
raise 'El Niño is coming!'.force_encoding('US-ASCII')
|
41
|
+
rescue => ex
|
42
|
+
end
|
43
|
+
|
44
|
+
out, err = capture_io do
|
45
|
+
@app.display_error_message ex
|
46
|
+
end
|
47
|
+
|
48
|
+
assert_empty out
|
49
|
+
assert_match 'El Niño is coming!', err.force_encoding('UTF-8')
|
50
|
+
end
|
51
|
+
|
37
52
|
def test_display_exception_details_cause
|
38
53
|
skip 'Exception#cause not implemented' unless
|
39
54
|
Exception.method_defined? :cause
|
@@ -60,6 +75,7 @@ class TestRakeApplication < Rake::TestCase
|
|
60
75
|
def test_display_exception_details_cause_loop
|
61
76
|
skip 'Exception#cause not implemented' unless
|
62
77
|
Exception.method_defined? :cause
|
78
|
+
skip if jruby9? # https://github.com/jruby/jruby/issues/3654
|
63
79
|
|
64
80
|
begin
|
65
81
|
begin
|
data/test/test_rake_file_list.rb
CHANGED
@@ -210,6 +210,23 @@ class TestRakeFileList < Rake::TestCase
|
|
210
210
|
assert_equal FileList, fl.class
|
211
211
|
end
|
212
212
|
|
213
|
+
def test_exclude_curly_bracket_pattern
|
214
|
+
skip 'brace pattern matches not supported' unless defined? File::FNM_EXTGLOB
|
215
|
+
fl = FileList['*'].exclude('{abc,xyz}.c')
|
216
|
+
assert_equal %w[abc.h abc.x cfiles existing x.c xyzzy.txt], fl
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_exclude_an_array
|
220
|
+
fl = FileList['*'].exclude(['existing', '*.c'])
|
221
|
+
assert_equal %w[abc.h abc.x cfiles xyzzy.txt], fl
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_exclude_a_filelist
|
225
|
+
excluded = FileList['existing', '*.c']
|
226
|
+
fl = FileList['*'].exclude(excluded)
|
227
|
+
assert_equal %w[abc.h abc.x cfiles xyzzy.txt], fl
|
228
|
+
end
|
229
|
+
|
213
230
|
def test_default_exclude
|
214
231
|
fl = FileList.new
|
215
232
|
fl.clear_exclude
|
@@ -4,5 +4,12 @@ class TestRakeFileListPathMap < Rake::TestCase
|
|
4
4
|
def test_file_list_supports_pathmap
|
5
5
|
assert_equal ['a', 'b'], FileList['dir/a.rb', 'dir/b.rb'].pathmap("%n")
|
6
6
|
end
|
7
|
+
|
8
|
+
def test_file_list_supports_pathmap_with_a_block
|
9
|
+
mapped = FileList['dir/a.rb', 'dir/b.rb'].pathmap("%{.*,*}n") do |name|
|
10
|
+
name.upcase
|
11
|
+
end
|
12
|
+
assert_equal ['A', 'B'], mapped
|
13
|
+
end
|
7
14
|
end
|
8
15
|
|
@@ -142,6 +142,8 @@ class TestRakeFileUtils < Rake::TestCase
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def test_sh_with_multiple_arguments
|
145
|
+
skip if jruby9? # https://github.com/jruby/jruby/issues/3653
|
146
|
+
|
145
147
|
check_no_expansion
|
146
148
|
ENV['RAKE_TEST_SH'] = 'someval'
|
147
149
|
|
@@ -240,6 +242,8 @@ class TestRakeFileUtils < Rake::TestCase
|
|
240
242
|
end
|
241
243
|
|
242
244
|
def test_ruby_with_multiple_arguments
|
245
|
+
skip if jruby9? # https://github.com/jruby/jruby/issues/3653
|
246
|
+
|
243
247
|
check_no_expansion
|
244
248
|
|
245
249
|
ENV['RAKE_TEST_SH'] = 'someval'
|
@@ -425,6 +425,8 @@ class TestRakeFunctional < Rake::TestCase
|
|
425
425
|
end
|
426
426
|
|
427
427
|
def test_file_list_is_requirable_separately
|
428
|
+
skip if jruby9? # https://github.com/jruby/jruby/issues/3655
|
429
|
+
|
428
430
|
ruby '-rrake/file_list', '-e', 'puts Rake::FileList["a"].size'
|
429
431
|
assert_equal "1\n", @out
|
430
432
|
end
|
@@ -443,7 +445,7 @@ class TestRakeFunctional < Rake::TestCase
|
|
443
445
|
end
|
444
446
|
|
445
447
|
def test_signal_propagation_in_tests
|
446
|
-
if can_detect_signals?
|
448
|
+
if !jruby? && can_detect_signals?
|
447
449
|
rakefile_test_signal
|
448
450
|
rake
|
449
451
|
assert_match(/ATEST/, @out)
|
@@ -476,7 +478,7 @@ class TestRakeFunctional < Rake::TestCase
|
|
476
478
|
# predicate function can be used to skip tests or assertions as
|
477
479
|
# needed.
|
478
480
|
def uncertain_exit_status?
|
479
|
-
|
481
|
+
defined?(JRUBY_VERSION)
|
480
482
|
end
|
481
483
|
|
482
484
|
end
|
data/test/test_rake_task.rb
CHANGED
@@ -94,6 +94,13 @@ class TestRakeTask < Rake::TestCase
|
|
94
94
|
assert_equal ["t3", "t2", "t1"], runlist
|
95
95
|
end
|
96
96
|
|
97
|
+
def test_already_invoked
|
98
|
+
t1 = task(:t1) {}
|
99
|
+
assert_equal false, t1.already_invoked
|
100
|
+
t1.invoke
|
101
|
+
assert_equal true, t1.already_invoked
|
102
|
+
end
|
103
|
+
|
97
104
|
def test_can_double_invoke_with_reenable
|
98
105
|
runlist = []
|
99
106
|
t1 = task(:t1) { |t| runlist << t.name }
|
@@ -211,6 +218,7 @@ class TestRakeTask < Rake::TestCase
|
|
211
218
|
end
|
212
219
|
|
213
220
|
def test_prerequisite_tasks_honors_namespaces
|
221
|
+
task :b
|
214
222
|
a = b = nil
|
215
223
|
namespace "X" do
|
216
224
|
a = task :a => ["b", "c"]
|
@@ -221,6 +229,35 @@ class TestRakeTask < Rake::TestCase
|
|
221
229
|
assert_equal [b, c], a.prerequisite_tasks
|
222
230
|
end
|
223
231
|
|
232
|
+
def test_prerequisite_tasks_finds_tasks_with_same_name_outside_namespace
|
233
|
+
b1 = nil
|
234
|
+
namespace "a" do
|
235
|
+
b1 = task :b => "b"
|
236
|
+
end
|
237
|
+
b2 = task :b
|
238
|
+
|
239
|
+
assert_equal [b2], b1.prerequisite_tasks
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_prerequisite_tasks_in_nested_namespaces
|
243
|
+
m = task :m
|
244
|
+
a_c_m = a_b_m = a_m = nil
|
245
|
+
namespace "a" do
|
246
|
+
a_m = task :m
|
247
|
+
|
248
|
+
namespace "b" do
|
249
|
+
a_b_m = task :m => "m"
|
250
|
+
end
|
251
|
+
|
252
|
+
namespace "c" do
|
253
|
+
a_c_m = task :m => "a:m"
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
assert_equal [m], a_b_m.prerequisite_tasks
|
258
|
+
assert_equal [a_m], a_c_m.prerequisite_tasks
|
259
|
+
end
|
260
|
+
|
224
261
|
def test_all_prerequisite_tasks_includes_all_prerequisites
|
225
262
|
a = task :a => "b"
|
226
263
|
b = task :b => ["c", "d"]
|