spline 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/bin/spline +11 -9
  3. data/lib/spline/version.rb +1 -1
  4. data/lib/spline.rb +1 -8
  5. data/vendor/bundle/ruby/2.1.0/bin/rake +23 -0
  6. data/vendor/bundle/ruby/2.1.0/bin/spline +23 -0
  7. data/vendor/bundle/ruby/2.1.0/build_info/rake-10.3.2.info +1 -0
  8. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.autotest +7 -0
  9. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.gemtest +0 -0
  10. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.rubocop.yml +27 -0
  11. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.togglerc +7 -0
  12. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/CONTRIBUTING.rdoc +34 -0
  13. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/History.rdoc +609 -0
  14. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/MIT-LICENSE +21 -0
  15. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Manifest.txt +162 -0
  16. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/README.rdoc +137 -0
  17. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Rakefile +81 -0
  18. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/bin/rake +33 -0
  19. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/alt_system.rb +110 -0
  20. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb +783 -0
  21. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/backtrace.rb +23 -0
  22. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/clean.rb +76 -0
  23. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cloneable.rb +16 -0
  24. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/.document +0 -0
  25. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/compositepublisher.rb +21 -0
  26. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/ftptools.rb +137 -0
  27. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/publisher.rb +81 -0
  28. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  29. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sshpublisher.rb +61 -0
  30. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sys.rb +4 -0
  31. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cpu_counter.rb +109 -0
  32. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/default_loader.rb +14 -0
  33. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/dsl_definition.rb +198 -0
  34. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/early_time.rb +21 -0
  35. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/core.rb +25 -0
  36. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/module.rb +1 -0
  37. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/string.rb +173 -0
  38. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/time.rb +15 -0
  39. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_creation_task.rb +24 -0
  40. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_list.rb +414 -0
  41. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_task.rb +46 -0
  42. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb +116 -0
  43. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils_ext.rb +144 -0
  44. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/gempackagetask.rb +4 -0
  45. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_chain.rb +56 -0
  46. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_exception_mixin.rb +16 -0
  47. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/linked_list.rb +103 -0
  48. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/loaders/makefile.rb +40 -0
  49. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/multi_task.rb +13 -0
  50. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/name_space.rb +38 -0
  51. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/packagetask.rb +202 -0
  52. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pathmap.rb +3 -0
  53. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/phony.rb +15 -0
  54. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/private_reader.rb +20 -0
  55. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/promise.rb +99 -0
  56. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pseudo_status.rb +29 -0
  57. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb +38 -0
  58. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb +22 -0
  59. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rdoctask.rb +4 -0
  60. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ruby182_test_unit_fix.rb +29 -0
  61. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
  62. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/runtest.rb +27 -0
  63. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/scope.rb +42 -0
  64. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb +383 -0
  65. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_argument_error.rb +7 -0
  66. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_arguments.rb +98 -0
  67. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_manager.rb +310 -0
  68. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/tasklib.rb +24 -0
  69. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/testtask.rb +212 -0
  70. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_history_display.rb +48 -0
  71. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_pool.rb +164 -0
  72. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/trace_output.rb +22 -0
  73. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/version.rb +7 -0
  74. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/win32.rb +56 -0
  75. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake.rb +78 -0
  76. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/publish.rake +20 -0
  77. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/test_times.rake +25 -0
  78. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/file_creation.rb +34 -0
  79. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/helper.rb +127 -0
  80. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/rakefile_definitions.rb +478 -0
  81. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/ruby_runner.rb +33 -0
  82. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_private_reader.rb +42 -0
  83. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake.rb +40 -0
  84. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application.rb +641 -0
  85. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application_options.rb +466 -0
  86. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_backtrace.rb +119 -0
  87. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_clean.rb +55 -0
  88. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_cpu_counter.rb +50 -0
  89. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_definitions.rb +79 -0
  90. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_directory_task.rb +63 -0
  91. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_dsl.rb +40 -0
  92. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_early_time.rb +31 -0
  93. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_extension.rb +59 -0
  94. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_creation_task.rb +56 -0
  95. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list.rb +627 -0
  96. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list_path_map.rb +8 -0
  97. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_task.rb +186 -0
  98. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_utils.rb +309 -0
  99. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_ftp_file.rb +74 -0
  100. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_functional.rb +482 -0
  101. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_invocation_chain.rb +64 -0
  102. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_linked_list.rb +84 -0
  103. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_makefile_loader.rb +46 -0
  104. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_multi_task.rb +58 -0
  105. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_name_space.rb +57 -0
  106. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_package_task.rb +79 -0
  107. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map.rb +168 -0
  108. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_explode.rb +34 -0
  109. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_partial.rb +18 -0
  110. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_pseudo_status.rb +21 -0
  111. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rake_test_loader.rb +20 -0
  112. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_reduce_compat.rb +26 -0
  113. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_require.rb +40 -0
  114. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rules.rb +388 -0
  115. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_scope.rb +44 -0
  116. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task.rb +392 -0
  117. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_argument_parsing.rb +109 -0
  118. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_arguments.rb +127 -0
  119. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_lib.rb +9 -0
  120. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager.rb +178 -0
  121. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager_argument_resolution.rb +19 -0
  122. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_with_arguments.rb +171 -0
  123. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_test_task.rb +141 -0
  124. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_thread_pool.rb +142 -0
  125. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_top_level_functions.rb +71 -0
  126. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_win32.rb +72 -0
  127. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_thread_history_display.rb +101 -0
  128. data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_trace_output.rb +52 -0
  129. data/vendor/bundle/ruby/2.1.0/specifications/rake-10.3.2.gemspec +45 -0
  130. metadata +127 -2
@@ -0,0 +1,466 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+
3
+ TESTING_REQUIRE = []
4
+
5
+ class TestRakeApplicationOptions < Rake::TestCase
6
+
7
+ def setup
8
+ super
9
+
10
+ clear_argv
11
+ Rake::FileUtilsExt.verbose_flag = false
12
+ Rake::FileUtilsExt.nowrite_flag = false
13
+ TESTING_REQUIRE.clear
14
+ end
15
+
16
+ def teardown
17
+ clear_argv
18
+ Rake::FileUtilsExt.verbose_flag = false
19
+ Rake::FileUtilsExt.nowrite_flag = false
20
+
21
+ super
22
+ end
23
+
24
+ def clear_argv
25
+ ARGV.pop until ARGV.empty?
26
+ end
27
+
28
+ def test_default_options
29
+ opts = command_line
30
+ assert_nil opts.backtrace
31
+ assert_nil opts.dryrun
32
+ assert_nil opts.ignore_system
33
+ assert_nil opts.load_system
34
+ assert_nil opts.always_multitask
35
+ assert_nil opts.nosearch
36
+ assert_equal ['rakelib'], opts.rakelib
37
+ assert_nil opts.show_prereqs
38
+ assert_nil opts.show_task_pattern
39
+ assert_nil opts.show_tasks
40
+ assert_nil opts.silent
41
+ assert_nil opts.trace
42
+ assert_nil opts.thread_pool_size
43
+ assert_equal ['rakelib'], opts.rakelib
44
+ assert ! Rake::FileUtilsExt.verbose_flag
45
+ assert ! Rake::FileUtilsExt.nowrite_flag
46
+ end
47
+
48
+ def test_dry_run
49
+ flags('--dry-run', '-n') do |opts|
50
+ assert opts.dryrun
51
+ assert opts.trace
52
+ assert Rake::FileUtilsExt.verbose_flag
53
+ assert Rake::FileUtilsExt.nowrite_flag
54
+ end
55
+ end
56
+
57
+ def test_describe
58
+ flags('--describe') do |opts|
59
+ assert_equal :describe, opts.show_tasks
60
+ assert_equal(//.to_s, opts.show_task_pattern.to_s)
61
+ end
62
+ end
63
+
64
+ def test_describe_with_pattern
65
+ flags('--describe=X') do |opts|
66
+ assert_equal :describe, opts.show_tasks
67
+ assert_equal(/X/.to_s, opts.show_task_pattern.to_s)
68
+ end
69
+ end
70
+
71
+ def test_execute
72
+ $xyzzy = 0
73
+ flags('--execute=$xyzzy=1', '-e $xyzzy=1') do |opts|
74
+ assert_equal 1, $xyzzy
75
+ assert_equal :exit, @exit
76
+ $xyzzy = 0
77
+ end
78
+ end
79
+
80
+ def test_execute_and_continue
81
+ $xyzzy = 0
82
+ flags('--execute-continue=$xyzzy=1', '-E $xyzzy=1') do |opts|
83
+ assert_equal 1, $xyzzy
84
+ refute_equal :exit, @exit
85
+ $xyzzy = 0
86
+ end
87
+ end
88
+
89
+ def test_execute_and_print
90
+ $xyzzy = 0
91
+ out, = capture_io do
92
+ flags('--execute-print=$xyzzy="pugh"', '-p $xyzzy="pugh"') do |opts|
93
+ assert_equal 'pugh', $xyzzy
94
+ assert_equal :exit, @exit
95
+ $xyzzy = 0
96
+ end
97
+ end
98
+
99
+ assert_match(/^pugh$/, out)
100
+ end
101
+
102
+ def test_help
103
+ out, = capture_io do
104
+ flags '--help', '-H', '-h'
105
+ end
106
+
107
+ assert_match(/\Arake/, out)
108
+ assert_match(/\boptions\b/, out)
109
+ assert_match(/\btargets\b/, out)
110
+ assert_equal :exit, @exit
111
+ end
112
+
113
+ def test_jobs
114
+ flags([]) do |opts|
115
+ assert_nil opts.thread_pool_size
116
+ end
117
+ flags(['--jobs', '0'], ['-j', '0']) do |opts|
118
+ assert_equal 0, opts.thread_pool_size
119
+ end
120
+ flags(['--jobs', '1'], ['-j', '1']) do |opts|
121
+ assert_equal 0, opts.thread_pool_size
122
+ end
123
+ flags(['--jobs', '4'], ['-j', '4']) do |opts|
124
+ assert_equal 3, opts.thread_pool_size
125
+ end
126
+ flags(['--jobs', 'asdas'], ['-j', 'asdas']) do |opts|
127
+ assert_equal Rake.suggested_thread_count-1, opts.thread_pool_size
128
+ end
129
+ flags('--jobs', '-j') do |opts|
130
+ assert opts.thread_pool_size > 1_000_000, "thread pool size should be huge (was #{opts.thread_pool_size})"
131
+ end
132
+ end
133
+
134
+ def test_libdir
135
+ flags(['--libdir', 'xx'], ['-I', 'xx'], ['-Ixx']) do |opts|
136
+ $:.include?('xx')
137
+ end
138
+ ensure
139
+ $:.delete('xx')
140
+ end
141
+
142
+ def test_multitask
143
+ flags('--multitask', '-m') do |opts|
144
+ assert_equal opts.always_multitask, true
145
+ end
146
+ end
147
+
148
+ def test_rakefile
149
+ flags(['--rakefile', 'RF'], ['--rakefile=RF'], ['-f', 'RF'], ['-fRF']) do |opts|
150
+ assert_equal ['RF'], @app.instance_eval { @rakefiles }
151
+ end
152
+ end
153
+
154
+ def test_rakelib
155
+ dirs = %w(A B C).join(File::PATH_SEPARATOR)
156
+ flags(
157
+ ['--rakelibdir', dirs],
158
+ ["--rakelibdir=#{dirs}"],
159
+ ['-R', dirs],
160
+ ["-R#{dirs}"]) do |opts|
161
+ assert_equal ['A', 'B', 'C'], opts.rakelib
162
+ end
163
+ end
164
+
165
+ def test_require
166
+ $LOAD_PATH.unshift @tempdir
167
+
168
+ open 'reqfile.rb', 'w' do |io| io << 'TESTING_REQUIRE << 1' end
169
+ open 'reqfile2.rb', 'w' do |io| io << 'TESTING_REQUIRE << 2' end
170
+ open 'reqfile3.rake', 'w' do |io| io << 'TESTING_REQUIRE << 3' end
171
+
172
+ flags(['--require', 'reqfile'], '-rreqfile2', '-rreqfile3')
173
+
174
+ assert_includes TESTING_REQUIRE, 1
175
+ assert_includes TESTING_REQUIRE, 2
176
+ assert_includes TESTING_REQUIRE, 3
177
+
178
+ assert_equal 3, TESTING_REQUIRE.size
179
+ ensure
180
+ $LOAD_PATH.delete @tempdir
181
+ end
182
+
183
+ def test_missing_require
184
+ ex = assert_raises(LoadError) do
185
+ flags(['--require', 'test/missing']) do |opts|
186
+ end
187
+ end
188
+ assert_match(/such file/, ex.message)
189
+ assert_match(/test\/missing/, ex.message)
190
+ end
191
+
192
+ def test_prereqs
193
+ flags('--prereqs', '-P') do |opts|
194
+ assert opts.show_prereqs
195
+ end
196
+ end
197
+
198
+ def test_quiet
199
+ Rake::FileUtilsExt.verbose_flag = true
200
+ flags('--quiet', '-q') do |opts|
201
+ assert ! Rake::FileUtilsExt.verbose_flag, "verbose flag shoud be false"
202
+ assert ! opts.silent, "should not be silent"
203
+ end
204
+ end
205
+
206
+ def test_no_search
207
+ flags('--nosearch', '--no-search', '-N') do |opts|
208
+ assert opts.nosearch
209
+ end
210
+ end
211
+
212
+ def test_silent
213
+ Rake::FileUtilsExt.verbose_flag = true
214
+ flags('--silent', '-s') do |opts|
215
+ assert ! Rake::FileUtilsExt.verbose_flag, "verbose flag should be false"
216
+ assert opts.silent, "should be silent"
217
+ end
218
+ end
219
+
220
+ def test_system
221
+ flags('--system', '-g') do |opts|
222
+ assert opts.load_system
223
+ end
224
+ end
225
+
226
+ def test_no_system
227
+ flags('--no-system', '-G') do |opts|
228
+ assert opts.ignore_system
229
+ end
230
+ end
231
+
232
+ def test_trace
233
+ flags('--trace', '-t') do |opts|
234
+ assert opts.trace, "should enable trace option"
235
+ assert opts.backtrace, "should enabled backtrace option"
236
+ assert_equal $stderr, opts.trace_output
237
+ assert Rake::FileUtilsExt.verbose_flag
238
+ assert ! Rake::FileUtilsExt.nowrite_flag
239
+ end
240
+ end
241
+
242
+ def test_trace_with_stdout
243
+ flags('--trace=stdout', '-tstdout') do |opts|
244
+ assert opts.trace, "should enable trace option"
245
+ assert opts.backtrace, "should enabled backtrace option"
246
+ assert_equal $stdout, opts.trace_output
247
+ assert Rake::FileUtilsExt.verbose_flag
248
+ assert ! Rake::FileUtilsExt.nowrite_flag
249
+ end
250
+ end
251
+
252
+ def test_trace_with_stderr
253
+ flags('--trace=stderr', '-tstderr') do |opts|
254
+ assert opts.trace, "should enable trace option"
255
+ assert opts.backtrace, "should enabled backtrace option"
256
+ assert_equal $stderr, opts.trace_output
257
+ assert Rake::FileUtilsExt.verbose_flag
258
+ assert ! Rake::FileUtilsExt.nowrite_flag
259
+ end
260
+ end
261
+
262
+ def test_trace_with_error
263
+ ex = assert_raises(Rake::CommandLineOptionError) do
264
+ flags('--trace=xyzzy') do |opts| end
265
+ end
266
+ assert_match(/un(known|recognized).*\btrace\b.*xyzzy/i, ex.message)
267
+ end
268
+
269
+ def test_trace_with_following_task_name
270
+ flags(['--trace', 'taskname'], ['-t', 'taskname']) do |opts|
271
+ assert opts.trace, "should enable trace option"
272
+ assert opts.backtrace, "should enabled backtrace option"
273
+ assert_equal $stderr, opts.trace_output
274
+ assert Rake::FileUtilsExt.verbose_flag
275
+ assert_equal ['taskname'], @app.top_level_tasks
276
+ end
277
+ end
278
+
279
+ def test_backtrace
280
+ flags('--backtrace') do |opts|
281
+ assert opts.backtrace, "should enable backtrace option"
282
+ assert_equal $stderr, opts.trace_output
283
+ assert ! opts.trace, "should not enable trace option"
284
+ end
285
+ end
286
+
287
+ def test_backtrace_with_stdout
288
+ flags('--backtrace=stdout') do |opts|
289
+ assert opts.backtrace, "should enable backtrace option"
290
+ assert_equal $stdout, opts.trace_output
291
+ assert ! opts.trace, "should not enable trace option"
292
+ end
293
+ end
294
+
295
+ def test_backtrace_with_stderr
296
+ flags('--backtrace=stderr') do |opts|
297
+ assert opts.backtrace, "should enable backtrace option"
298
+ assert_equal $stderr, opts.trace_output
299
+ assert ! opts.trace, "should not enable trace option"
300
+ end
301
+ end
302
+
303
+ def test_backtrace_with_error
304
+ ex = assert_raises(Rake::CommandLineOptionError) do
305
+ flags('--backtrace=xyzzy') do |opts| end
306
+ end
307
+ assert_match(/un(known|recognized).*\bbacktrace\b.*xyzzy/i, ex.message)
308
+ end
309
+
310
+ def test_backtrace_with_following_task_name
311
+ flags(['--backtrace', 'taskname']) do |opts|
312
+ assert ! opts.trace, "should enable trace option"
313
+ assert opts.backtrace, "should enabled backtrace option"
314
+ assert_equal $stderr, opts.trace_output
315
+ assert_equal ['taskname'], @app.top_level_tasks
316
+ end
317
+ end
318
+
319
+ def test_trace_rules
320
+ flags('--rules') do |opts|
321
+ assert opts.trace_rules
322
+ end
323
+ end
324
+
325
+ def test_tasks
326
+ flags('--tasks', '-T') do |opts|
327
+ assert_equal :tasks, opts.show_tasks
328
+ assert_equal(//.to_s, opts.show_task_pattern.to_s)
329
+ assert_equal nil, opts.show_all_tasks
330
+ end
331
+ flags(['--tasks', 'xyz'], ['-Txyz']) do |opts|
332
+ assert_equal :tasks, opts.show_tasks
333
+ assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
334
+ assert_equal nil, opts.show_all_tasks
335
+ end
336
+ flags(['--tasks', 'xyz', '--comments']) do |opts|
337
+ assert_equal :tasks, opts.show_tasks
338
+ assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
339
+ assert_equal false, opts.show_all_tasks
340
+ end
341
+ end
342
+
343
+ def test_where
344
+ flags('--where', '-W') do |opts|
345
+ assert_equal :lines, opts.show_tasks
346
+ assert_equal(//.to_s, opts.show_task_pattern.to_s)
347
+ assert_equal true, opts.show_all_tasks
348
+ end
349
+ flags(['--where', 'xyz'], ['-Wxyz']) do |opts|
350
+ assert_equal :lines, opts.show_tasks
351
+ assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
352
+ assert_equal true, opts.show_all_tasks
353
+ end
354
+ flags(['--where', 'xyz', '--comments'], ['-Wxyz', '--comments']) do |opts|
355
+ assert_equal :lines, opts.show_tasks
356
+ assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
357
+ assert_equal false, opts.show_all_tasks
358
+ end
359
+ end
360
+
361
+ def test_no_deprecated_messages
362
+ flags('--no-deprecation-warnings', '-X') do |opts|
363
+ assert opts.ignore_deprecate
364
+ end
365
+ end
366
+
367
+ def test_verbose
368
+ capture_io do
369
+ flags('--verbose', '-v') do |opts|
370
+ assert Rake::FileUtilsExt.verbose_flag, "verbose should be true"
371
+ assert ! opts.silent, "opts should not be silent"
372
+ end
373
+ end
374
+ end
375
+
376
+ def test_version
377
+ out, _ = capture_io do
378
+ flags '--version', '-V'
379
+ end
380
+
381
+ assert_match(/\bversion\b/, out)
382
+ assert_match(/\b#{RAKEVERSION}\b/, out)
383
+ assert_equal :exit, @exit
384
+ end
385
+
386
+ def test_bad_option
387
+ _, err = capture_io do
388
+ ex = assert_raises(OptionParser::InvalidOption) do
389
+ flags('--bad-option')
390
+ end
391
+
392
+ if ex.message =~ /^While/ # Ruby 1.9 error message
393
+ assert_match(/while parsing/i, ex.message)
394
+ else # Ruby 1.8 error message
395
+ assert_match(/(invalid|unrecognized) option/i, ex.message)
396
+ assert_match(/--bad-option/, ex.message)
397
+ end
398
+ end
399
+
400
+ assert_equal '', err
401
+ end
402
+
403
+ def test_task_collection
404
+ command_line("a", "b")
405
+ assert_equal ["a", "b"], @tasks.sort
406
+ end
407
+
408
+ def test_default_task_collection
409
+ command_line()
410
+ assert_equal ["default"], @tasks
411
+ end
412
+
413
+ def test_environment_definition
414
+ ENV.delete('TESTKEY')
415
+ command_line("TESTKEY=12")
416
+ assert_equal '12', ENV['TESTKEY']
417
+ end
418
+
419
+ def test_multiline_environment_definition
420
+ ENV.delete('TESTKEY')
421
+ command_line("TESTKEY=a\nb\n")
422
+ assert_equal "a\nb\n", ENV['TESTKEY']
423
+ end
424
+
425
+ def test_environment_and_tasks_together
426
+ ENV.delete('TESTKEY')
427
+ command_line("a", "b", "TESTKEY=12")
428
+ assert_equal ["a", "b"], @tasks.sort
429
+ assert_equal '12', ENV['TESTKEY']
430
+ end
431
+
432
+ def test_rake_explicit_task_library
433
+ Rake.add_rakelib 'app/task', 'other'
434
+
435
+ libs = Rake.application.options.rakelib
436
+
437
+ assert libs.include?("app/task")
438
+ assert libs.include?("other")
439
+ end
440
+
441
+ private
442
+
443
+ def flags(*sets)
444
+ sets.each do |set|
445
+ ARGV.clear
446
+
447
+ @exit = catch(:system_exit) { command_line(*set) }
448
+
449
+ yield(@app.options) if block_given?
450
+ end
451
+ end
452
+
453
+ def command_line(*options)
454
+ options.each do |opt| ARGV << opt end
455
+ @app = Rake::Application.new
456
+ def @app.exit(*args)
457
+ throw :system_exit, :exit
458
+ end
459
+ @app.instance_eval do
460
+ handle_options
461
+ collect_command_line_tasks
462
+ end
463
+ @tasks = @app.top_level_tasks
464
+ @app.options
465
+ end
466
+ end
@@ -0,0 +1,119 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+ require 'open3'
3
+
4
+ class TestBacktraceSuppression < Rake::TestCase
5
+ def test_bin_rake_suppressed
6
+ paths = ["something/bin/rake:12"]
7
+
8
+ actual = Rake::Backtrace.collapse(paths)
9
+
10
+ assert_equal [], actual
11
+ end
12
+
13
+ def test_system_dir_suppressed
14
+ path = RbConfig::CONFIG['rubylibprefix']
15
+ skip if path.nil?
16
+ path = File.expand_path path
17
+
18
+ paths = [path + ":12"]
19
+
20
+ actual = Rake::Backtrace.collapse(paths)
21
+
22
+ assert_equal [], actual
23
+ end
24
+
25
+ def test_near_system_dir_isnt_suppressed
26
+ path = RbConfig::CONFIG['rubylibprefix']
27
+ skip if path.nil?
28
+ path = File.expand_path path
29
+
30
+ paths = [" " + path + ":12"]
31
+
32
+ actual = Rake::Backtrace.collapse(paths)
33
+
34
+ assert_equal paths, actual
35
+ end
36
+ end
37
+
38
+ class TestRakeBacktrace < Rake::TestCase
39
+ include RubyRunner
40
+
41
+ def setup
42
+ super
43
+
44
+ skip 'tmpdir is suppressed in backtrace' if
45
+ Dir.pwd =~ Rake::Backtrace::SUPPRESS_PATTERN
46
+ end
47
+
48
+ def invoke(*args)
49
+ rake(*args)
50
+ @err
51
+ end
52
+
53
+ def test_single_collapse
54
+ rakefile %q{
55
+ task :foo do
56
+ raise "foooo!"
57
+ end
58
+ }
59
+
60
+ lines = invoke("foo").split("\n")
61
+
62
+ assert_equal "rake aborted!", lines[0]
63
+ assert_equal "foooo!", lines[1]
64
+ assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!i, lines
65
+ assert_something_matches %r!\ATasks:!, lines
66
+ end
67
+
68
+ def test_multi_collapse
69
+ rakefile %q{
70
+ task :foo do
71
+ Rake.application.invoke_task(:bar)
72
+ end
73
+ task :bar do
74
+ raise "barrr!"
75
+ end
76
+ }
77
+
78
+ lines = invoke("foo").split("\n")
79
+
80
+ assert_equal "rake aborted!", lines[0]
81
+ assert_equal "barrr!", lines[1]
82
+ assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:6!i, lines
83
+ assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!i, lines
84
+ assert_something_matches %r!\ATasks:!, lines
85
+ end
86
+
87
+ def test_suppress_option
88
+ rakefile %q{
89
+ task :baz do
90
+ raise "bazzz!"
91
+ end
92
+ }
93
+
94
+ lines = invoke("baz").split("\n")
95
+ assert_equal "rake aborted!", lines[0]
96
+ assert_equal "bazzz!", lines[1]
97
+ assert_something_matches %r!Rakefile!i, lines
98
+
99
+ lines = invoke("--suppress-backtrace", ".ak.file", "baz").split("\n")
100
+ assert_equal "rake aborted!", lines[0]
101
+ assert_equal "bazzz!", lines[1]
102
+ refute_match %r!Rakefile!i, lines[2]
103
+ end
104
+
105
+ private
106
+
107
+ # Assert that the pattern matches at least one line in +lines+.
108
+ def assert_something_matches(pattern, lines)
109
+ lines.each do |ln|
110
+ if pattern =~ ln
111
+ assert_match pattern, ln
112
+ return
113
+ end
114
+ end
115
+ flunk "expected #{pattern.inspect} to match something in:\n" +
116
+ "#{lines.join("\n ")}"
117
+ end
118
+
119
+ end
@@ -0,0 +1,55 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+ require 'rake/clean'
3
+
4
+ class TestRakeClean < Rake::TestCase
5
+ def test_clean
6
+ load 'rake/clean.rb', true
7
+
8
+ assert Rake::Task['clean'], "Should define clean"
9
+ assert Rake::Task['clobber'], "Should define clobber"
10
+ assert Rake::Task['clobber'].prerequisites.include?("clean"),
11
+ "Clobber should require clean"
12
+ end
13
+
14
+ def test_cleanup
15
+ file_name = create_undeletable_file
16
+
17
+ out, _ = capture_io do
18
+ Rake::Cleaner.cleanup(file_name, :verbose => false)
19
+ end
20
+ assert_match(/failed to remove/i, out)
21
+
22
+ ensure
23
+ remove_undeletable_file
24
+ end
25
+
26
+ def test_cleanup_ignores_missing_files
27
+ file_name = File.join(@tempdir, "missing_directory", "no_such_file")
28
+
29
+ out, _ = capture_io do
30
+ Rake::Cleaner.cleanup(file_name, :verbose => false)
31
+ end
32
+ refute_match(/failed to remove/i, out)
33
+ end
34
+
35
+ private
36
+
37
+ def create_undeletable_file
38
+ dir_name = File.join(@tempdir, "deletedir")
39
+ file_name = File.join(dir_name, "deleteme")
40
+ FileUtils.mkdir(dir_name)
41
+ FileUtils.touch(file_name)
42
+ FileUtils.chmod(0, file_name)
43
+ FileUtils.chmod(0, dir_name)
44
+ file_name
45
+ end
46
+
47
+ def remove_undeletable_file
48
+ dir_name = File.join(@tempdir, "deletedir")
49
+ file_name = File.join(dir_name, "deleteme")
50
+ FileUtils.chmod(0777, dir_name)
51
+ FileUtils.chmod(0777, file_name)
52
+ Rake::Cleaner.cleanup(file_name, :verbose => false)
53
+ Rake::Cleaner.cleanup(dir_name, :verbose => false)
54
+ end
55
+ end
@@ -0,0 +1,50 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+
3
+ class TestRakeCpuCounter < Rake::TestCase
4
+
5
+ def setup
6
+ super
7
+
8
+ @cpu_counter = Rake::CpuCounter.new
9
+ end
10
+
11
+ def test_count_via_win32
12
+ if Rake::Win32.windows? then
13
+ assert_kind_of Numeric, @cpu_counter.count_via_win32
14
+ else
15
+ assert_nil @cpu_counter.count_via_win32
16
+ end
17
+ end
18
+
19
+ def test_in_path_command
20
+ with_ruby_in_path do |ruby|
21
+ assert_equal ruby, @cpu_counter.in_path_command(ruby)
22
+ end
23
+ rescue Errno::ENOENT => e
24
+ raise unless e.message =~ /\bwhich\b/
25
+
26
+ skip 'cannot find which for this test'
27
+ end
28
+
29
+ def test_run
30
+ with_ruby_in_path do |ruby|
31
+ assert_equal 7, @cpu_counter.run(ruby, '-e', 'puts 3 + 4')
32
+ end
33
+ end
34
+
35
+ def with_ruby_in_path
36
+ ruby = File.basename Gem.ruby
37
+ ruby_dir = File.dirname Gem.ruby
38
+
39
+ begin
40
+ orig_path, ENV['PATH'] =
41
+ ENV['PATH'], [ruby_dir, *ENV['PATH']].join(File::PATH_SEPARATOR)
42
+
43
+ yield ruby
44
+ ensure
45
+ ENV['PATH'] = orig_path
46
+ end
47
+ end
48
+
49
+ end
50
+