rake 10.1.1 → 10.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/.rubocop.yml +27 -0
- data/.togglerc +7 -0
- data/Gemfile +5 -0
- data/{CHANGES → History.rdoc} +84 -54
- data/Manifest.txt +161 -0
- data/README.rdoc +9 -10
- data/Rakefile +34 -337
- data/doc/command_line_usage.rdoc +16 -10
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +72 -36
- data/doc/release_notes/rake-0.5.3.rdoc +1 -1
- data/doc/release_notes/rake-0.5.4.rdoc +1 -1
- data/doc/release_notes/rake-0.8.6.rdoc +1 -19
- data/doc/release_notes/rake-0.9.2.2.rdoc +2 -2
- data/doc/release_notes/rake-0.9.4.rdoc +0 -50
- data/doc/release_notes/rake-0.9.5.rdoc +0 -59
- data/doc/release_notes/rake-0.9.6.rdoc +0 -63
- data/doc/release_notes/rake-10.0.1.rdoc +2 -131
- data/doc/release_notes/rake-10.0.2.rdoc +2 -140
- data/doc/release_notes/rake-10.1.0.rdoc +2 -2
- data/lib/rake.rb +6 -1
- data/lib/rake/alt_system.rb +5 -3
- data/lib/rake/application.rb +102 -60
- data/lib/rake/backtrace.rb +1 -1
- data/lib/rake/cloneable.rb +3 -3
- data/lib/rake/contrib/.document +0 -0
- data/lib/rake/contrib/ftptools.rb +3 -5
- data/lib/rake/contrib/publisher.rb +12 -4
- data/lib/rake/contrib/rubyforgepublisher.rb +3 -1
- data/lib/rake/contrib/sshpublisher.rb +13 -2
- data/lib/rake/contrib/sys.rb +2 -0
- data/lib/rake/cpu_counter.rb +104 -0
- data/lib/rake/default_loader.rb +4 -0
- data/lib/rake/dsl_definition.rb +58 -17
- data/lib/rake/early_time.rb +4 -1
- data/lib/rake/ext/core.rb +2 -5
- data/lib/rake/ext/module.rb +1 -0
- data/lib/rake/ext/string.rb +35 -28
- data/lib/rake/ext/time.rb +1 -1
- data/lib/rake/file_list.rb +7 -9
- data/lib/rake/file_task.rb +1 -1
- data/lib/rake/gempackagetask.rb +3 -1
- data/lib/rake/invocation_chain.rb +0 -1
- data/lib/rake/linked_list.rb +1 -1
- data/lib/rake/packagetask.rb +19 -7
- data/lib/rake/pathmap.rb +2 -0
- data/lib/rake/pseudo_status.rb +2 -2
- data/lib/rake/rake_module.rb +6 -5
- data/lib/rake/rdoctask.rb +2 -0
- data/lib/rake/ruby182_test_unit_fix.rb +2 -0
- data/lib/rake/runtest.rb +6 -1
- data/lib/rake/scope.rb +1 -1
- data/lib/rake/task.rb +14 -9
- data/lib/rake/task_arguments.rb +19 -10
- data/lib/rake/task_manager.rb +20 -8
- data/lib/rake/tasklib.rb +2 -0
- data/lib/rake/testtask.rb +20 -9
- data/lib/rake/thread_pool.rb +13 -10
- data/lib/rake/trace_output.rb +1 -1
- data/lib/rake/version.rb +0 -2
- data/lib/rake/win32.rb +1 -1
- data/rakelib/publish.rake +20 -0
- data/rakelib/test_times.rake +25 -0
- data/test/helper.rb +6 -7
- data/test/support/rakefile_definitions.rb +34 -0
- data/test/test_rake_application.rb +89 -31
- data/test/test_rake_application_options.rb +13 -4
- data/test/test_rake_backtrace.rb +6 -2
- data/test/test_rake_clean.rb +3 -3
- data/test/test_rake_cpu_counter.rb +42 -0
- data/test/test_rake_file_task.rb +10 -0
- data/test/test_rake_functional.rb +17 -1
- data/test/test_rake_path_map.rb +2 -2
- data/test/test_rake_rules.rb +26 -0
- data/test/test_rake_task.rb +16 -0
- data/test/test_rake_task_argument_parsing.rb +6 -0
- data/test/test_rake_task_arguments.rb +6 -0
- data/test/test_rake_task_manager.rb +20 -0
- data/test/test_rake_test_task.rb +23 -1
- metadata +196 -72
- metadata.gz.sig +0 -0
- data/TODO +0 -21
- data/install.rb +0 -80
@@ -5,69 +5,6 @@ Rake into the Ruby source tree and fixing tests.
|
|
5
5
|
|
6
6
|
== Changes
|
7
7
|
|
8
|
-
=== New Features (in 0.9.3)
|
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 (0.9.3)
|
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.
|
57
|
-
|
58
|
-
=== Bug Fixes (0.9.4)
|
59
|
-
|
60
|
-
* Exit status with failing tests is not correctly set to non-zero.
|
61
|
-
|
62
|
-
* Simplified syntax for phony task (for older versions of RDoc).
|
63
|
-
|
64
|
-
* Stand alone FileList usage gets glob function (without loading in
|
65
|
-
extra dependencies)
|
66
|
-
|
67
|
-
=== Bug Fixes (0.9.5)
|
68
|
-
|
69
|
-
* --trace and --backtrace no longer swallow following task names.
|
70
|
-
|
71
8
|
=== Bug Fixes (0.9.6)
|
72
9
|
|
73
10
|
* Better trace output when using a multi-threaded Rakefile.
|
@@ -1,137 +1,8 @@
|
|
1
1
|
= Rake 10.0.1 Released
|
2
2
|
|
3
|
-
|
3
|
+
== Changes in 10.0.1
|
4
4
|
|
5
|
-
|
6
|
-
conferences, panels and over twitter. Due to historical reasons (or
|
7
|
-
maybe just plain laziness) Rake has (incorrectly) been treating the
|
8
|
-
second digit of the version as the major release number. So in my head
|
9
|
-
Rake was already at version 9.
|
10
|
-
|
11
|
-
Well, it's time to fix things. This next version of Rake drops old,
|
12
|
-
crufty, backwards compatibility hacks such as top level constants, DSL
|
13
|
-
methods defined in Object and numerous other features that are just no
|
14
|
-
longer desired. It's also time to drop the leading zero from the
|
15
|
-
version number as well and call this new version of rake what it
|
16
|
-
really is: Version 10.
|
17
|
-
|
18
|
-
So, welcome to Rake 10.0!
|
19
|
-
|
20
|
-
Rake 10 is actually feature identical to the latest version of Rake 9
|
21
|
-
(that would be the version spelled 0.9.3), *except* that Rake 10 drops
|
22
|
-
all the sundry deprecated features that have accumulated over the years.
|
23
|
-
|
24
|
-
If your Rakefile is up to date and current with all the new features
|
25
|
-
of Rake 10, you are ready to go. If your Rakefile still uses a few
|
26
|
-
deprecated feeatures, feel free to use Rake 9 (0.9.3) with the same
|
27
|
-
feature set. Just be aware that future features will be in Rake 10
|
28
|
-
family line.
|
29
|
-
|
30
|
-
== Changes in 10.0
|
31
|
-
|
32
|
-
As mentioned above, there are no new features in Rake 10. However,
|
33
|
-
there are a number of features missing:
|
34
|
-
|
35
|
-
* Classic namespaces are now gone. Rake is no longer able to reflect
|
36
|
-
the options settings in the global variables ($rakefile, $show_tasks,
|
37
|
-
$show_prereqs, $trace, $dryrun and $silent). The
|
38
|
-
<tt>--classic-namespace</tt> option is no longer supported.
|
39
|
-
|
40
|
-
* Global constants are no longer supported. This includes
|
41
|
-
<tt>Task</tt>, <tt>FileTask</tt>, <tt>FileCreationTask</tt> and
|
42
|
-
<tt>RakeApp</tt>). The constant missing hook to warn about using
|
43
|
-
global rake constants has been removed.
|
44
|
-
|
45
|
-
* The Rake DSL methods (task, file, directory, etc) are in their own
|
46
|
-
module (Rake::DSL). The stub versions of these methods (that printed
|
47
|
-
warnings) in Object have been removed. However, the DSL methods are
|
48
|
-
added to the top-level <tt>main</tt> object. Since <tt>main</tt> is
|
49
|
-
not in the inheritance tree, the presence of the DSL methods in main
|
50
|
-
should be low impact on other libraries.
|
51
|
-
|
52
|
-
If you want to use the Rake DSL commands from your own code, just
|
53
|
-
include <tt>Rake::DSL</tt> into your own classes and modules.
|
54
|
-
|
55
|
-
* The deprecated syntax for task arguments (the one using
|
56
|
-
<tt>:needs</tt>) has been removed.
|
57
|
-
|
58
|
-
* The <tt>--reduce-compat</tt> flag has been removed (it's not needed
|
59
|
-
anymore).
|
60
|
-
|
61
|
-
* The deprecated <tt>rake/sys.rb</tt> library has been removed.
|
62
|
-
|
63
|
-
* The deprecated <tt>rake/rdoctask.rb</tt> library has been removed.
|
64
|
-
RDoc supplies its own rake task now.
|
65
|
-
|
66
|
-
* The deprecated <tt>rake/gempackagetask.rb</tt> library has been
|
67
|
-
removed. Gem supplies its own package task now.
|
68
|
-
|
69
|
-
There is one small behavioral change:
|
70
|
-
|
71
|
-
* Non-file tasks now always report the current time as their time
|
72
|
-
stamp. This is different from the previous behavior where non-file
|
73
|
-
tasks reported current time only if there were no prerequisites, and
|
74
|
-
the max prerequisite timestamp otherwise. This lead to inconsistent
|
75
|
-
and surprising behavior when adding prerequisites to tasks that in
|
76
|
-
turn were prequisites to file tasks. The new behavior is more
|
77
|
-
consistent and predictable.
|
78
|
-
|
79
|
-
== Changes (from 0.9.3 & 0.9.4)
|
80
|
-
|
81
|
-
Since Rake 10 includes the changes from the last version of Rake 9,
|
82
|
-
we'll repeat the changes for version 0.9.3 here.
|
83
|
-
|
84
|
-
=== New Features (in 0.9.3)
|
85
|
-
|
86
|
-
* Multitask tasks now use a thread pool. Use -j to limit the number of
|
87
|
-
available threads.
|
88
|
-
|
89
|
-
* Use -m to turn regular tasks into multitasks (use at your own risk).
|
90
|
-
|
91
|
-
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
|
92
|
-
programatically add rake task libraries.
|
93
|
-
|
94
|
-
* You can specific backtrace suppression patterns (see
|
95
|
-
--supress-backtrace)
|
96
|
-
|
97
|
-
* Directory tasks can now take prerequisites and actions
|
98
|
-
|
99
|
-
* Use --backtrace to request a full backtrace without the task trace.
|
100
|
-
|
101
|
-
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
|
102
|
-
output to standard output rather than standard error.
|
103
|
-
|
104
|
-
* Optional 'phony' target (enable with 'require 'rake/phony'") for
|
105
|
-
special purpose builds.
|
106
|
-
|
107
|
-
* Task#clear now clears task comments as well as actions and
|
108
|
-
prerequisites. Task#clear_comment will specifically target comments.
|
109
|
-
|
110
|
-
* The --all option will force -T and -D to consider all the tasks,
|
111
|
-
with and without descriptions.
|
112
|
-
|
113
|
-
=== Bug Fixes (in 0.9.3)
|
114
|
-
|
115
|
-
* Semi-colons in windows rakefile paths now work.
|
116
|
-
|
117
|
-
* Improved Control-C support when invoking multiple test suites.
|
118
|
-
|
119
|
-
* egrep method now reads files in text mode (better support for
|
120
|
-
Windows)
|
121
|
-
|
122
|
-
* Better deprecation line number reporting.
|
123
|
-
|
124
|
-
* The -W option now works with all tasks, whether they have a
|
125
|
-
description or not.
|
126
|
-
|
127
|
-
* File globs in rake should not be sorted alphabetically, independent
|
128
|
-
of file system and platform.
|
129
|
-
|
130
|
-
* Numerous internal improvements.
|
131
|
-
|
132
|
-
* Documentation typos and fixes.
|
133
|
-
|
134
|
-
=== Bug Fixes (in 0.9.4)
|
5
|
+
=== Bug Fixes
|
135
6
|
|
136
7
|
* Exit status with failing tests is not correctly set to non-zero.
|
137
8
|
|
@@ -1,146 +1,8 @@
|
|
1
1
|
= Rake 10.0.2 Released
|
2
2
|
|
3
|
-
|
3
|
+
== Changes in Rake 10.0.2
|
4
4
|
|
5
|
-
|
6
|
-
conferences, panels and over twitter. Due to historical reasons (or
|
7
|
-
maybe just plain laziness) Rake has (incorrectly) been treating the
|
8
|
-
second digit of the version as the major release number. So in my head
|
9
|
-
Rake was already at version 9.
|
10
|
-
|
11
|
-
Well, it's time to fix things. This next version of Rake drops old,
|
12
|
-
crufty, backwards compatibility hacks such as top level constants, DSL
|
13
|
-
methods defined in Object and numerous other features that are just no
|
14
|
-
longer desired. It's also time to drop the leading zero from the
|
15
|
-
version number as well and call this new version of rake what it
|
16
|
-
really is: Version 10.
|
17
|
-
|
18
|
-
So, welcome to Rake 10.0!
|
19
|
-
|
20
|
-
Rake 10 is actually feature identical to the latest version of Rake 9
|
21
|
-
(that would be the version spelled 0.9.3), *except* that Rake 10 drops
|
22
|
-
all the sundry deprecated features that have accumulated over the years.
|
23
|
-
|
24
|
-
If your Rakefile is up to date and current with all the new features
|
25
|
-
of Rake 10, you are ready to go. If your Rakefile still uses a few
|
26
|
-
deprecated feeatures, feel free to use Rake 9 (0.9.3) with the same
|
27
|
-
feature set. Just be aware that future features will be in Rake 10
|
28
|
-
family line.
|
29
|
-
|
30
|
-
== Changes in Version 10
|
31
|
-
|
32
|
-
As mentioned above, there are no new features in Rake 10. However,
|
33
|
-
there are a number of features missing:
|
34
|
-
|
35
|
-
* Classic namespaces are now gone. Rake is no longer able to reflect
|
36
|
-
the options settings in the global variables ($rakefile, $show_tasks,
|
37
|
-
$show_prereqs, $trace, $dryrun and $silent). The
|
38
|
-
<tt>--classic-namespace</tt> option is no longer supported.
|
39
|
-
|
40
|
-
* Global constants are no longer supported. This includes
|
41
|
-
<tt>Task</tt>, <tt>FileTask</tt>, <tt>FileCreationTask</tt> and
|
42
|
-
<tt>RakeApp</tt>). The constant missing hook to warn about using
|
43
|
-
global rake constants has been removed.
|
44
|
-
|
45
|
-
* The Rake DSL methods (task, file, directory, etc) are in their own
|
46
|
-
module (Rake::DSL). The stub versions of these methods (that printed
|
47
|
-
warnings) in Object have been removed. However, the DSL methods are
|
48
|
-
added to the top-level <tt>main</tt> object. Since <tt>main</tt> is
|
49
|
-
not in the inheritance tree, the presence of the DSL methods in main
|
50
|
-
should be low impact on other libraries.
|
51
|
-
|
52
|
-
If you want to use the Rake DSL commands from your own code, just
|
53
|
-
include <tt>Rake::DSL</tt> into your own classes and modules.
|
54
|
-
|
55
|
-
* The deprecated syntax for task arguments (the one using
|
56
|
-
<tt>:needs</tt>) has been removed.
|
57
|
-
|
58
|
-
* The <tt>--reduce-compat</tt> flag has been removed (it's not needed
|
59
|
-
anymore).
|
60
|
-
|
61
|
-
* The deprecated <tt>rake/sys.rb</tt> library has been removed.
|
62
|
-
|
63
|
-
* The deprecated <tt>rake/rdoctask.rb</tt> library has been removed.
|
64
|
-
RDoc supplies its own rake task now.
|
65
|
-
|
66
|
-
* The deprecated <tt>rake/gempackagetask.rb</tt> library has been
|
67
|
-
removed. Gem supplies its own package task now.
|
68
|
-
|
69
|
-
There is one small behavioral change:
|
70
|
-
|
71
|
-
* Non-file tasks now always report the current time as their time
|
72
|
-
stamp. This is different from the previous behavior where non-file
|
73
|
-
tasks reported current time only if there were no prerequisites, and
|
74
|
-
the max prerequisite timestamp otherwise. This lead to inconsistent
|
75
|
-
and surprising behavior when adding prerequisites to tasks that in
|
76
|
-
turn were prequisites to file tasks. The new behavior is more
|
77
|
-
consistent and predictable.
|
78
|
-
|
79
|
-
== Changes (from 0.9.3, 0.9.4, 0.9.5)
|
80
|
-
|
81
|
-
Since Rake 10 includes the changes from the last version of Rake 9,
|
82
|
-
we'll repeat the changes for versions 0.9.3 through 0.9.5 here.
|
83
|
-
|
84
|
-
=== New Features (in 0.9.3)
|
85
|
-
|
86
|
-
* Multitask tasks now use a thread pool. Use -j to limit the number of
|
87
|
-
available threads.
|
88
|
-
|
89
|
-
* Use -m to turn regular tasks into multitasks (use at your own risk).
|
90
|
-
|
91
|
-
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
|
92
|
-
programatically add rake task libraries.
|
93
|
-
|
94
|
-
* You can specific backtrace suppression patterns (see
|
95
|
-
--supress-backtrace)
|
96
|
-
|
97
|
-
* Directory tasks can now take prerequisites and actions
|
98
|
-
|
99
|
-
* Use --backtrace to request a full backtrace without the task trace.
|
100
|
-
|
101
|
-
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
|
102
|
-
output to standard output rather than standard error.
|
103
|
-
|
104
|
-
* Optional 'phony' target (enable with 'require 'rake/phony'") for
|
105
|
-
special purpose builds.
|
106
|
-
|
107
|
-
* Task#clear now clears task comments as well as actions and
|
108
|
-
prerequisites. Task#clear_comment will specifically target comments.
|
109
|
-
|
110
|
-
* The --all option will force -T and -D to consider all the tasks,
|
111
|
-
with and without descriptions.
|
112
|
-
|
113
|
-
=== Bug Fixes (in 0.9.3)
|
114
|
-
|
115
|
-
* Semi-colons in windows rakefile paths now work.
|
116
|
-
|
117
|
-
* Improved Control-C support when invoking multiple test suites.
|
118
|
-
|
119
|
-
* egrep method now reads files in text mode (better support for
|
120
|
-
Windows)
|
121
|
-
|
122
|
-
* Better deprecation line number reporting.
|
123
|
-
|
124
|
-
* The -W option now works with all tasks, whether they have a
|
125
|
-
description or not.
|
126
|
-
|
127
|
-
* File globs in rake should not be sorted alphabetically, independent
|
128
|
-
of file system and platform.
|
129
|
-
|
130
|
-
* Numerous internal improvements.
|
131
|
-
|
132
|
-
* Documentation typos and fixes.
|
133
|
-
|
134
|
-
=== Bug Fixes (in 0.9.4)
|
135
|
-
|
136
|
-
* Exit status with failing tests is not correctly set to non-zero.
|
137
|
-
|
138
|
-
* Simplified syntax for phony task (for older versions of RDoc).
|
139
|
-
|
140
|
-
* Stand alone FileList usage gets glob function (without loading in
|
141
|
-
extra dependencies)
|
142
|
-
|
143
|
-
=== Bug Fixes (in 0.9.5)
|
5
|
+
=== Bug Fixes
|
144
6
|
|
145
7
|
* --trace and --backtrace no longer swallow following task names.
|
146
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== Changes in Version 10.1
|
4
4
|
|
5
|
-
|
5
|
+
=== New Features
|
6
6
|
|
7
7
|
* Add support for variable length task argument lists. If more actual
|
8
8
|
arguments are supplied than named arguments, then the extra
|
@@ -12,7 +12,7 @@ Here are new features in this version of Rake:
|
|
12
12
|
"rake" was hardcoded, now rake-based applications can display their
|
13
13
|
own names).
|
14
14
|
|
15
|
-
=== Bug Fixes
|
15
|
+
=== Bug Fixes
|
16
16
|
|
17
17
|
Bug fixes include:
|
18
18
|
|
data/lib/rake.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#--
|
2
|
-
|
3
2
|
# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
|
4
3
|
#
|
5
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -21,9 +20,14 @@
|
|
21
20
|
# IN THE SOFTWARE.
|
22
21
|
#++
|
23
22
|
|
23
|
+
module Rake
|
24
|
+
VERSION = '10.2.0'
|
25
|
+
end
|
26
|
+
|
24
27
|
require 'rake/version'
|
25
28
|
|
26
29
|
# :stopdoc:
|
30
|
+
# TODO: Remove in Rake 11
|
27
31
|
RAKEVERSION = Rake::VERSION
|
28
32
|
# :startdoc:
|
29
33
|
|
@@ -41,6 +45,7 @@ require 'rake/ext/time'
|
|
41
45
|
require 'rake/win32'
|
42
46
|
|
43
47
|
require 'rake/linked_list'
|
48
|
+
require 'rake/cpu_counter'
|
44
49
|
require 'rake/scope'
|
45
50
|
require 'rake/task_argument_error'
|
46
51
|
require 'rake/rule_recursion_overflow_error'
|
data/lib/rake/alt_system.rb
CHANGED
@@ -24,11 +24,13 @@
|
|
24
24
|
|
25
25
|
require 'rbconfig'
|
26
26
|
|
27
|
-
|
27
|
+
##
|
28
28
|
# Alternate implementations of system() and backticks `` on Windows
|
29
29
|
# for ruby-1.8 and earlier.
|
30
|
-
|
31
|
-
|
30
|
+
#--
|
31
|
+
# TODO: Remove in Rake 11
|
32
|
+
|
33
|
+
module Rake::AltSystem # :nodoc: all
|
32
34
|
WINDOWS = RbConfig::CONFIG["host_os"] =~
|
33
35
|
%r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
|
34
36
|
|
data/lib/rake/application.rb
CHANGED
@@ -12,10 +12,10 @@ module Rake
|
|
12
12
|
|
13
13
|
CommandLineOptionError = Class.new(StandardError)
|
14
14
|
|
15
|
-
|
15
|
+
##
|
16
16
|
# Rake main application object. When invoking +rake+ from the
|
17
17
|
# command line, a Rake::Application object is created and run.
|
18
|
-
|
18
|
+
|
19
19
|
class Application
|
20
20
|
include TaskManager
|
21
21
|
include TraceOutput
|
@@ -84,7 +84,7 @@ module Rake
|
|
84
84
|
standard_exception_handling do
|
85
85
|
@name = app_name
|
86
86
|
handle_options
|
87
|
-
|
87
|
+
collect_command_line_tasks
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -117,8 +117,8 @@ module Rake
|
|
117
117
|
thread_pool.join
|
118
118
|
if options.job_stats
|
119
119
|
stats = thread_pool.statistics
|
120
|
-
puts "Maximum active threads: #{stats[:max_active_threads]}"
|
121
|
-
puts "Total threads in play: #{stats[:total_threads_in_play]}"
|
120
|
+
puts "Maximum active threads: #{stats[:max_active_threads]} + main"
|
121
|
+
puts "Total threads in play: #{stats[:total_threads_in_play]} + main"
|
122
122
|
end
|
123
123
|
ThreadHistoryDisplay.new(thread_pool.history).show if
|
124
124
|
options.job_stats == :history
|
@@ -138,30 +138,38 @@ module Rake
|
|
138
138
|
|
139
139
|
# Return the thread pool used for multithreaded processing.
|
140
140
|
def thread_pool # :nodoc:
|
141
|
-
@thread_pool ||= ThreadPool.new(options.thread_pool_size ||
|
141
|
+
@thread_pool ||= ThreadPool.new(options.thread_pool_size || Rake.suggested_thread_count-1)
|
142
142
|
end
|
143
143
|
|
144
|
-
#
|
144
|
+
# internal ----------------------------------------------------------------
|
145
145
|
|
146
|
-
|
146
|
+
# Invokes a task with arguments that are extracted from +task_string+
|
147
|
+
def invoke_task(task_string) # :nodoc:
|
147
148
|
name, args = parse_task_string(task_string)
|
148
149
|
t = self[name]
|
149
150
|
t.invoke(*args)
|
150
151
|
end
|
151
152
|
|
152
|
-
def parse_task_string(string)
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
153
|
+
def parse_task_string(string) # :nodoc:
|
154
|
+
/^(?<name>[^\[]+)(\[(?<remaining_args>.*)\])$/ =~ string
|
155
|
+
|
156
|
+
return string, [] unless name
|
157
|
+
return name, [] if remaining_args.empty?
|
158
|
+
|
159
|
+
args = []
|
160
|
+
|
161
|
+
begin
|
162
|
+
/((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
|
163
|
+
|
164
|
+
remaining_args = $2
|
165
|
+
args << $1.gsub(/\\(.)/, '\1')
|
166
|
+
end while remaining_args
|
167
|
+
|
168
|
+
return name, args
|
161
169
|
end
|
162
170
|
|
163
171
|
# Provide standard exception handling for the given block.
|
164
|
-
def standard_exception_handling
|
172
|
+
def standard_exception_handling # :nodoc:
|
165
173
|
yield
|
166
174
|
rescue SystemExit
|
167
175
|
# Exit silently with current status
|
@@ -177,22 +185,43 @@ module Rake
|
|
177
185
|
|
178
186
|
# Exit the program because of an unhandle exception.
|
179
187
|
# (may be overridden by subclasses)
|
180
|
-
def exit_because_of_exception(ex)
|
188
|
+
def exit_because_of_exception(ex) # :nodoc:
|
181
189
|
exit(false)
|
182
190
|
end
|
183
191
|
|
184
192
|
# Display the error message that caused the exception.
|
185
|
-
def display_error_message(ex)
|
193
|
+
def display_error_message(ex) # :nodoc:
|
186
194
|
trace "#{name} aborted!"
|
187
|
-
|
195
|
+
display_exception_details(ex)
|
196
|
+
trace "Tasks: #{ex.chain}" if has_chain?(ex)
|
197
|
+
trace "(See full trace by running task with --trace)" unless
|
198
|
+
options.backtrace
|
199
|
+
end
|
200
|
+
|
201
|
+
def display_exception_details(ex) # :nodoc:
|
202
|
+
display_exception_message_details(ex)
|
203
|
+
display_exception_backtrace(ex)
|
204
|
+
display_exception_details(ex.cause) if has_cause?(ex)
|
205
|
+
end
|
206
|
+
|
207
|
+
def has_cause?(ex) # :nodoc:
|
208
|
+
ex.respond_to?(:cause) && ex.cause
|
209
|
+
end
|
210
|
+
|
211
|
+
def display_exception_message_details(ex) # :nodoc:
|
212
|
+
if ex.instance_of?(RuntimeError)
|
213
|
+
trace ex.message
|
214
|
+
else
|
215
|
+
trace "#{ex.class.name}: #{ex.message}"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def display_exception_backtrace(ex) # :nodoc:
|
188
220
|
if options.backtrace
|
189
221
|
trace ex.backtrace.join("\n")
|
190
222
|
else
|
191
223
|
trace Backtrace.collapse(ex.backtrace).join("\n")
|
192
224
|
end
|
193
|
-
trace "Tasks: #{ex.chain}" if has_chain?(ex)
|
194
|
-
trace "(See full trace by running task with --trace)" unless
|
195
|
-
options.backtrace
|
196
225
|
end
|
197
226
|
|
198
227
|
# Warn about deprecated usage.
|
@@ -200,7 +229,7 @@ module Rake
|
|
200
229
|
# Example:
|
201
230
|
# Rake.application.deprecate("import", "Rake.import", caller.first)
|
202
231
|
#
|
203
|
-
def deprecate(old_usage, new_usage, call_site)
|
232
|
+
def deprecate(old_usage, new_usage, call_site) # :nodoc:
|
204
233
|
unless options.ignore_deprecate
|
205
234
|
$stderr.puts "WARNING: '#{old_usage}' is deprecated. " +
|
206
235
|
"Please use '#{new_usage}' instead.\n" +
|
@@ -209,14 +238,14 @@ module Rake
|
|
209
238
|
end
|
210
239
|
|
211
240
|
# Does the exception have a task invocation chain?
|
212
|
-
def has_chain?(exception)
|
241
|
+
def has_chain?(exception) # :nodoc:
|
213
242
|
exception.respond_to?(:chain) && exception.chain
|
214
243
|
end
|
215
244
|
private :has_chain?
|
216
245
|
|
217
246
|
# True if one of the files in RAKEFILES is in the current directory.
|
218
247
|
# If a match is found, it is copied into @rakefile.
|
219
|
-
def have_rakefile
|
248
|
+
def have_rakefile # :nodoc:
|
220
249
|
@rakefiles.each do |fn|
|
221
250
|
if File.exist?(fn)
|
222
251
|
others = FileList.glob(fn, File::FNM_CASEFOLD)
|
@@ -229,23 +258,23 @@ module Rake
|
|
229
258
|
end
|
230
259
|
|
231
260
|
# True if we are outputting to TTY, false otherwise
|
232
|
-
def tty_output?
|
261
|
+
def tty_output? # :nodoc:
|
233
262
|
@tty_output
|
234
263
|
end
|
235
264
|
|
236
265
|
# Override the detected TTY output state (mostly for testing)
|
237
|
-
def tty_output=(tty_output_state)
|
266
|
+
def tty_output=(tty_output_state) # :nodoc:
|
238
267
|
@tty_output = tty_output_state
|
239
268
|
end
|
240
269
|
|
241
270
|
# We will truncate output if we are outputting to a TTY or if we've been
|
242
271
|
# given an explicit column width to honor
|
243
|
-
def truncate_output?
|
272
|
+
def truncate_output? # :nodoc:
|
244
273
|
tty_output? || @terminal_columns.nonzero?
|
245
274
|
end
|
246
275
|
|
247
276
|
# Display the tasks and comments.
|
248
|
-
def display_tasks_and_comments
|
277
|
+
def display_tasks_and_comments # :nodoc:
|
249
278
|
displayable_tasks = tasks.select { |t|
|
250
279
|
(options.show_all_tasks || t.comment) &&
|
251
280
|
t.name =~ options.show_task_pattern
|
@@ -284,7 +313,7 @@ module Rake
|
|
284
313
|
end
|
285
314
|
end
|
286
315
|
|
287
|
-
def terminal_width
|
316
|
+
def terminal_width # :nodoc:
|
288
317
|
if @terminal_columns.nonzero?
|
289
318
|
result = @terminal_columns
|
290
319
|
else
|
@@ -296,28 +325,28 @@ module Rake
|
|
296
325
|
end
|
297
326
|
|
298
327
|
# Calculate the dynamic width of the
|
299
|
-
def dynamic_width
|
328
|
+
def dynamic_width # :nodoc:
|
300
329
|
@dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput)
|
301
330
|
end
|
302
331
|
|
303
|
-
def dynamic_width_stty
|
332
|
+
def dynamic_width_stty # :nodoc:
|
304
333
|
%x{stty size 2>/dev/null}.split[1].to_i
|
305
334
|
end
|
306
335
|
|
307
|
-
def dynamic_width_tput
|
336
|
+
def dynamic_width_tput # :nodoc:
|
308
337
|
%x{tput cols 2>/dev/null}.to_i
|
309
338
|
end
|
310
339
|
|
311
|
-
def unix?
|
340
|
+
def unix? # :nodoc:
|
312
341
|
RbConfig::CONFIG['host_os'] =~
|
313
342
|
/(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
|
314
343
|
end
|
315
344
|
|
316
|
-
def windows?
|
345
|
+
def windows? # :nodoc:
|
317
346
|
Win32.windows?
|
318
347
|
end
|
319
348
|
|
320
|
-
def truncate(string, width)
|
349
|
+
def truncate(string, width) # :nodoc:
|
321
350
|
if string.nil?
|
322
351
|
""
|
323
352
|
elsif string.length <= width
|
@@ -328,19 +357,19 @@ module Rake
|
|
328
357
|
end
|
329
358
|
|
330
359
|
# Display the tasks and prerequisites
|
331
|
-
def display_prerequisites
|
360
|
+
def display_prerequisites # :nodoc:
|
332
361
|
tasks.each do |t|
|
333
362
|
puts "#{name} #{t.name}"
|
334
363
|
t.prerequisites.each { |pre| puts " #{pre}" }
|
335
364
|
end
|
336
365
|
end
|
337
366
|
|
338
|
-
def trace(*strings)
|
367
|
+
def trace(*strings) # :nodoc:
|
339
368
|
options.trace_output ||= $stderr
|
340
369
|
trace_on(options.trace_output, *strings)
|
341
370
|
end
|
342
371
|
|
343
|
-
def sort_options(options)
|
372
|
+
def sort_options(options) # :nodoc:
|
344
373
|
options.sort_by { |opt|
|
345
374
|
opt.select { |o| o =~ /^-/ }.map { |o| o.downcase }.sort.reverse
|
346
375
|
}
|
@@ -349,11 +378,11 @@ module Rake
|
|
349
378
|
|
350
379
|
# A list of all the standard options used in rake, suitable for
|
351
380
|
# passing to OptionParser.
|
352
|
-
def standard_rake_options
|
381
|
+
def standard_rake_options # :nodoc:
|
353
382
|
sort_options(
|
354
383
|
[
|
355
384
|
['--all', '-A',
|
356
|
-
"Show all tasks, even uncommented ones",
|
385
|
+
"Show all tasks, even uncommented ones (in combination with -T or -D)",
|
357
386
|
lambda { |value|
|
358
387
|
options.show_all_tasks = value
|
359
388
|
}
|
@@ -407,9 +436,17 @@ module Rake
|
|
407
436
|
],
|
408
437
|
['--jobs', '-j [NUMBER]',
|
409
438
|
"Specifies the maximum number of tasks to execute in parallel. " +
|
410
|
-
"(default is
|
439
|
+
"(default is number of CPU cores + 4)",
|
411
440
|
lambda { |value|
|
412
|
-
|
441
|
+
if value.nil? || value == ''
|
442
|
+
value = FIXNUM_MAX
|
443
|
+
elsif value =~ /^\d+$/
|
444
|
+
value = value.to_i
|
445
|
+
else
|
446
|
+
value = Rake.suggested_thread_count
|
447
|
+
end
|
448
|
+
value = 1 if value < 1
|
449
|
+
options.thread_pool_size = value - 1
|
413
450
|
}
|
414
451
|
],
|
415
452
|
['--job-stats [LEVEL]',
|
@@ -443,8 +480,8 @@ module Rake
|
|
443
480
|
"Do not log messages to standard output.",
|
444
481
|
lambda { |value| Rake.verbose(false) }
|
445
482
|
],
|
446
|
-
['--rakefile', '-f [
|
447
|
-
"Use
|
483
|
+
['--rakefile', '-f [FILENAME]',
|
484
|
+
"Use FILENAME as the rakefile to search for.",
|
448
485
|
lambda { |value|
|
449
486
|
value ||= ''
|
450
487
|
@rakefiles.clear
|
@@ -545,14 +582,14 @@ module Rake
|
|
545
582
|
])
|
546
583
|
end
|
547
584
|
|
548
|
-
def select_tasks_to_show(options, show_tasks, value)
|
585
|
+
def select_tasks_to_show(options, show_tasks, value) # :nodoc:
|
549
586
|
options.show_tasks = show_tasks
|
550
587
|
options.show_task_pattern = Regexp.new(value || '')
|
551
588
|
Rake::TaskManager.record_task_metadata = true
|
552
589
|
end
|
553
590
|
private :select_tasks_to_show
|
554
591
|
|
555
|
-
def select_trace_output(options, trace_option, value)
|
592
|
+
def select_trace_output(options, trace_option, value) # :nodoc:
|
556
593
|
value = value.strip unless value.nil?
|
557
594
|
case value
|
558
595
|
when 'stdout'
|
@@ -567,7 +604,7 @@ module Rake
|
|
567
604
|
private :select_trace_output
|
568
605
|
|
569
606
|
# Read and handle the command line options.
|
570
|
-
def handle_options
|
607
|
+
def handle_options # :nodoc:
|
571
608
|
options.rakelib = ['rakelib']
|
572
609
|
options.trace_output = $stderr
|
573
610
|
|
@@ -588,7 +625,7 @@ module Rake
|
|
588
625
|
|
589
626
|
# Similar to the regular Ruby +require+ command, but will check
|
590
627
|
# for *.rake files in addition to *.rb files.
|
591
|
-
def rake_require(file_name, paths=$LOAD_PATH, loaded=$")
|
628
|
+
def rake_require(file_name, paths=$LOAD_PATH, loaded=$") # :nodoc:
|
592
629
|
fn = file_name + ".rake"
|
593
630
|
return false if loaded.include?(fn)
|
594
631
|
paths.each do |path|
|
@@ -602,7 +639,7 @@ module Rake
|
|
602
639
|
fail LoadError, "Can't find #{file_name}"
|
603
640
|
end
|
604
641
|
|
605
|
-
def find_rakefile_location
|
642
|
+
def find_rakefile_location # :nodoc:
|
606
643
|
here = Dir.pwd
|
607
644
|
until (fn = have_rakefile)
|
608
645
|
Dir.chdir("..")
|
@@ -614,7 +651,7 @@ module Rake
|
|
614
651
|
Dir.chdir(Rake.original_dir)
|
615
652
|
end
|
616
653
|
|
617
|
-
def print_rakefile_directory(location)
|
654
|
+
def print_rakefile_directory(location) # :nodoc:
|
618
655
|
$stderr.puts "(in #{Dir.pwd})" unless
|
619
656
|
options.silent or original_dir == location
|
620
657
|
end
|
@@ -645,13 +682,13 @@ module Rake
|
|
645
682
|
load_imports
|
646
683
|
end
|
647
684
|
|
648
|
-
def glob(path, &block)
|
685
|
+
def glob(path, &block) # :nodoc:
|
649
686
|
FileList.glob(path.gsub("\\", '/')).each(&block)
|
650
687
|
end
|
651
688
|
private :glob
|
652
689
|
|
653
690
|
# The directory path containing the system wide rakefiles.
|
654
|
-
def system_dir
|
691
|
+
def system_dir # :nodoc:
|
655
692
|
@system_dir ||=
|
656
693
|
begin
|
657
694
|
if ENV['RAKE_SYSTEM']
|
@@ -677,7 +714,7 @@ module Rake
|
|
677
714
|
# Collect the list of tasks on the command line. If no tasks are
|
678
715
|
# given, return a list containing only the default task.
|
679
716
|
# Environmental assignments are processed at this time as well.
|
680
|
-
def
|
717
|
+
def collect_command_line_tasks # :nodoc:
|
681
718
|
@top_level_tasks = []
|
682
719
|
ARGV.each do |arg|
|
683
720
|
if arg =~ /^(\w+)=(.*)$/m
|
@@ -691,28 +728,33 @@ module Rake
|
|
691
728
|
|
692
729
|
# Default task name ("default").
|
693
730
|
# (May be overridden by subclasses)
|
694
|
-
def default_task_name
|
731
|
+
def default_task_name # :nodoc:
|
695
732
|
"default"
|
696
733
|
end
|
697
734
|
|
698
735
|
# Add a file to the list of files to be imported.
|
699
|
-
def add_import(fn)
|
736
|
+
def add_import(fn) # :nodoc:
|
700
737
|
@pending_imports << fn
|
701
738
|
end
|
702
739
|
|
703
740
|
# Load the pending list of imported files.
|
704
|
-
def load_imports
|
741
|
+
def load_imports # :nodoc:
|
705
742
|
while fn = @pending_imports.shift
|
706
743
|
next if @imported.member?(fn)
|
707
744
|
fn_task = lookup(fn) and fn_task.invoke
|
708
745
|
ext = File.extname(fn)
|
709
746
|
loader = @loaders[ext] || @default_loader
|
710
747
|
loader.load(fn)
|
748
|
+
if fn_task = lookup(fn) and fn_task.needed?
|
749
|
+
fn_task.reenable
|
750
|
+
fn_task.invoke
|
751
|
+
loader.load(fn)
|
752
|
+
end
|
711
753
|
@imported << fn
|
712
754
|
end
|
713
755
|
end
|
714
756
|
|
715
|
-
def rakefile_location(backtrace=caller)
|
757
|
+
def rakefile_location(backtrace=caller) # :nodoc:
|
716
758
|
backtrace.map { |t| t[/([^:]+):/, 1] }
|
717
759
|
|
718
760
|
re = /^#{@rakefile}$/
|