rake 0.9.2 → 13.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.rdoc +43 -0
  3. data/Gemfile +10 -0
  4. data/History.rdoc +2386 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.rdoc +64 -109
  7. data/Rakefile +22 -386
  8. data/bin/bundle +105 -0
  9. data/bin/console +7 -0
  10. data/bin/rake +20 -23
  11. data/bin/rdoc +29 -0
  12. data/bin/rubocop +29 -0
  13. data/bin/setup +6 -0
  14. data/doc/command_line_usage.rdoc +65 -21
  15. data/doc/glossary.rdoc +40 -49
  16. data/doc/jamis.rb +1 -0
  17. data/doc/rake.1 +156 -0
  18. data/doc/rakefile.rdoc +127 -62
  19. data/exe/rake +27 -0
  20. data/lib/rake.rb +37 -31
  21. data/lib/rake/application.rb +507 -272
  22. data/lib/rake/backtrace.rb +24 -0
  23. data/lib/rake/clean.rb +55 -8
  24. data/lib/rake/cloneable.rb +11 -19
  25. data/lib/rake/cpu_counter.rb +107 -0
  26. data/lib/rake/default_loader.rb +5 -0
  27. data/lib/rake/dsl_definition.rb +74 -46
  28. data/lib/rake/early_time.rb +5 -1
  29. data/lib/rake/ext/core.rb +5 -6
  30. data/lib/rake/ext/string.rb +61 -52
  31. data/lib/rake/file_creation_task.rb +4 -3
  32. data/lib/rake/file_list.rb +81 -49
  33. data/lib/rake/file_task.rb +15 -8
  34. data/lib/rake/file_utils.rb +69 -47
  35. data/lib/rake/file_utils_ext.rb +18 -26
  36. data/lib/rake/invocation_chain.rb +25 -19
  37. data/lib/rake/invocation_exception_mixin.rb +1 -0
  38. data/lib/rake/late_time.rb +18 -0
  39. data/lib/rake/linked_list.rb +112 -0
  40. data/lib/rake/loaders/makefile.rb +23 -9
  41. data/lib/rake/multi_task.rb +4 -6
  42. data/lib/rake/name_space.rb +36 -23
  43. data/lib/rake/packagetask.rb +71 -34
  44. data/lib/rake/phony.rb +16 -0
  45. data/lib/rake/private_reader.rb +21 -0
  46. data/lib/rake/promise.rb +100 -0
  47. data/lib/rake/pseudo_status.rb +8 -2
  48. data/lib/rake/rake_module.rb +41 -3
  49. data/lib/rake/rake_test_loader.rb +21 -7
  50. data/lib/rake/rule_recursion_overflow_error.rb +2 -2
  51. data/lib/rake/scope.rb +43 -0
  52. data/lib/rake/task.rb +186 -79
  53. data/lib/rake/task_argument_error.rb +1 -0
  54. data/lib/rake/task_arguments.rb +50 -15
  55. data/lib/rake/task_manager.rb +89 -65
  56. data/lib/rake/tasklib.rb +2 -12
  57. data/lib/rake/testtask.rb +61 -63
  58. data/lib/rake/thread_history_display.rb +49 -0
  59. data/lib/rake/thread_pool.rb +163 -0
  60. data/lib/rake/trace_output.rb +23 -0
  61. data/lib/rake/version.rb +7 -7
  62. data/lib/rake/win32.rb +14 -18
  63. data/rake.gemspec +43 -0
  64. metadata +82 -221
  65. data/.gemtest +0 -0
  66. data/CHANGES +0 -509
  67. data/RRR +0 -9
  68. data/TODO +0 -20
  69. data/doc/rake.1.gz +0 -0
  70. data/doc/release_notes/rake-0.4.14.rdoc +0 -23
  71. data/doc/release_notes/rake-0.4.15.rdoc +0 -35
  72. data/doc/release_notes/rake-0.5.0.rdoc +0 -53
  73. data/doc/release_notes/rake-0.5.3.rdoc +0 -78
  74. data/doc/release_notes/rake-0.5.4.rdoc +0 -46
  75. data/doc/release_notes/rake-0.6.0.rdoc +0 -141
  76. data/doc/release_notes/rake-0.7.0.rdoc +0 -119
  77. data/doc/release_notes/rake-0.7.1.rdoc +0 -59
  78. data/doc/release_notes/rake-0.7.2.rdoc +0 -121
  79. data/doc/release_notes/rake-0.7.3.rdoc +0 -47
  80. data/doc/release_notes/rake-0.8.0.rdoc +0 -114
  81. data/doc/release_notes/rake-0.8.2.rdoc +0 -165
  82. data/doc/release_notes/rake-0.8.3.rdoc +0 -112
  83. data/doc/release_notes/rake-0.8.4.rdoc +0 -147
  84. data/doc/release_notes/rake-0.8.5.rdoc +0 -53
  85. data/doc/release_notes/rake-0.8.6.rdoc +0 -55
  86. data/doc/release_notes/rake-0.8.7.rdoc +0 -55
  87. data/doc/release_notes/rake-0.9.0.rdoc +0 -112
  88. data/doc/release_notes/rake-0.9.1.rdoc +0 -52
  89. data/doc/release_notes/rake-0.9.2.rdoc +0 -49
  90. data/install.rb +0 -90
  91. data/lib/rake/alt_system.rb +0 -109
  92. data/lib/rake/classic_namespace.rb +0 -9
  93. data/lib/rake/contrib/compositepublisher.rb +0 -21
  94. data/lib/rake/contrib/ftptools.rb +0 -150
  95. data/lib/rake/contrib/publisher.rb +0 -69
  96. data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
  97. data/lib/rake/contrib/sshpublisher.rb +0 -45
  98. data/lib/rake/contrib/sys.rb +0 -191
  99. data/lib/rake/ext/module.rb +0 -39
  100. data/lib/rake/ext/time.rb +0 -14
  101. data/lib/rake/gempackagetask.rb +0 -13
  102. data/lib/rake/pathmap.rb +0 -1
  103. data/lib/rake/rdoctask.rb +0 -230
  104. data/lib/rake/ruby182_test_unit_fix.rb +0 -25
  105. data/lib/rake/runtest.rb +0 -21
  106. data/test/check_expansion.rb +0 -5
  107. data/test/check_no_expansion.rb +0 -5
  108. data/test/data/access/Rakefile +0 -35
  109. data/test/data/chains/Rakefile +0 -15
  110. data/test/data/comments/Rakefile +0 -18
  111. data/test/data/default/Rakefile +0 -17
  112. data/test/data/deprecated_import/Rakefile +0 -1
  113. data/test/data/dryrun/Rakefile +0 -22
  114. data/test/data/extra/Rakefile +0 -1
  115. data/test/data/file_creation_task/Rakefile +0 -31
  116. data/test/data/imports/Rakefile +0 -19
  117. data/test/data/imports/deps.mf +0 -1
  118. data/test/data/multidesc/Rakefile +0 -15
  119. data/test/data/namespace/Rakefile +0 -64
  120. data/test/data/rakelib/test1.rb +0 -4
  121. data/test/data/rbext/rakefile.rb +0 -3
  122. data/test/data/sample.mf +0 -14
  123. data/test/data/statusreturn/Rakefile +0 -6
  124. data/test/data/unittest/Rakefile +0 -1
  125. data/test/data/verbose/Rakefile +0 -34
  126. data/test/file_creation.rb +0 -34
  127. data/test/helper.rb +0 -44
  128. data/test/in_environment.rb +0 -35
  129. data/test/reqfile.rb +0 -3
  130. data/test/reqfile2.rb +0 -3
  131. data/test/shellcommand.rb +0 -3
  132. data/test/test_rake.rb +0 -38
  133. data/test/test_rake_application.rb +0 -364
  134. data/test/test_rake_application_options.rb +0 -382
  135. data/test/test_rake_clean.rb +0 -12
  136. data/test/test_rake_definitions.rb +0 -80
  137. data/test/test_rake_directory_task.rb +0 -55
  138. data/test/test_rake_dsl.rb +0 -73
  139. data/test/test_rake_early_time.rb +0 -31
  140. data/test/test_rake_extension.rb +0 -59
  141. data/test/test_rake_file_creation_task.rb +0 -62
  142. data/test/test_rake_file_list.rb +0 -633
  143. data/test/test_rake_file_list_path_map.rb +0 -8
  144. data/test/test_rake_file_task.rb +0 -104
  145. data/test/test_rake_file_utils.rb +0 -252
  146. data/test/test_rake_ftp_file.rb +0 -59
  147. data/test/test_rake_functional.rb +0 -468
  148. data/test/test_rake_invocation_chain.rb +0 -52
  149. data/test/test_rake_makefile_loader.rb +0 -23
  150. data/test/test_rake_multi_task.rb +0 -51
  151. data/test/test_rake_name_space.rb +0 -43
  152. data/test/test_rake_package_task.rb +0 -78
  153. data/test/test_rake_path_map.rb +0 -157
  154. data/test/test_rake_path_map_explode.rb +0 -31
  155. data/test/test_rake_path_map_partial.rb +0 -18
  156. data/test/test_rake_pseudo_status.rb +0 -20
  157. data/test/test_rake_rdoc_task.rb +0 -81
  158. data/test/test_rake_require.rb +0 -35
  159. data/test/test_rake_rules.rb +0 -346
  160. data/test/test_rake_task.rb +0 -271
  161. data/test/test_rake_task_argument_parsing.rb +0 -116
  162. data/test/test_rake_task_arguments.rb +0 -86
  163. data/test/test_rake_task_lib.rb +0 -9
  164. data/test/test_rake_task_manager.rb +0 -145
  165. data/test/test_rake_task_manager_argument_resolution.rb +0 -36
  166. data/test/test_rake_task_with_arguments.rb +0 -162
  167. data/test/test_rake_test_task.rb +0 -122
  168. data/test/test_rake_top_level_functions.rb +0 -76
  169. data/test/test_rake_win32.rb +0 -83
  170. data/test/test_sys.rb +0 -20
data/doc/jamis.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module RDoc
2
3
  module Page
3
4
 
data/doc/rake.1 ADDED
@@ -0,0 +1,156 @@
1
+ .Dd June 12, 2016
2
+ .Dt RAKE 1
3
+ .Os rake 11.2.2
4
+ .Sh NAME
5
+ .Nm rake
6
+ .Nd make-like build utility for Ruby
7
+ .Sh SYNOPSIS
8
+ .Nm
9
+ .Op Fl f Ar rakefile
10
+ .Op Ar options
11
+ .Ar targets ...
12
+ .Sh DESCRIPTION
13
+ .Nm
14
+ is a
15
+ .Xr make 1 Ns -like
16
+ build utility for Ruby.
17
+ Tasks and dependencies are specified in standard Ruby syntax.
18
+ .Sh OPTIONS
19
+ .Bl -tag -width Ds
20
+ .It Fl m , Fl -multitask
21
+ Treat all tasks as multitasks.
22
+ .It Fl B , Fl -build-all
23
+ Build all prerequisites, including those which are up\-to\-date.
24
+ .It Fl j , Fl -jobs Ar num_jobs
25
+ Specifies the maximum number of tasks to execute in parallel (default is number of CPU cores + 4).
26
+ .El
27
+ .Ss Modules
28
+ .Bl -tag -width Ds
29
+ .It Fl I , Fl -libdir Ar libdir
30
+ Include
31
+ .Ar libdir
32
+ in the search path for required modules.
33
+ .It Fl r , Fl -require Ar module
34
+ Require
35
+ .Ar module
36
+ before executing
37
+ .Pa rakefile .
38
+ .El
39
+ .Ss Rakefile location
40
+ .Bl -tag -width Ds
41
+ .It Fl f , Fl -rakefile Ar filename
42
+ Use
43
+ .Ar filename
44
+ as the rakefile to search for.
45
+ .It Fl N , Fl -no-search , Fl -nosearch
46
+ Do not search parent directories for the Rakefile.
47
+ .It Fl G , Fl -no-system , Fl -nosystem
48
+ Use standard project Rakefile search paths, ignore system wide rakefiles.
49
+ .It Fl R , Fl -rakelib Ar rakelibdir , Fl -rakelibdir Ar rakelibdir
50
+ Auto-import any .rake files in
51
+ .Ar rakelibdir
52
+ (default is
53
+ .Sq rakelib )
54
+ .It Fl g , Fl -system
55
+ Use system-wide (global) rakefiles (usually
56
+ .Pa ~/.rake/*.rake ) .
57
+ .El
58
+ .Ss Debugging
59
+ .Bl -tag -width Ds
60
+ .It Fl -backtrace Ns = Ns Ar out
61
+ Enable full backtrace.
62
+ .Ar out
63
+ can be
64
+ .Dv stderr
65
+ (default) or
66
+ .Dv stdout .
67
+ .It Fl t , Fl -trace Ns = Ns Ar out
68
+ Turn on invoke/execute tracing, enable full backtrace.
69
+ .Ar out
70
+ can be
71
+ .Dv stderr
72
+ (default) or
73
+ .Dv stdout .
74
+ .It Fl -suppress-backtrace Ar pattern
75
+ Suppress backtrace lines matching regexp
76
+ .Ar pattern .
77
+ Ignored if
78
+ .Fl -trace
79
+ is on.
80
+ .It Fl -rules
81
+ Trace the rules resolution.
82
+ .It Fl n , Fl -dry-run
83
+ Do a dry run without executing actions.
84
+ .It Fl T , Fl -tasks Op Ar pattern
85
+ Display the tasks (matching optional
86
+ .Ar pattern )
87
+ with descriptions, then exit.
88
+ .It Fl D , Fl -describe Op Ar pattern
89
+ Describe the tasks (matching optional
90
+ .Ar pattern ) ,
91
+ then exit.
92
+ .It Fl W , Fl -where Op Ar pattern
93
+ Describe the tasks (matching optional
94
+ .Ar pattern ) ,
95
+ then exit.
96
+ .It Fl P , Fl -prereqs
97
+ Display the tasks and dependencies, then exit.
98
+ .It Fl e , Fl -execute Ar code
99
+ Execute some Ruby code and exit.
100
+ .It Fl p , Fl -execute-print Ar code
101
+ Execute some Ruby code, print the result, then exit.
102
+ .It Fl E , Fl -execute-continue Ar code
103
+ Execute some Ruby code, then continue with normal task processing.
104
+ .El
105
+ .Ss Information
106
+ .Bl -tag -width Ds
107
+ .It Fl v , Fl -verbose
108
+ Log message to standard output.
109
+ .It Fl q , Fl -quiet
110
+ Do not log messages to standard output.
111
+ .It Fl s , Fl -silent
112
+ Like
113
+ .Fl -quiet ,
114
+ but also suppresses the
115
+ .Sq in directory
116
+ announcement.
117
+ .It Fl X , Fl -no-deprecation-warnings
118
+ Disable the deprecation warnings.
119
+ .It Fl -comments
120
+ Show commented tasks only
121
+ .It Fl A , Fl -all
122
+ Show all tasks, even uncommented ones (in combination with
123
+ .Fl T
124
+ or
125
+ .Fl D )
126
+ .It Fl -job-stats Op Ar level
127
+ Display job statistics.
128
+ If
129
+ .Ar level
130
+ is
131
+ .Sq history ,
132
+ displays a complete job list.
133
+ .It Fl V , Fl -version
134
+ Display the program version.
135
+ .It Fl h , Fl H , Fl -help
136
+ Display a help message.
137
+ .El
138
+ .Sh SEE ALSO
139
+ The complete documentation for
140
+ .Nm rake
141
+ has been installed at
142
+ .Pa /usr/share/doc/rake-doc/html/index.html .
143
+ It is also available online at
144
+ .Lk https://ruby.github.io/rake .
145
+ .Sh AUTHORS
146
+ .An -nosplit
147
+ .Nm
148
+ was written by
149
+ .An Jim Weirich Aq Mt jim@weirichhouse.org .
150
+ .Pp
151
+ This manual was created by
152
+ .An Caitlin Matos Aq Mt caitlin.matos@zoho.com
153
+ for the Debian project (but may be used by others).
154
+ It was inspired by the manual by
155
+ .An Jani Monoses Aq Mt jani@iv.ro
156
+ for the Ubuntu project.
data/doc/rakefile.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = Rakefile Format (as of version 0.8.7)
1
+ = Rakefile Format
2
2
 
3
3
  First of all, there is no special format for a Rakefile. A Rakefile
4
4
  contains executable Ruby code. Anything legal in a ruby script is
@@ -30,9 +30,9 @@ parameter that is the name of the task.
30
30
  Any prerequisites are given as a list (enclosed in square brackets)
31
31
  following the name and an arrow (=>).
32
32
 
33
- task :name => [:prereq1, :prereq2]
33
+ task name: [:prereq1, :prereq2]
34
34
 
35
- <b>NOTE:</b> Although this syntax looks a little funky, it is legal
35
+ *NOTE:* Although this syntax looks a little funky, it is legal
36
36
  Ruby. We are constructing a hash where the key is :name and the value
37
37
  for that key is the list of prerequisites. It is equivalent to the
38
38
  following ...
@@ -41,13 +41,27 @@ following ...
41
41
  hash[:name] = [:prereq1, :prereq2]
42
42
  task(hash)
43
43
 
44
+ You can also use strings for task names and prerequisites, rake doesn't care.
45
+ This is the same task definition:
46
+
47
+ task 'name' => %w[prereq1 prereq2]
48
+
49
+ As is this:
50
+
51
+ task name: %w[prereq1 prereq2]
52
+
53
+ We'll prefer this style for regular tasks with prerequisites throughout the
54
+ rest of the document. Using an array of strings for the prerequisites means
55
+ you will need to make fewer changes if you need to move tasks into namespaces
56
+ or perform other refactorings.
57
+
44
58
  === Tasks with Actions
45
59
 
46
60
  Actions are defined by passing a block to the +task+ method. Any Ruby
47
61
  code can be placed in the block. The block may reference the task
48
62
  object via the block parameter.
49
63
 
50
- task :name => [:prereq1, :prereq2] do |t|
64
+ task name: [:prereq1, :prereq2] do |t|
51
65
  # actions (may reference t)
52
66
  end
53
67
 
@@ -62,8 +76,8 @@ For example, the following is equivalent to the single task
62
76
  specification given above.
63
77
 
64
78
  task :name
65
- task :name => [:prereq1]
66
- task :name => [:prereq2]
79
+ task name: :prereq1
80
+ task name: %w[prereq2]
67
81
  task :name do |t|
68
82
  # actions
69
83
  end
@@ -79,8 +93,8 @@ method). In addition, file tasks are usually named with a string
79
93
  rather than a symbol.
80
94
 
81
95
  The following file task creates a executable program (named +prog+)
82
- given two object files name <tt>a.o</tt> and <tt>b.o</tt>. The tasks
83
- for creating <tt>a.o</tt> and <tt>b.o</tt> are not shown.
96
+ given two object files named +a.o+ and +b.o+. The tasks
97
+ for creating +a.o+ and +b.o+ are not shown.
84
98
 
85
99
  file "prog" => ["a.o", "b.o"] do |t|
86
100
  sh "cc -o #{t.name} #{t.prerequisites.join(' ')}"
@@ -97,9 +111,9 @@ that creates the directory. For example, the following declaration
97
111
 
98
112
  is equivalent to ...
99
113
 
100
- file "testdata" do |t| mkdir t.name end
101
- file "testdata/examples" do |t| mkdir t.name end
102
- file "testdata/examples/doc" do |t| mkdir t.name end
114
+ file "testdata" do |t| mkdir t.name end
115
+ file "testdata/examples" => ["testdata"] do |t| mkdir t.name end
116
+ file "testdata/examples/doc" => ["testdata/examples"] do |t| mkdir t.name end
103
117
 
104
118
  The +directory+ method does not accept prerequisites or actions, but
105
119
  both prerequisites and actions can be added later. For example ...
@@ -114,7 +128,7 @@ both prerequisites and actions can be added later. For example ...
114
128
 
115
129
  Rake allows parallel execution of prerequisites using the following syntax:
116
130
 
117
- multitask :copy_files => [:copy_src, :copy_doc, :copy_bin] do
131
+ multitask copy_files: %w[copy_src copy_doc copy_bin] do
118
132
  puts "All Copies Complete"
119
133
  end
120
134
 
@@ -133,9 +147,9 @@ until the common prerequisites have been run.
133
147
  For example, if the <tt>copy_<em>xxx</em></tt> tasks have the
134
148
  following prerequisites:
135
149
 
136
- task :copy_src => [:prep_for_copy]
137
- task :copy_bin => [:prep_for_copy]
138
- task :copy_doc => [:prep_for_copy]
150
+ task copy_src: :prep_for_copy
151
+ task copy_bin: :prep_for_copy
152
+ task copy_doc: :prep_for_copy
139
153
 
140
154
  Then the +prep_for_copy+ task is run before starting all the copies in
141
155
  parallel. Once +prep_for_copy+ is complete, +copy_src+, +copy_bin+,
@@ -175,7 +189,7 @@ arguments can be passed by separating them with a comma, for example:
175
189
 
176
190
  Just a few words of caution. The rake task name and its arguments
177
191
  need to be a single command line argument to rake. This generally
178
- means no spaces. If spaces are needed, then the entire rake +
192
+ means no spaces. If spaces are needed, then the entire name +
179
193
  argument string should be quoted. Something like this:
180
194
 
181
195
  rake "name[billy bob, smith]"
@@ -183,22 +197,6 @@ argument string should be quoted. Something like this:
183
197
  (Quoting rules vary between operating systems and shells, so make sure
184
198
  you consult the proper docs for your OS/shell).
185
199
 
186
- === Tasks Arguments and the Environment
187
-
188
- Task argument values can also be picked up from the environment. For
189
- example, if the "release" task expected a parameter named
190
- "release_version", then either
191
-
192
- rake release[0.8.2]
193
-
194
- or
195
-
196
- RELEASE_VERSION rake release
197
-
198
- will work. Environment variable names must either match the task
199
- parameter exactly, or match an all-uppercase version of the task
200
- parameter.
201
-
202
200
  === Tasks that Expect Parameters
203
201
 
204
202
  Parameters are only given to tasks that are setup to expect them. In
@@ -225,9 +223,7 @@ behaviour can now accept a second parameter:
225
223
  The first argument of the block "t" is always bound to the current
226
224
  task object. The second argument "args" is an open-struct like object
227
225
  that allows access to the task arguments. Extra command line
228
- arguments to a task are ignored. Missing command line arguments are
229
- picked up from matching environment variables. If there are no
230
- matching environment variables, they are given the nil value.
226
+ arguments to a task are ignored.
231
227
 
232
228
  If you wish to specify default values for the arguments, you can use
233
229
  the with_defaults method in the task body. Here is the above example
@@ -251,6 +247,25 @@ for tasks with arguments. For example:
251
247
  puts "Last name is #{args.last_name}"
252
248
  end
253
249
 
250
+ === Tasks that take Variable-length Parameters
251
+
252
+ Tasks that need to handle a list of values as a parameter can use the
253
+ extras method of the args variable. This allows for tasks that can
254
+ loop over a variable number of values, and its compatible with named
255
+ parameters as well:
256
+
257
+ task :email, [:message] do |t, args|
258
+ mail = Mail.new(args.message)
259
+ recipients = args.extras
260
+ recipients.each do |target|
261
+ mail.send_to(target)
262
+ end
263
+ end
264
+
265
+ There is also the convenience method to_a that returns all parameters
266
+ in the sequential order they were given, including those associated
267
+ with named parameters.
268
+
254
269
  === Deprecated Task Parameters Format
255
270
 
256
271
  There is an older format for declaring task parameters that omitted
@@ -262,8 +277,7 @@ versions of rake.
262
277
  == Accessing Task Programmatically
263
278
 
264
279
  Sometimes it is useful to manipulate tasks programmatically in a
265
- Rakefile. To find a task object, use the <tt>:[]</tt> operator on the
266
- <tt>Rake::Task</tt>.
280
+ Rakefile. To find a task object use Rake::Task.[].
267
281
 
268
282
  === Programmatic Task Example
269
283
 
@@ -291,7 +305,7 @@ Running this example:
291
305
 
292
306
  The ability to programmatically manipulate tasks gives rake very
293
307
  powerful meta-programming capabilities w.r.t. task execution, but
294
- should be used with cation.
308
+ should be used with caution.
295
309
 
296
310
  == Rules
297
311
 
@@ -332,18 +346,18 @@ The following rule is equivalent to the example above.
332
346
  sh "cc #{t.source} -c -o #{t.name}"
333
347
  end
334
348
 
335
- <b>NOTE:</b> Because of a _quirk_ in Ruby syntax, parenthesis are
349
+ *NOTE:* Because of a _quirk_ in Ruby syntax, parenthesis are
336
350
  required on *rule* when the first argument is a regular expression.
337
351
 
338
352
  The following rule might be used for Java files ...
339
353
 
340
- rule '.java' => [
354
+ rule '.class' => [
341
355
  proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') }
342
356
  ] do |t|
343
357
  java_compile(t.source, t.name)
344
358
  end
345
359
 
346
- <b>NOTE:</b> +java_compile+ is a hypothetical method that invokes the
360
+ *NOTE:* +java_compile+ is a hypothetical method that invokes the
347
361
  java compiler.
348
362
 
349
363
  == Importing Dependencies
@@ -354,23 +368,18 @@ required file are just added to the definitions already accumulated.
354
368
 
355
369
  Because the files are loaded _before_ the rake targets are evaluated,
356
370
  the loaded files must be "ready to go" when the rake command is
357
- invoked. This make generated dependency files difficult to use. By
371
+ invoked. This makes generated dependency files difficult to use. By
358
372
  the time rake gets around to updating the dependencies file, it is too
359
373
  late to load it.
360
374
 
361
- The +Rake.import+ command addresses this by specifying a file to be
362
- loaded _after_ the main rakefile is loaded, but _before_ any targets
363
- on the command line are invoked. In addition, if the file name
364
- matches an explicit task, that task is invoked before loading the
365
- file. This allows dependency files to be generated and used in a
366
- single rake command invocation.
367
-
368
- <b>NOTE:</b> Starting in Rake version 0.9.0, the top level +import+
369
- command is deprecated and we recommend using the scoped
370
- "+Rake.import+" command mentioned above. Future versions of Rake will
371
- drop support for the top level +import+ command.
375
+ The +import+ command addresses this by specifying a file to be loaded
376
+ _after_ the main rakefile is loaded, but _before_ any targets on the
377
+ command line are invoked. In addition, if the file name matches an
378
+ explicit task, that task is invoked before loading the file. This
379
+ allows dependency files to be generated and used in a single rake
380
+ command invocation.
372
381
 
373
- === Example:
382
+ Example:
374
383
 
375
384
  require 'rake/loaders/makefile'
376
385
 
@@ -378,7 +387,7 @@ drop support for the top level +import+ command.
378
387
  sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
379
388
  end
380
389
 
381
- Rake.import ".depends.mf"
390
+ import ".depends.mf"
382
391
 
383
392
  If ".depends" does not exist, or is out of date w.r.t. the source
384
393
  files, a new ".depends" file is generated using +makedepend+ before
@@ -391,17 +400,17 @@ legal in Ruby source code, including comments for tasks and rules.
391
400
  However, if you wish a task to be described using the "-T" switch,
392
401
  then you need to use the +desc+ command to describe the task.
393
402
 
394
- === Example:
403
+ Example:
395
404
 
396
405
  desc "Create a distribution package"
397
- task :package => [ ... ] do ... end
406
+ task package: %w[ ... ] do ... end
398
407
 
399
408
  The "-T" switch (or "--tasks" if you like to spell things out) will
400
409
  display a list of tasks that have a description. If you use +desc+ to
401
410
  describe your major tasks, you have a semi-automatic way of generating
402
411
  a summary of your Rake file.
403
412
 
404
- traken$ rake -T
413
+ $ rake -T
405
414
  (in /home/.../rake)
406
415
  rake clean # Remove any temporary products.
407
416
  rake clobber # Remove any generated file.
@@ -426,8 +435,7 @@ common for task names to begin to clash. For example, if you might
426
435
  have a main program and a set of sample programs built by a single
427
436
  Rakefile. By placing the tasks related to the main program in one
428
437
  namespace, and the tasks for building the sample programs in a
429
- different namespace, the task names will not will not interfere with
430
- each other.
438
+ different namespace, the task names will not interfere with each other.
431
439
 
432
440
  For example:
433
441
 
@@ -443,12 +451,12 @@ For example:
443
451
  end
444
452
  end
445
453
 
446
- task :build => ["main:build", "samples:build"]
454
+ task build: %w[main:build samples:build]
447
455
 
448
456
  Referencing a task in a separate namespace can be achieved by
449
457
  prefixing the task name with the namespace and a colon
450
458
  (e.g. "main:build" refers to the :build task in the +main+ namespace).
451
- Nested namespaces are supported, so
459
+ Nested namespaces are supported.
452
460
 
453
461
  Note that the name given in the +task+ command is always the unadorned
454
462
  task name without any namespace prefixes. The +task+ command always
@@ -550,6 +558,63 @@ This is the proper way to specify the task ...
550
558
  # Actions go here
551
559
  end
552
560
 
561
+ == Rakefile Path
562
+
563
+ When issuing the +rake+ command in a terminal, Rake will look
564
+ for a Rakefile in the current directory. If a Rakefile is not found,
565
+ it will search parent directories until one is found.
566
+
567
+ For example, if a Rakefile resides in the +project/+ directory,
568
+ moving deeper into the project's directory tree will not have an adverse
569
+ effect on rake tasks:
570
+
571
+ $ pwd
572
+ /home/user/project
573
+
574
+ $ cd lib/foo/bar
575
+ $ pwd
576
+ /home/user/project/lib/foo/bar
577
+
578
+ $ rake run_pwd
579
+ /home/user/project
580
+
581
+ As far as rake is concerned, all tasks are run from the directory in
582
+ which the Rakefile resides.
583
+
584
+ === Multiple Rake Files
585
+
586
+ Not all tasks need to be included in a single Rakefile. Additional
587
+ rake files (with the file extension "+.rake+") may be placed in
588
+ +rakelib+ directory located at the top level of a project (i.e.
589
+ the same directory that contains the main +Rakefile+).
590
+
591
+ Also, rails projects may include additional rake files in the
592
+ +lib/tasks+ directory.
593
+
594
+ === Clean and Clobber Tasks
595
+
596
+ Through <tt>require 'rake/clean'</tt> Rake provides +clean+ and +clobber+
597
+ tasks:
598
+
599
+ +clean+ ::
600
+ Clean up the project by deleting scratch files and backup files. Add files
601
+ to the +CLEAN+ FileList to have the +clean+ target handle them.
602
+
603
+ +clobber+ ::
604
+ Clobber all generated and non-source files in a project. The task depends
605
+ on +clean+, so all the +CLEAN+ files will be deleted as well as files in the
606
+ +CLOBBER+ FileList. The intent of this task is to return a project to its
607
+ pristine, just unpacked state.
608
+
609
+ You can add file names or glob patterns to both the +CLEAN+ and +CLOBBER+
610
+ lists.
611
+
612
+ === Phony Task
613
+
614
+ The phony task can be used as a dependency to allow file-based tasks to use
615
+ non-file-based-tasks as prerequisites without forcing them to rebuild. You
616
+ can <tt>require 'rake/phony'</tt> to add the +phony+ task.
617
+
553
618
  ----
554
619
 
555
620
  == See