rake 0.9.6 → 10.0.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 (54) hide show
  1. data/README.rdoc +12 -0
  2. data/Rakefile +0 -1
  3. data/doc/command_line_usage.rdoc +17 -60
  4. data/doc/release_notes/rake-0.9.3.rdoc +23 -70
  5. data/lib/rake.rb +0 -1
  6. data/lib/rake/application.rb +23 -63
  7. data/lib/rake/backtrace.rb +2 -3
  8. data/lib/rake/contrib/ftptools.rb +2 -2
  9. data/lib/rake/dsl_definition.rb +0 -26
  10. data/lib/rake/ext/module.rb +0 -39
  11. data/lib/rake/ext/string.rb +1 -2
  12. data/lib/rake/ext/time.rb +1 -2
  13. data/lib/rake/file_list.rb +1 -8
  14. data/lib/rake/file_utils.rb +1 -1
  15. data/lib/rake/phony.rb +2 -4
  16. data/lib/rake/rake_module.rb +7 -0
  17. data/lib/rake/ruby182_test_unit_fix.rb +0 -0
  18. data/lib/rake/runtest.rb +1 -2
  19. data/lib/rake/task.rb +8 -9
  20. data/lib/rake/task_manager.rb +0 -11
  21. data/lib/rake/testtask.rb +1 -4
  22. data/lib/rake/thread_history_display.rb +4 -7
  23. data/lib/rake/thread_pool.rb +76 -42
  24. data/lib/rake/version.rb +6 -7
  25. data/test/helper.rb +4 -44
  26. data/test/test_rake_application.rb +0 -47
  27. data/test/test_rake_application_options.rb +6 -39
  28. data/test/test_rake_backtrace.rb +11 -33
  29. data/test/test_rake_dsl.rb +0 -37
  30. data/test/test_rake_file_task.rb +4 -4
  31. data/test/test_rake_functional.rb +8 -32
  32. data/test/test_rake_rake_test_loader.rb +1 -1
  33. data/test/test_rake_reduce_compat.rb +5 -33
  34. data/test/test_rake_task_manager_argument_resolution.rb +0 -5
  35. data/test/test_rake_task_with_arguments.rb +6 -17
  36. data/test/test_rake_thread_pool.rb +24 -1
  37. data/test/test_rake_top_level_functions.rb +0 -40
  38. data/test/test_thread_history_display.rb +14 -14
  39. metadata +3 -22
  40. data/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
  41. data/doc/release_notes/rake-0.9.4.rdoc +0 -110
  42. data/doc/release_notes/rake-0.9.5.rdoc +0 -114
  43. data/doc/release_notes/rake-0.9.6.rdoc +0 -127
  44. data/lib/rake/classic_namespace.rb +0 -11
  45. data/lib/rake/contrib/sys.rb +0 -192
  46. data/lib/rake/gempackagetask.rb +0 -15
  47. data/lib/rake/private_reader.rb +0 -20
  48. data/lib/rake/promise.rb +0 -99
  49. data/lib/rake/rdoctask.rb +0 -234
  50. data/lib/rake/trace_output.rb +0 -19
  51. data/test/test_private_reader.rb +0 -42
  52. data/test/test_rake_rdoc_task.rb +0 -83
  53. data/test/test_sys.rb +0 -20
  54. data/test/test_trace_output.rb +0 -43
@@ -31,6 +31,18 @@ Download and install rake with the following.
31
31
 
32
32
  gem install rake
33
33
 
34
+ === Normal Installation
35
+
36
+ You can download the source tarball of the latest version of Rake from
37
+
38
+ * http://rubyforge.org/project/showfiles.php?group_id=50
39
+
40
+ Extract the tarball and run
41
+
42
+ % ruby install.rb
43
+
44
+ from its distribution directory.
45
+
34
46
  == Usage
35
47
 
36
48
  === Simple Example
data/Rakefile CHANGED
@@ -60,7 +60,6 @@ task :default => :test
60
60
 
61
61
  Rake::TestTask.new do |t|
62
62
  files = FileList['test/helper.rb', 'test/test_*.rb']
63
- t.loader = :rake
64
63
  t.test_files = files
65
64
  t.libs << "."
66
65
  t.warning = true
@@ -2,7 +2,7 @@
2
2
 
3
3
  Rake is invoked from the command line using:
4
4
 
5
- % rake [options ...] [VAR=VALUE ...] [targets ...]
5
+ % rake [<em>options</em> ...] [<em>VAR</em>=<em>VALUE</em>] [<em>targets</em> ...]
6
6
 
7
7
  Options are:
8
8
 
@@ -11,18 +11,6 @@ Options are:
11
11
  during the execution of the <b>rake</b> command. You can access
12
12
  the value by using ENV['<em>name</em>'].
13
13
 
14
- [<tt>--all</tt> (-A)]
15
- Used in combination with the -T and -D options, will force
16
- those options to show all the tasks, even the ones without comments.
17
-
18
- [<tt>--backtrace</tt>{=_output_} (-n)]
19
- Enable a full backtrace (i.e. like --trace, but without the task
20
- tracing details). The _output_ parameter is optional, but if
21
- specified it controls where the backtrace output is sent. If
22
- _output_ is <tt>stdout</tt>, then backtrace output is directed to
23
- stardard output. If _output_ is <tt>stderr</tt>, or if it is
24
- missing, then the backtrace output is sent to standard error.
25
-
26
14
  [<tt>--classic-namespace</tt> (-n)]
27
15
  Import the Task, FileTask, and FileCreateTask into the top-level
28
16
  scope to be compatible with older versions of Rake. Alternatively
@@ -30,11 +18,6 @@ Options are:
30
18
  'rake/classic_namespace'</code> in your Rakefile to get the
31
19
  classic behavior.
32
20
 
33
- [<tt>--comments</tt>]
34
- Used in combination with the -W options to force the output to
35
- contain commented options only. This is the reverse of
36
- <tt>--all</tt>.
37
-
38
21
  [<tt>--describe</tt> _pattern_ (-D)]
39
22
  Describe the tasks (matching optional PATTERN), then exit.
40
23
 
@@ -55,27 +38,14 @@ Options are:
55
38
  Display some help text and exit.
56
39
 
57
40
  [<tt>--jobs</tt> _number_ (-j)]
58
- Specifies the number of active concurrent tasks used. The
59
- suggested value is equal to the number of CPUs. The concurrent
60
- tasks are used to execute the <tt>multitask</tt> prerequisites.
61
- Also see the <tt>-m</tt> option which turns all tasks into
62
- multitasks.
63
-
41
+ Specifies the maximum number of concurrent tasks. The suggested
42
+ value is equal to the number of CPUs.
43
+
64
44
  Sample values:
65
45
  (no -j) : unlimited concurrent tasks (standard rake behavior)
66
46
  -j : 2 concurrent tasks (exact number may change)
67
47
  -j 16 : 16 concurrent tasks
68
48
 
69
- [<tt>--job-stats</tt> _level_]
70
-
71
- Display job statistics at the completion of the run. By default,
72
- this will display the requested number of active tasks (from the
73
- -j options) and the maximum number of tasks in play at any given
74
- time.
75
-
76
- If the optional _level_ is <tt>history</tt>, then a complete trace
77
- of task history will be displayed on standard output.
78
-
79
49
  [<tt>--libdir</tt> _directory_ (-I)]
80
50
  Add _directory_ to the list of directories searched for require.
81
51
 
@@ -102,16 +72,6 @@ Options are:
102
72
  [<tt>--rakelibdir</tt> _rakelibdir_ (-R)]
103
73
  Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')
104
74
 
105
- [<tt>--reduce-compat</tt>]
106
-
107
- Remove the DSL commands from the Object inheritance hierarchy and
108
- do not define top level constants. This reduces the backwards
109
- compatibility of Rake, but allows rake to be used with software
110
- that would otherwise have conflicting definitions.
111
-
112
- *NOTE:* The next major version of Rake will only be able to be run
113
- in "reduce-compat" mode.
114
-
115
75
  [<tt>--require</tt> _name_ (-r)]
116
76
  Require _name_ before executing the Rakefile.
117
77
 
@@ -121,11 +81,6 @@ Options are:
121
81
  [<tt>--silent (-s)</tt>]
122
82
  Like --quiet, but also suppresses the 'in directory' announcement.
123
83
 
124
- [<tt>--suppress-backtrace _pattern_ </tt>]
125
- Line matching the regular expression _pattern_ will be removed
126
- from the backtrace output. Note that the --backtrace option is the
127
- full backtrace without these lines suppressed.
128
-
129
84
  [<tt>--system</tt> (-g)]
130
85
  Use the system wide (global) rakefiles. The project Rakefile is
131
86
  ignored. By default, the system wide rakefiles are used only if no
@@ -142,13 +97,19 @@ Options are:
142
97
  are defined using the "desc" command. If a pattern is given, then
143
98
  only tasks matching the pattern are displayed.
144
99
 
145
- [<tt>--trace</tt>{=_output_} (-t)]
100
+ [<tt>--no-top-level-dsl</tt> (-X)]
101
+ Do not put the Rake DSL commands into the top level scope.
102
+
103
+ [<tt>--top-level-dsl</tt>]
104
+ Put the Rake DSL commands into the top level scope (default).
105
+
106
+ NOTE: Although currently Rake defaults to its DSL in the top level
107
+ scope, the plan is to deprecate this in the future and default ot
108
+ having the DSL commands *not* appear in the top level scope.
109
+
110
+ [<tt>--trace</tt> (-t)]
146
111
  Turn on invoke/execute tracing. Also enable full backtrace on
147
- errors. The _output_ parameter is optional, but if specified it
148
- controls where the trace output is sent. If _output_ is
149
- <tt>stdout</tt>, then trace output is directed to stardard output.
150
- If _output_ is <tt>stderr</tt>, or if it is missing, then trace
151
- output is sent to standard error.
112
+ errors.
152
113
 
153
114
  [<tt>--verbose</tt> (-v)]
154
115
  Echo the Sys commands to standard output.
@@ -158,11 +119,7 @@ Options are:
158
119
 
159
120
  [<tt>--where</tt> <em>pattern</em> (-W)]
160
121
  Display tasks that match <em>pattern</em> and the file and line
161
- number where the task is defined. By default this option will
162
- display all tasks, not just the tasks that have descriptions.
163
-
164
- [<tt>--no-deprecation-warnings</tt> (-W)]
165
- Do not display the deprecation warnings.
122
+ number where the task is defined.
166
123
 
167
124
  In addition, any command line option of the form
168
125
  <em>VAR</em>=<em>VALUE</em> will be added to the environment hash
@@ -1,59 +1,17 @@
1
1
  = Rake 0.9.3 Released
2
2
 
3
- Rake version 0.9.3 contains some new, backwards compatible features and
4
- a number of bug fixes.
3
+ Rake version 0.9.3 is mainly bug fixes.
5
4
 
6
5
  == Changes
7
6
 
8
- === New Features
9
-
10
- * Multitask tasks now use a thread pool. Use -j to limit the number of
11
- available threads.
12
-
13
- * Use -m to turn regular tasks into multitasks (use at your own risk).
14
-
15
- * You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
16
- programatically add rake task libraries.
17
-
18
- * You can specific backtrace suppression patterns (see
19
- --supress-backtrace)
20
-
21
- * Directory tasks can now take prerequisites and actions
22
-
23
- * Use --backtrace to request a full backtrace without the task trace.
24
-
25
- * You can say "--backtrace=stdout" and "--trace=stdout" to route trace
26
- output to standard output rather than standard error.
27
-
28
- * Optional 'phony' target (enable with 'require 'rake/phony'") for
29
- special purpose builds.
30
-
31
- * Task#clear now clears task comments as well as actions and
32
- prerequisites. Task#clear_comment will specifically target comments.
33
-
34
- * The --all option will force -T and -D to consider all the tasks,
35
- with and without descriptions.
36
-
37
- === Bug Fixes
38
-
39
- * Semi-colons in windows rakefile paths now work.
40
-
41
- * Improved Control-C support when invoking multiple test suites.
42
-
43
- * egrep method now reads files in text mode (better support for
44
- Windows)
45
-
46
- * Better deprecation line number reporting.
47
-
48
- * The -W option now works with all tasks, whether they have a
49
- description or not.
50
-
51
- * File globs in rake should not be sorted alphabetically, independent
52
- of file system and platform.
53
-
54
- * Numerous internal improvements.
55
-
56
- * Documentation typos and fixes.
7
+ * The rake test loader now removes arguments it has processed. Issue #51
8
+ * Rake::TaskArguments now responds to #values_at
9
+ * RakeFileUtils.verbose_flag = nil silences output the same as 0.8.7
10
+ * Rake tests are now directory-independent
11
+ * Rake tests are no longer require flexmock
12
+ * Commands constant is no longer polluting top level namespace.
13
+ * Show only the interesting portion of the backtrace by default (James M. Lawrence).
14
+ * Added --reduce-compat optiont to remove backward compatible DSL hacks (James M. Lawrence).
57
15
 
58
16
  == What is Rake
59
17
 
@@ -70,7 +28,7 @@ The easiest way to get and install rake is via RubyGems ...
70
28
 
71
29
  Otherwise, you can get it from the more traditional places:
72
30
 
73
- Home Page:: http://github.com/jimweirich/rake
31
+ Home Page:: http://rake.rubyforge.org/
74
32
  Download:: http://rubyforge.org/project/showfiles.php?group_id=50
75
33
  GitHub:: git://github.com/jimweirich/rake.git
76
34
 
@@ -80,23 +38,18 @@ As usual, it was input from users that drove a alot of these changes. The
80
38
  following people either contributed patches, made suggestions or made
81
39
  otherwise helpful comments. Thanks to ...
82
40
 
83
- * Aaron Patterson
84
- * Dylan Smith
85
- * Jo Liss
86
- * Jonas Pfenniger
87
- * Kazuki Tsujimoto
88
- * Michael Bishop
89
- * Michael Elufimov
90
- * NAKAMURA Usaku
91
- * Ryan Davis
92
- * Sam Grönblom
93
- * Sam Phippen
94
- * Sergio Wong
95
- * Tay Ray Chuan
96
- * grosser
97
- * quix
98
-
99
- Also, many thanks to Eric Hodel for assisting with getting this release
100
- out the door.
41
+ * James M. Lawrence (quix)
42
+ * Roger Pack
43
+ * Cezary Baginski
44
+ * Sean Scot August Moon
45
+ * R.T. Lechow
46
+ * Alex Chaffee
47
+ * James Tucker
48
+ * Matthias Lüdtke
49
+ * Santiago Pastorino
50
+
51
+ Also, bit thanks to Eric Hodel for assisting with getting this release
52
+ out the door (where "assisting" includes, but is not by any means
53
+ limited to, "pushing" me to get it done).
101
54
 
102
55
  -- Jim Weirich
@@ -43,7 +43,6 @@ require 'rake/win32'
43
43
  require 'rake/task_argument_error'
44
44
  require 'rake/rule_recursion_overflow_error'
45
45
  require 'rake/rake_module'
46
- require 'rake/trace_output'
47
46
  require 'rake/pseudo_status'
48
47
  require 'rake/task_arguments'
49
48
  require 'rake/invocation_chain'
@@ -2,10 +2,8 @@ require 'shellwords'
2
2
  require 'optparse'
3
3
 
4
4
  require 'rake/task_manager'
5
- require 'rake/file_list'
6
5
  require 'rake/thread_pool'
7
6
  require 'rake/thread_history_display'
8
- require 'rake/trace_output'
9
7
  require 'rake/win32'
10
8
 
11
9
  module Rake
@@ -18,7 +16,6 @@ module Rake
18
16
  #
19
17
  class Application
20
18
  include TaskManager
21
- include TraceOutput
22
19
 
23
20
  # The name of the application (typically 'rake')
24
21
  attr_reader :name
@@ -61,7 +58,7 @@ module Rake
61
58
  #
62
59
  # * Initialize the command line options (+init+).
63
60
  # * Define the tasks (+load_rakefile+).
64
- # * Run the top level tasks (+top_level+).
61
+ # * Run the top level tasks (+run_tasks+).
65
62
  #
66
63
  # If you wish to build a custom rake command, you should call
67
64
  # +init+ on your application. Then define any tasks. Finally,
@@ -70,7 +67,15 @@ module Rake
70
67
  standard_exception_handling do
71
68
  init
72
69
  load_rakefile
70
+ thread_pool.gather_history if options.job_stats == :history
73
71
  top_level
72
+ thread_pool.join
73
+ if options.job_stats
74
+ stats = thread_pool.statistics
75
+ puts "Maximum active threads: #{stats[:max_active_threads]}"
76
+ puts "Total threads in play: #{stats[:total_threads_in_play]}"
77
+ end
78
+ ThreadHistoryDisplay.new(thread_pool.history).show if options.job_stats == :history
74
79
  end
75
80
  end
76
81
 
@@ -92,30 +97,13 @@ module Rake
92
97
 
93
98
  # Run the top level tasks of a Rake application.
94
99
  def top_level
95
- run_with_threads do
96
- if options.show_tasks
97
- display_tasks_and_comments
98
- elsif options.show_prereqs
99
- display_prerequisites
100
- else
101
- top_level_tasks.each { |task_name| invoke_task(task_name) }
102
- end
103
- end
104
- end
105
-
106
- # Run the given block with the thread startup and shutdown.
107
- def run_with_threads
108
- thread_pool.gather_history if options.job_stats == :history
109
-
110
- yield
111
-
112
- thread_pool.join
113
- if options.job_stats
114
- stats = thread_pool.statistics
115
- puts "Maximum active threads: #{stats[:max_active_threads]}"
116
- puts "Total threads in play: #{stats[:total_threads_in_play]}"
100
+ if options.show_tasks
101
+ display_tasks_and_comments
102
+ elsif options.show_prereqs
103
+ display_prerequisites
104
+ else
105
+ top_level_tasks.each { |task_name| invoke_task(task_name) }
117
106
  end
118
- ThreadHistoryDisplay.new(thread_pool.history).show if options.job_stats == :history
119
107
  end
120
108
 
121
109
  # Add a loader to handle imported files ending in the extension
@@ -178,7 +166,7 @@ module Rake
178
166
  if options.backtrace
179
167
  trace ex.backtrace.join("\n")
180
168
  else
181
- trace Backtrace.collapse(ex.backtrace).join("\n")
169
+ trace Backtrace.collapse(ex.backtrace)
182
170
  end
183
171
  trace "Tasks: #{ex.chain}" if has_chain?(ex)
184
172
  trace "(See full trace by running task with --trace)" unless options.backtrace
@@ -190,6 +178,7 @@ module Rake
190
178
  # Rake.application.deprecate("import", "Rake.import", caller.first)
191
179
  #
192
180
  def deprecate(old_usage, new_usage, call_site)
181
+ fail "GONE"
193
182
  return if options.ignore_deprecate
194
183
  $stderr.puts "WARNING: '#{old_usage}' is deprecated. " +
195
184
  "Please use '#{new_usage}' instead.\n" +
@@ -207,7 +196,7 @@ module Rake
207
196
  def have_rakefile
208
197
  @rakefiles.each do |fn|
209
198
  if File.exist?(fn)
210
- others = FileList.glob(fn, File::FNM_CASEFOLD)
199
+ others = Rake.glob(fn, File::FNM_CASEFOLD)
211
200
  return others.size == 1 ? others.first : fn
212
201
  elsif fn == ''
213
202
  return fn
@@ -316,9 +305,9 @@ module Rake
316
305
  end
317
306
  end
318
307
 
319
- def trace(*strings)
308
+ def trace(*str)
320
309
  options.trace_output ||= $stderr
321
- trace_on(options.trace_output, *strings)
310
+ options.trace_output.puts(*str)
322
311
  end
323
312
 
324
313
  def sort_options(options)
@@ -338,18 +327,12 @@ module Rake
338
327
  options.show_all_tasks = value
339
328
  }
340
329
  ],
341
- ['--backtrace=[OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.",
330
+ ['--backtrace [OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.",
342
331
  lambda { |value|
343
332
  options.backtrace = true
344
333
  select_trace_output(options, 'backtrace', value)
345
334
  }
346
335
  ],
347
- ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
348
- lambda { |value|
349
- require 'rake/classic_namespace'
350
- options.classic_namespace = true
351
- }
352
- ],
353
336
  ['--comments', "Show commented tasks only",
354
337
  lambda { |value|
355
338
  options.show_all_tasks = !value
@@ -469,7 +452,7 @@ module Rake
469
452
  select_tasks_to_show(options, :tasks, value)
470
453
  }
471
454
  ],
472
- ['--trace=[OUT]', '-t', "Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.",
455
+ ['--trace', '-t [OUT]', "Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.",
473
456
  lambda { |value|
474
457
  options.trace = true
475
458
  options.backtrace = true
@@ -538,16 +521,6 @@ module Rake
538
521
  standard_rake_options.each { |args| opts.on(*args) }
539
522
  opts.environment('RAKEOPT')
540
523
  end.parse!
541
-
542
- # If class namespaces are requested, set the global options
543
- # according to the values in the options structure.
544
- if options.classic_namespace
545
- $show_tasks = options.show_tasks
546
- $show_prereqs = options.show_prereqs
547
- $trace = options.trace
548
- $dryrun = options.dryrun
549
- $silent = options.silent
550
- end
551
524
  end
552
525
 
553
526
  # Similar to the regular Ruby +require+ command, but will check
@@ -600,7 +573,6 @@ module Rake
600
573
  @rakefile = rakefile
601
574
  Dir.chdir(location)
602
575
  print_rakefile_directory(location)
603
- $rakefile = @rakefile if options.classic_namespace
604
576
  Rake.load_rakefile(File.expand_path(@rakefile)) if @rakefile && @rakefile != ''
605
577
  options.rakelib.each do |rlib|
606
578
  glob("#{rlib}/*.rake") do |name|
@@ -612,7 +584,7 @@ module Rake
612
584
  end
613
585
 
614
586
  def glob(path, &block)
615
- FileList.glob(path.gsub("\\", '/')).each(&block)
587
+ Rake.glob(path.gsub("\\", '/')).each(&block)
616
588
  end
617
589
  private :glob
618
590
 
@@ -674,18 +646,6 @@ module Rake
674
646
  end
675
647
  end
676
648
 
677
- # Warn about deprecated use of top level constant names.
678
- def const_warning(const_name)
679
- @const_warning ||= false
680
- if ! @const_warning
681
- $stderr.puts %{WARNING: Deprecated reference to top-level constant '#{const_name}' } +
682
- %{found at: #{rakefile_location}} # '
683
- $stderr.puts %{ Use --classic-namespace on rake command}
684
- $stderr.puts %{ or 'require "rake/classic_namespace"' in Rakefile}
685
- end
686
- @const_warning = true
687
- end
688
-
689
649
  def rakefile_location(backtrace=caller)
690
650
  backtrace.map { |t| t[/([^:]+):/,1] }
691
651