rake 11.1.2 → 11.2.0

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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +14 -0
  3. data/.rubocop.yml +0 -9
  4. data/.travis.yml +28 -0
  5. data/CONTRIBUTING.rdoc +3 -5
  6. data/Gemfile +3 -0
  7. data/History.rdoc +1770 -273
  8. data/Rakefile +15 -68
  9. data/appveyor.yml +24 -0
  10. data/bin/console +7 -0
  11. data/bin/setup +6 -0
  12. data/doc/release_notes/README.md +4 -0
  13. data/doc/release_notes/rake-0.7.3.rdoc +0 -0
  14. data/{bin → exe}/rake +0 -6
  15. data/lib/rake.rb +1 -3
  16. data/lib/rake/application.rb +3 -6
  17. data/lib/rake/cpu_counter.rb +3 -17
  18. data/lib/rake/file_utils.rb +22 -6
  19. data/lib/rake/packagetask.rb +12 -1
  20. data/lib/rake/rake_test_loader.rb +0 -1
  21. data/lib/rake/rule_recursion_overflow_error.rb +0 -1
  22. data/lib/rake/task.rb +3 -3
  23. data/lib/rake/task_arguments.rb +2 -1
  24. data/lib/rake/testtask.rb +5 -1
  25. data/lib/rake/thread_pool.rb +0 -1
  26. data/lib/rake/version.rb +2 -0
  27. data/rake.gemspec +30 -0
  28. metadata +21 -110
  29. data/.autotest +0 -7
  30. data/.togglerc +0 -7
  31. data/Manifest.txt +0 -154
  32. data/lib/rake/contrib/.document +0 -1
  33. data/rakelib/test_times.rake +0 -25
  34. data/test/file_creation.rb +0 -34
  35. data/test/helper.rb +0 -134
  36. data/test/support/rakefile_definitions.rb +0 -476
  37. data/test/support/ruby_runner.rb +0 -34
  38. data/test/test_private_reader.rb +0 -42
  39. data/test/test_rake.rb +0 -40
  40. data/test/test_rake_application.rb +0 -659
  41. data/test/test_rake_application_options.rb +0 -468
  42. data/test/test_rake_backtrace.rb +0 -119
  43. data/test/test_rake_clean.rb +0 -61
  44. data/test/test_rake_cpu_counter.rb +0 -68
  45. data/test/test_rake_definitions.rb +0 -84
  46. data/test/test_rake_directory_task.rb +0 -76
  47. data/test/test_rake_dsl.rb +0 -40
  48. data/test/test_rake_early_time.rb +0 -31
  49. data/test/test_rake_extension.rb +0 -59
  50. data/test/test_rake_file_creation_task.rb +0 -56
  51. data/test/test_rake_file_list.rb +0 -687
  52. data/test/test_rake_file_list_path_map.rb +0 -15
  53. data/test/test_rake_file_task.rb +0 -197
  54. data/test/test_rake_file_utils.rb +0 -318
  55. data/test/test_rake_ftp_file.rb +0 -74
  56. data/test/test_rake_functional.rb +0 -484
  57. data/test/test_rake_invocation_chain.rb +0 -64
  58. data/test/test_rake_late_time.rb +0 -18
  59. data/test/test_rake_linked_list.rb +0 -84
  60. data/test/test_rake_makefile_loader.rb +0 -46
  61. data/test/test_rake_multi_task.rb +0 -64
  62. data/test/test_rake_name_space.rb +0 -57
  63. data/test/test_rake_package_task.rb +0 -79
  64. data/test/test_rake_path_map.rb +0 -168
  65. data/test/test_rake_path_map_explode.rb +0 -34
  66. data/test/test_rake_path_map_partial.rb +0 -18
  67. data/test/test_rake_pathname_extensions.rb +0 -15
  68. data/test/test_rake_pseudo_status.rb +0 -21
  69. data/test/test_rake_rake_test_loader.rb +0 -20
  70. data/test/test_rake_reduce_compat.rb +0 -26
  71. data/test/test_rake_require.rb +0 -40
  72. data/test/test_rake_rules.rb +0 -388
  73. data/test/test_rake_scope.rb +0 -44
  74. data/test/test_rake_task.rb +0 -430
  75. data/test/test_rake_task_argument_parsing.rb +0 -119
  76. data/test/test_rake_task_arguments.rb +0 -134
  77. data/test/test_rake_task_manager.rb +0 -178
  78. data/test/test_rake_task_manager_argument_resolution.rb +0 -19
  79. data/test/test_rake_task_with_arguments.rb +0 -172
  80. data/test/test_rake_test_task.rb +0 -130
  81. data/test/test_rake_thread_pool.rb +0 -145
  82. data/test/test_rake_top_level_functions.rb +0 -71
  83. data/test/test_rake_win32.rb +0 -72
  84. data/test/test_thread_history_display.rb +0 -101
  85. data/test/test_trace_output.rb +0 -52
@@ -1,119 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakeTaskArgumentParsing < Rake::TestCase
4
- def setup
5
- super
6
-
7
- @app = Rake::Application.new
8
- end
9
-
10
- def test_name_only
11
- name, args = @app.parse_task_string("name")
12
- assert_equal "name", name
13
- assert_equal [], args
14
- end
15
-
16
- def test_empty_args
17
- name, args = @app.parse_task_string("name[]")
18
- assert_equal "name", name
19
- assert_equal [], args
20
- end
21
-
22
- def test_one_argument
23
- name, args = @app.parse_task_string("name[one]")
24
- assert_equal "name", name
25
- assert_equal ["one"], args
26
- end
27
-
28
- def test_two_arguments
29
- name, args = @app.parse_task_string("name[one,two]")
30
- assert_equal "name", name
31
- assert_equal ["one", "two"], args
32
- end
33
-
34
- def test_can_handle_spaces_between_args
35
- name, args = @app.parse_task_string("name[one, two,\tthree , \tfour]")
36
- assert_equal "name", name
37
- assert_equal ["one", "two", "three", "four"], args
38
- end
39
-
40
- def test_keeps_embedded_spaces
41
- name, args = @app.parse_task_string("name[a one ana, two]")
42
- assert_equal "name", name
43
- assert_equal ["a one ana", "two"], args
44
- end
45
-
46
- def test_can_handle_commas_in_args
47
- name, args = @app.parse_task_string("name[one, two, three_a\\, three_b, four]")
48
- assert_equal "name", name
49
- assert_equal ["one", "two", "three_a, three_b", "four"], args
50
- end
51
-
52
- def test_treat_blank_arg_as_empty_string
53
- name, args = @app.parse_task_string("name[one,]")
54
- assert_equal "name", name
55
- assert_equal ["one", ""], args
56
-
57
- name, args = @app.parse_task_string("name[one,,two]")
58
- assert_equal "name", name
59
- assert_equal ["one", "", "two"], args
60
- end
61
-
62
- def test_terminal_width_using_env
63
- app = Rake::Application.new
64
- app.terminal_columns = 1234
65
-
66
- assert_equal 1234, app.terminal_width
67
- end
68
-
69
- def test_terminal_width_using_stty
70
- def @app.unix?() true end
71
- def @app.dynamic_width_stty() 1235 end
72
- def @app.dynamic_width_tput() 0 end
73
-
74
- assert_equal 1235, @app.terminal_width
75
- end
76
-
77
- def test_terminal_width_using_tput
78
- def @app.unix?() true end
79
- def @app.dynamic_width_stty() 0 end
80
- def @app.dynamic_width_tput() 1236 end
81
-
82
- assert_equal 1236, @app.terminal_width
83
- end
84
-
85
- def test_terminal_width_using_hardcoded_80
86
- def @app.unix?() false end
87
-
88
- assert_equal 80, @app.terminal_width
89
- end
90
-
91
- def test_terminal_width_with_failure
92
- def @app.unix?() raise end
93
-
94
- assert_equal 80, @app.terminal_width
95
- end
96
-
97
- def test_no_rakeopt
98
- ARGV << '--trace'
99
- app = Rake::Application.new
100
- app.init
101
- assert !app.options.silent
102
- end
103
-
104
- def test_rakeopt_with_blank_options
105
- ARGV << '--trace'
106
- app = Rake::Application.new
107
- app.init
108
- assert !app.options.silent
109
- end
110
-
111
- def test_rakeopt_with_silent_options
112
- ENV['RAKEOPT'] = '-s'
113
- app = Rake::Application.new
114
-
115
- app.init
116
-
117
- assert app.options.silent
118
- end
119
- end
@@ -1,134 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- ######################################################################
4
- class TestRakeTaskArguments < Rake::TestCase
5
- def teardown
6
- ENV.delete('rev')
7
- ENV.delete('VER')
8
-
9
- super
10
- end
11
-
12
- def test_empty_arg_list_is_empty
13
- ta = Rake::TaskArguments.new([], [])
14
- assert_equal({}, ta.to_hash)
15
- end
16
-
17
- def test_multiple_values_in_args
18
- ta = Rake::TaskArguments.new([:a, :b, :c], [:one, :two, :three])
19
- assert_equal({:a => :one, :b => :two, :c => :three}, ta.to_hash)
20
- end
21
-
22
- def test_has_key
23
- ta = Rake::TaskArguments.new([:a], [:one])
24
- assert(ta.has_key?(:a))
25
- refute(ta.has_key?(:b))
26
- end
27
-
28
- def test_fetch
29
- ta = Rake::TaskArguments.new([:one], [1])
30
- assert_equal 1, ta.fetch(:one)
31
- assert_equal 2, ta.fetch(:two) { 2 }
32
- assert_raises(KeyError) { ta.fetch(:three) }
33
- end
34
-
35
- def test_to_s
36
- ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
37
- assert_equal ta.to_hash.inspect, ta.to_s
38
- assert_equal ta.to_hash.inspect, ta.inspect
39
- end
40
-
41
- def test_enumerable_behavior
42
- ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
43
- assert_equal [10, 20, 30], ta.map { |k, v| v * 10 }.sort
44
- end
45
-
46
- def test_named_args
47
- ta = Rake::TaskArguments.new(["aa", "bb"], [1, 2])
48
- assert_equal 1, ta.aa
49
- assert_equal 1, ta[:aa]
50
- assert_equal 1, ta["aa"]
51
- assert_equal 2, ta.bb
52
- assert_nil ta.cc
53
- end
54
-
55
- def test_args_knows_its_names
56
- ta = Rake::TaskArguments.new(["aa", "bb"], [1, 2])
57
- assert_equal ["aa", "bb"], ta.names
58
- end
59
-
60
- def test_extra_names_are_nil
61
- ta = Rake::TaskArguments.new(["aa", "bb", "cc"], [1, 2])
62
- assert_nil ta.cc
63
- end
64
-
65
- def test_args_do_not_reference_env_values
66
- ta = Rake::TaskArguments.new(["aa"], [1])
67
- ENV['rev'] = "1.2"
68
- ENV['VER'] = "2.3"
69
- assert_nil ta.rev
70
- assert_nil ta.ver
71
- end
72
-
73
- def test_creating_new_argument_scopes
74
- parent = Rake::TaskArguments.new(['p'], [1])
75
- child = parent.new_scope(['c', 'p'])
76
- assert_equal({:p=>1}, child.to_hash)
77
- assert_equal 1, child.p
78
- assert_equal 1, child["p"]
79
- assert_equal 1, child[:p]
80
- assert_nil child.c
81
- end
82
-
83
- def test_child_hides_parent_arg_names
84
- parent = Rake::TaskArguments.new(['aa'], [1])
85
- child = Rake::TaskArguments.new(['aa'], [2], parent)
86
- assert_equal 2, child.aa
87
- end
88
-
89
- def test_default_arguments_values_can_be_merged
90
- ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
91
- ta.with_defaults({ :aa => 'default_val' })
92
- assert_equal 'default_val', ta[:aa]
93
- assert_equal 'original_val', ta[:bb]
94
- end
95
-
96
- def test_default_arguments_that_dont_match_names_are_ignored
97
- ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
98
- ta.with_defaults({ "cc" => "default_val" })
99
- assert_nil ta[:cc]
100
- end
101
-
102
- def test_all_and_extra_arguments_without_named_arguments
103
- app = Rake::Application.new
104
- _, args = app.parse_task_string("task[1,two,more]")
105
- ta = Rake::TaskArguments.new([], args)
106
- assert_equal [], ta.names
107
- assert_equal ['1', 'two', 'more'], ta.to_a
108
- assert_equal ['1', 'two', 'more'], ta.extras
109
- end
110
-
111
- def test_all_and_extra_arguments_with_named_arguments
112
- app = Rake::Application.new
113
- _, args = app.parse_task_string("task[1,two,more,still more]")
114
- ta = Rake::TaskArguments.new([:first, :second], args)
115
- assert_equal [:first, :second], ta.names
116
- assert_equal "1", ta[:first]
117
- assert_equal "two", ta[:second]
118
- assert_equal ['1', 'two', 'more', 'still more'], ta.to_a
119
- assert_equal ['more', 'still more'], ta.extras
120
- end
121
-
122
- def test_extra_args_with_less_than_named_arguments
123
- app = Rake::Application.new
124
- _, args = app.parse_task_string("task[1,two]")
125
- ta = Rake::TaskArguments.new([:first, :second, :third], args)
126
- assert_equal [:first, :second, :third], ta.names
127
- assert_equal "1", ta[:first]
128
- assert_equal "two", ta[:second]
129
- assert_equal nil, ta[:third]
130
- assert_equal ['1', 'two'], ta.to_a
131
- assert_equal [], ta.extras
132
- end
133
-
134
- end
@@ -1,178 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakeTaskManager < Rake::TestCase
4
-
5
- def setup
6
- super
7
-
8
- @tm = Rake::TestCase::TaskManager.new
9
- end
10
-
11
- def test_create_task_manager
12
- refute_nil @tm
13
- assert_equal [], @tm.tasks
14
- end
15
-
16
- def test_define_task
17
- t = @tm.define_task(Rake::Task, :t)
18
- assert_equal "t", t.name
19
- assert_equal @tm, t.application
20
- end
21
-
22
- def test_index
23
- e = assert_raises RuntimeError do
24
- @tm['bad']
25
- end
26
-
27
- assert_equal "Don't know how to build task 'bad' (see --tasks)", e.message
28
- end
29
-
30
- def test_name_lookup
31
- t = @tm.define_task(Rake::Task, :t)
32
- assert_equal t, @tm[:t]
33
- end
34
-
35
- def test_namespace_task_create
36
- @tm.in_namespace("x") do
37
- t = @tm.define_task(Rake::Task, :t)
38
- assert_equal "x:t", t.name
39
- end
40
- assert_equal ["x:t"], @tm.tasks.map { |t| t.name }
41
- end
42
-
43
- def test_define_namespaced_task
44
- t = @tm.define_task(Rake::Task, 'n:a:m:e:t')
45
- assert_equal Rake::Scope.make("e", "m", "a", "n"), t.scope
46
- assert_equal "n:a:m:e:t", t.name
47
- assert_equal @tm, t.application
48
- end
49
-
50
- def test_define_namespace_in_namespace
51
- t = nil
52
- @tm.in_namespace("n") do
53
- t = @tm.define_task(Rake::Task, 'a:m:e:t')
54
- end
55
- assert_equal Rake::Scope.make("e", "m", "a", "n"), t.scope
56
- assert_equal "n:a:m:e:t", t.name
57
- assert_equal @tm, t.application
58
- end
59
-
60
- def test_anonymous_namespace
61
- anon_ns = @tm.in_namespace(nil) do
62
- t = @tm.define_task(Rake::Task, :t)
63
- assert_equal "_anon_1:t", t.name
64
- end
65
- task = anon_ns[:t]
66
- assert_equal "_anon_1:t", task.name
67
- end
68
-
69
- def test_create_filetask_in_namespace
70
- @tm.in_namespace("x") do
71
- t = @tm.define_task(Rake::FileTask, "fn")
72
- assert_equal "fn", t.name
73
- end
74
-
75
- assert_equal ["fn"], @tm.tasks.map { |t| t.name }
76
- end
77
-
78
- def test_namespace_yields_same_namespace_as_returned
79
- yielded_namespace = nil
80
- returned_namespace = @tm.in_namespace("x") do |ns|
81
- yielded_namespace = ns
82
- end
83
- assert_equal returned_namespace, yielded_namespace
84
- end
85
-
86
- def test_name_lookup_with_implicit_file_tasks
87
- FileUtils.touch 'README.rdoc'
88
-
89
- t = @tm["README.rdoc"]
90
-
91
- assert_equal "README.rdoc", t.name
92
- assert Rake::FileTask === t
93
- end
94
-
95
- def test_name_lookup_with_nonexistent_task
96
- assert_raises(RuntimeError) {
97
- @tm["DOES NOT EXIST"]
98
- }
99
- end
100
-
101
- def test_name_lookup_in_multiple_scopes
102
- aa = nil
103
- bb = nil
104
- xx = @tm.define_task(Rake::Task, :xx)
105
- top_z = @tm.define_task(Rake::Task, :z)
106
- @tm.in_namespace("a") do
107
- aa = @tm.define_task(Rake::Task, :aa)
108
- mid_z = @tm.define_task(Rake::Task, :z)
109
- ns_d = @tm.define_task(Rake::Task, "n:t")
110
- @tm.in_namespace("b") do
111
- bb = @tm.define_task(Rake::Task, :bb)
112
- bot_z = @tm.define_task(Rake::Task, :z)
113
-
114
- assert_equal Rake::Scope.make("b", "a"), @tm.current_scope
115
-
116
- assert_equal bb, @tm["a:b:bb"]
117
- assert_equal aa, @tm["a:aa"]
118
- assert_equal xx, @tm["xx"]
119
- assert_equal bot_z, @tm["z"]
120
- assert_equal mid_z, @tm["^z"]
121
- assert_equal top_z, @tm["^^z"]
122
- assert_equal top_z, @tm["^^^z"] # Over the top
123
- assert_equal top_z, @tm["rake:z"]
124
- end
125
-
126
- assert_equal Rake::Scope.make("a"), @tm.current_scope
127
-
128
- assert_equal bb, @tm["a:b:bb"]
129
- assert_equal aa, @tm["a:aa"]
130
- assert_equal xx, @tm["xx"]
131
- assert_equal bb, @tm["b:bb"]
132
- assert_equal aa, @tm["aa"]
133
- assert_equal mid_z, @tm["z"]
134
- assert_equal top_z, @tm["^z"]
135
- assert_equal top_z, @tm["^^z"] # Over the top
136
- assert_equal top_z, @tm["rake:z"]
137
- assert_equal ns_d, @tm["n:t"]
138
- assert_equal ns_d, @tm["a:n:t"]
139
- end
140
-
141
- assert_equal Rake::Scope.make, @tm.current_scope
142
-
143
- assert_equal Rake::Scope.make, xx.scope
144
- assert_equal Rake::Scope.make('a'), aa.scope
145
- assert_equal Rake::Scope.make('b', 'a'), bb.scope
146
- end
147
-
148
- def test_lookup_with_explicit_scopes
149
- t1, t2, t3, s = (0...4).map { nil }
150
- t1 = @tm.define_task(Rake::Task, :t)
151
- @tm.in_namespace("a") do
152
- t2 = @tm.define_task(Rake::Task, :t)
153
- s = @tm.define_task(Rake::Task, :s)
154
- @tm.in_namespace("b") do
155
- t3 = @tm.define_task(Rake::Task, :t)
156
- end
157
- end
158
- assert_equal t1, @tm[:t, Rake::Scope.make]
159
- assert_equal t2, @tm[:t, Rake::Scope.make("a")]
160
- assert_equal t3, @tm[:t, Rake::Scope.make("b", "a")]
161
- assert_equal s, @tm[:s, Rake::Scope.make("b", "a")]
162
- assert_equal s, @tm[:s, Rake::Scope.make("a")]
163
- end
164
-
165
- def test_correctly_scoped_prerequisites_are_invoked
166
- values = []
167
- @tm = Rake::Application.new
168
- @tm.define_task(Rake::Task, :z) do values << "top z" end
169
- @tm.in_namespace("a") do
170
- @tm.define_task(Rake::Task, :z) do values << "next z" end
171
- @tm.define_task(Rake::Task, :x => :z)
172
- end
173
-
174
- @tm["a:x"].invoke
175
- assert_equal ["next z"], values
176
- end
177
-
178
- end
@@ -1,19 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakeTaskManagerArgumentResolution < Rake::TestCase
4
-
5
- def test_good_arg_patterns
6
- assert_equal [:t, [], []], task(:t)
7
- assert_equal [:t, [], [:x]], task(:t => :x)
8
- assert_equal [:t, [], [:x, :y]], task(:t => [:x, :y])
9
-
10
- assert_equal [:t, [:a, :b], []], task(:t, [:a, :b])
11
- assert_equal [:t, [:a, :b], [:x]], task(:t, [:a, :b] => :x)
12
- assert_equal [:t, [:a, :b], [:x, :y]], task(:t, [:a, :b] => [:x, :y])
13
- end
14
-
15
- def task(*args)
16
- tm = Rake::TestCase::TaskManager.new
17
- tm.resolve_args(args)
18
- end
19
- end