rake 10.0.4 → 10.1.0.beta.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.

Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/doc/rakefile.rdoc +19 -0
  3. data/lib/rake/alt_system.rb +3 -4
  4. data/lib/rake/application.rb +114 -67
  5. data/lib/rake/backtrace.rb +9 -8
  6. data/lib/rake/contrib/ftptools.rb +6 -18
  7. data/lib/rake/contrib/sys.rb +2 -1
  8. data/lib/rake/dsl_definition.rb +1 -1
  9. data/lib/rake/ext/core.rb +2 -1
  10. data/lib/rake/ext/string.rb +1 -3
  11. data/lib/rake/file_list.rb +14 -14
  12. data/lib/rake/file_task.rb +1 -2
  13. data/lib/rake/file_utils.rb +9 -7
  14. data/lib/rake/file_utils_ext.rb +2 -1
  15. data/lib/rake/gempackagetask.rb +2 -1
  16. data/lib/rake/invocation_chain.rb +2 -0
  17. data/lib/rake/packagetask.rb +11 -6
  18. data/lib/rake/pseudo_status.rb +5 -0
  19. data/lib/rake/rdoctask.rb +2 -1
  20. data/lib/rake/ruby182_test_unit_fix.rb +4 -2
  21. data/lib/rake/runtest.rb +2 -2
  22. data/lib/rake/task.rb +9 -10
  23. data/lib/rake/task_arguments.rb +13 -2
  24. data/lib/rake/task_manager.rb +9 -8
  25. data/lib/rake/tasklib.rb +1 -1
  26. data/lib/rake/testtask.rb +10 -7
  27. data/lib/rake/thread_history_display.rb +1 -1
  28. data/lib/rake/thread_pool.rb +10 -4
  29. data/lib/rake/version.rb +3 -7
  30. data/lib/rake/win32.rb +3 -2
  31. data/test/helper.rb +28 -28
  32. data/test/test_rake_application.rb +14 -12
  33. data/test/test_rake_application_options.rb +7 -5
  34. data/test/test_rake_backtrace.rb +30 -1
  35. data/test/test_rake_definitions.rb +2 -3
  36. data/test/test_rake_file_creation_task.rb +2 -2
  37. data/test/test_rake_file_list.rb +9 -10
  38. data/test/test_rake_file_task.rb +4 -4
  39. data/test/test_rake_file_utils.rb +6 -2
  40. data/test/test_rake_ftp_file.rb +28 -13
  41. data/test/test_rake_functional.rb +4 -2
  42. data/test/test_rake_makefile_loader.rb +3 -1
  43. data/test/test_rake_multi_task.rb +2 -3
  44. data/test/test_rake_name_space.rb +1 -1
  45. data/test/test_rake_path_map.rb +23 -12
  46. data/test/test_rake_rake_test_loader.rb +2 -3
  47. data/test/test_rake_rules.rb +11 -12
  48. data/test/test_rake_task.rb +7 -7
  49. data/test/test_rake_task_arguments.rb +35 -2
  50. data/test/test_rake_task_manager.rb +3 -4
  51. data/test/test_rake_task_with_arguments.rb +2 -2
  52. data/test/test_rake_test_task.rb +1 -2
  53. data/test/test_rake_thread_pool.rb +36 -16
  54. data/test/test_thread_history_display.rb +16 -6
  55. data/test/test_trace_output.rb +2 -0
  56. metadata +2 -2
@@ -26,8 +26,8 @@ class TestRakeTaskArguments < Rake::TestCase
26
26
  end
27
27
 
28
28
  def test_enumerable_behavior
29
- ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2 ,3])
30
- assert_equal [10, 20, 30], ta.collect { |k,v| v * 10 }.sort
29
+ ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
30
+ assert_equal [10, 20, 30], ta.map { |k, v| v * 10 }.sort
31
31
  end
32
32
 
33
33
  def test_named_args
@@ -85,4 +85,37 @@ class TestRakeTaskArguments < Rake::TestCase
85
85
  ta.with_defaults({ "cc" => "default_val" })
86
86
  assert_nil ta[:cc]
87
87
  end
88
+
89
+ def test_all_and_extra_arguments_without_named_arguments
90
+ app = Rake::Application.new
91
+ _, args = app.parse_task_string("task[1,two,more]")
92
+ ta = Rake::TaskArguments.new([], args)
93
+ assert_equal [], ta.names
94
+ assert_equal ['1', 'two', 'more'], ta.to_a
95
+ assert_equal ['1', 'two', 'more'], ta.extras
96
+ end
97
+
98
+ def test_all_and_extra_arguments_with_named_arguments
99
+ app = Rake::Application.new
100
+ _, args = app.parse_task_string("task[1,two,more,still more]")
101
+ ta = Rake::TaskArguments.new([:first, :second], args)
102
+ assert_equal [:first, :second], ta.names
103
+ assert_equal "1", ta[:first]
104
+ assert_equal "two", ta[:second]
105
+ assert_equal ['1', 'two', 'more', 'still more'], ta.to_a
106
+ assert_equal ['more', 'still more'], ta.extras
107
+ end
108
+
109
+ def test_extra_args_with_less_than_named_arguments
110
+ app = Rake::Application.new
111
+ _, args = app.parse_task_string("task[1,two]")
112
+ ta = Rake::TaskArguments.new([:first, :second, :third], args)
113
+ assert_equal [:first, :second, :third], ta.names
114
+ assert_equal "1", ta[:first]
115
+ assert_equal "two", ta[:second]
116
+ assert_equal nil, ta[:third]
117
+ assert_equal ['1', 'two'], ta.to_a
118
+ assert_equal [], ta.extras
119
+ end
120
+
88
121
  end
@@ -37,7 +37,7 @@ class TestRakeTaskManager < Rake::TestCase
37
37
  t = @tm.define_task(Rake::Task, :t)
38
38
  assert_equal "x:t", t.name
39
39
  end
40
- assert_equal ["x:t"], @tm.tasks.collect { |t| t.name }
40
+ assert_equal ["x:t"], @tm.tasks.map { |t| t.name }
41
41
  end
42
42
 
43
43
  def test_anonymous_namespace
@@ -55,7 +55,7 @@ class TestRakeTaskManager < Rake::TestCase
55
55
  assert_equal "fn", t.name
56
56
  end
57
57
 
58
- assert_equal ["fn"], @tm.tasks.collect { |t| t.name }
58
+ assert_equal ["fn"], @tm.tasks.map { |t| t.name }
59
59
  end
60
60
 
61
61
  def test_namespace_yields_same_namespace_as_returned
@@ -124,7 +124,7 @@ class TestRakeTaskManager < Rake::TestCase
124
124
  end
125
125
 
126
126
  def test_lookup_with_explicit_scopes
127
- t1, t2, t3, s = (0...4).collect { nil }
127
+ t1, t2, t3, s = (0...4).map { nil }
128
128
  t1 = @tm.define_task(Rake::Task, :t)
129
129
  @tm.in_namespace("a") do
130
130
  t2 = @tm.define_task(Rake::Task, :t)
@@ -154,4 +154,3 @@ class TestRakeTaskManager < Rake::TestCase
154
154
  end
155
155
 
156
156
  end
157
-
@@ -81,7 +81,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
81
81
 
82
82
  def test_arguments_are_passed_to_block
83
83
  t = task(:t, :a, :b) { |tt, args|
84
- assert_equal( { :a => 1, :b => 2 }, args.to_hash )
84
+ assert_equal({ :a => 1, :b => 2 }, args.to_hash)
85
85
  }
86
86
  t.invoke(1, 2)
87
87
  end
@@ -121,7 +121,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
121
121
  assert_equal "T", t.comment
122
122
  assert_equal "[a,b]", t.arg_description
123
123
  assert_equal "tt[a,b]", t.name_with_args
124
- assert_equal [:a, :b],t.arg_names
124
+ assert_equal [:a, :b], t.arg_names
125
125
  end
126
126
 
127
127
  def test_named_args_are_passed_to_prereqs
@@ -28,7 +28,7 @@ class TestRakeTestTask < Rake::TestCase
28
28
  assert Task.task_defined?(:example)
29
29
  end
30
30
 
31
- def test_file_list_ENV_TEST
31
+ def test_file_list_env_test
32
32
  ENV['TEST'] = 'testfile.rb'
33
33
  tt = Rake::TestTask.new do |t|
34
34
  t.pattern = '*'
@@ -117,4 +117,3 @@ class TestRakeTestTask < Rake::TestCase
117
117
  end
118
118
 
119
119
  end
120
-
@@ -7,21 +7,28 @@ class TestRakeTestThreadPool < Rake::TestCase
7
7
 
8
8
  def test_pool_executes_in_current_thread_for_zero_threads
9
9
  pool = ThreadPool.new(0)
10
- f = pool.future{Thread.current}
10
+ f = pool.future { Thread.current }
11
11
  pool.join
12
12
  assert_equal Thread.current, f.value
13
13
  end
14
14
 
15
15
  def test_pool_executes_in_other_thread_for_pool_of_size_one
16
16
  pool = ThreadPool.new(1)
17
- f = pool.future{Thread.current}
17
+ f = pool.future { Thread.current }
18
18
  pool.join
19
19
  refute_equal Thread.current, f.value
20
20
  end
21
21
 
22
22
  def test_pool_executes_in_two_other_threads_for_pool_of_size_two
23
23
  pool = ThreadPool.new(2)
24
- threads = 2.times.collect{ pool.future{ sleep 0.1; Thread.current } }.each{|f|f.value}
24
+ threads = 2.times.map {
25
+ pool.future {
26
+ sleep 0.1
27
+ Thread.current
28
+ }
29
+ }.each { |f|
30
+ f.value
31
+ }
25
32
 
26
33
  refute_equal threads[0], threads[1]
27
34
  refute_equal Thread.current, threads[0]
@@ -35,14 +42,14 @@ class TestRakeTestThreadPool < Rake::TestCase
35
42
  10.times.each do
36
43
  pool.future do
37
44
  sleep 0.02
38
- t_mutex.synchronize{ threads << Thread.current }
45
+ t_mutex.synchronize { threads << Thread.current }
39
46
  end
40
47
  end
41
48
  pool.join
42
49
  assert_equal 2, threads.count
43
50
  end
44
51
 
45
- def test_pool_future_does_NOT_duplicate_arguments
52
+ def test_pool_future_does_not_duplicate_arguments
46
53
  pool = ThreadPool.new(2)
47
54
  obj = Object.new
48
55
  captured = nil
@@ -67,7 +74,10 @@ class TestRakeTestThreadPool < Rake::TestCase
67
74
  }
68
75
 
69
76
  pool.join
70
- assert_equal true, pool.__send__(:__queue__).empty?, "queue should be empty"
77
+ assert_equal(
78
+ true,
79
+ pool.__send__(:__queue__).empty?,
80
+ "queue should be empty")
71
81
  end
72
82
 
73
83
  CustomError = Class.new(StandardError)
@@ -78,8 +88,8 @@ class TestRakeTestThreadPool < Rake::TestCase
78
88
  pool = ThreadPool.new(10)
79
89
 
80
90
  deep_exception_block = lambda do |count|
81
- raise CustomError if ( count < 1 )
82
- pool.future(count-1, &deep_exception_block).value
91
+ raise CustomError if count < 1
92
+ pool.future(count - 1, &deep_exception_block).value
83
93
  end
84
94
 
85
95
  assert_raises(CustomError) do
@@ -91,12 +101,22 @@ class TestRakeTestThreadPool < Rake::TestCase
91
101
  pool = ThreadPool.new(5)
92
102
 
93
103
  common_dependency_a = pool.future { sleep 0.2 }
94
- futures_a = 10.times.collect { pool.future{ common_dependency_a.value; sleep(rand() * 0.01) } }
104
+ futures_a = 10.times.map {
105
+ pool.future {
106
+ common_dependency_a.value
107
+ sleep(rand() * 0.01)
108
+ }
109
+ }
95
110
 
96
111
  common_dependency_b = pool.future { futures_a.each { |f| f.value } }
97
- futures_b = 10.times.collect { pool.future{ common_dependency_b.value; sleep(rand() * 0.01) } }
112
+ futures_b = 10.times.map {
113
+ pool.future {
114
+ common_dependency_b.value
115
+ sleep(rand() * 0.01)
116
+ }
117
+ }
98
118
 
99
- futures_b.each{|f|f.value}
119
+ futures_b.each { |f| f.value }
100
120
  pool.join
101
121
  end
102
122
 
@@ -107,15 +127,15 @@ class TestRakeTestThreadPool < Rake::TestCase
107
127
  b = 5
108
128
  c = 3
109
129
 
110
- result = a.times.collect do
130
+ result = a.times.map do
111
131
  pool.future do
112
- b.times.collect do
132
+ b.times.map do
113
133
  pool.future { sleep rand * 0.001; c }
114
- end.inject(0) { |m,f| m+f.value }
134
+ end.reduce(0) { |m, f| m + f.value }
115
135
  end
116
- end.inject(0) { |m,f| m+f.value }
136
+ end.reduce(0) { |m, f| m + f.value }
117
137
 
118
- assert_equal( (a*b*c), result )
138
+ assert_equal a * b * c, result
119
139
  pool.join
120
140
  end
121
141
 
@@ -5,7 +5,7 @@ require 'rake/thread_history_display'
5
5
  class TestThreadHistoryDisplay < Rake::TestCase
6
6
  def setup
7
7
  super
8
- @time = 1000000
8
+ @time = 1_000_000
9
9
  @stats = []
10
10
  @display = Rake::ThreadHistoryDisplay.new(@stats)
11
11
  end
@@ -60,24 +60,34 @@ class TestThreadHistoryDisplay < Rake::TestCase
60
60
  end
61
61
 
62
62
  def test_thread_deleted
63
- @stats << event(:thread_deleted, :deleted_thread => 123456, :thread_count => 12)
63
+ @stats << event(
64
+ :thread_deleted,
65
+ :deleted_thread => 123_456,
66
+ :thread_count => 12)
64
67
  out, _ = capture_io do
65
68
  @display.show
66
69
  end
67
- assert_match(/^ *1000000 +A +thread_deleted( +deleted_thread:B| +thread_count:12){2}$/, out)
70
+ assert_match(
71
+ /^ *1000000 +A +thread_deleted( +deleted_thread:B| +thread_count:12){2}$/,
72
+ out)
68
73
  end
69
74
 
70
75
  def test_thread_created
71
- @stats << event(:thread_created, :new_thread => 123456, :thread_count => 13)
76
+ @stats << event(
77
+ :thread_created,
78
+ :new_thread => 123_456,
79
+ :thread_count => 13)
72
80
  out, _ = capture_io do
73
81
  @display.show
74
82
  end
75
- assert_match(/^ *1000000 +A +thread_created( +new_thread:B| +thread_count:13){2}$/, out)
83
+ assert_match(
84
+ /^ *1000000 +A +thread_created( +new_thread:B| +thread_count:13){2}$/,
85
+ out)
76
86
  end
77
87
 
78
88
  private
79
89
 
80
- def event(type, data={})
90
+ def event(type, data = {})
81
91
  result = {
82
92
  :event => type,
83
93
  :time => @time / 1_000_000.0,
@@ -6,10 +6,12 @@ class TestTraceOutput < Rake::TestCase
6
6
 
7
7
  class PrintSpy
8
8
  attr_reader :result, :calls
9
+
9
10
  def initialize
10
11
  @result = ""
11
12
  @calls = 0
12
13
  end
14
+
13
15
  def print(string)
14
16
  @result << string
15
17
  @calls += 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.4
4
+ version: 10.1.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-25 00:00:00.000000000 Z
11
+ date: 2013-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest