rake 0.8.1 → 0.8.2

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.

data/CHANGES CHANGED
@@ -1,5 +1,62 @@
1
+
1
2
  = Rake Changelog
2
3
 
4
+ == Version 0.8.2
5
+
6
+ * Fixed bug in package task so that it will include the subdir
7
+ directory in the package for testing. (Bug found by Adam Majer)
8
+
9
+ * Added ENV var to rakefile to prevent OS X from including extended
10
+ attribute junk in a tar file. (Bug found by Adam Majer)
11
+
12
+ * Fixed filename dependency order bug in test_inspect_pending and
13
+ test_to_s_pending. (Bug found by Adam Majer)
14
+
15
+ * Fixed check for file utils options to make them immune to the
16
+ symbol/string differences. (Patch supplied by Edwin Pratomo)
17
+
18
+ * Fixed bug with rules involving multiple source (Patch supplied by
19
+ Emanuel Inderm�hle)
20
+
21
+ * Switched from getoptlong to optparse (patches supplied by Edwin
22
+ Pratomo)
23
+
24
+ * The -T option will now attempt to dynamically sense the size of the
25
+ terminal. RAKE_COLUMNS will override any dynamic sensing.
26
+
27
+ * FileList#clone and FileList#dup have better sematics w.r.t. taint
28
+ and freeze.
29
+
30
+ * Added ability clear prerequisites, and/or actions from an existing
31
+ task.
32
+
33
+ * Added the ability to reenable a task to be invoked a second time.
34
+
35
+ * Changed RDoc test task to have no default template. This makes it
36
+ easier for the tempate to pick up the template from the environment.
37
+
38
+ * Changed from using Mutex to Monitor. Evidently Mutex causes thread
39
+ join errors when Ruby is compiled with -disable-pthreads. (Patch
40
+ supplied by Ittay Dror)
41
+
42
+ * Fixed bug in makefile parser that had problems with extra spaces in
43
+ file task names. (Patch supplied by Ittay Dror)
44
+
45
+ * Added a performance patch for reading large makefile dependency
46
+ files. (Patch supplied by Ittay Dror)
47
+
48
+ * Default values for task arguments can easily be specified with the
49
+ :with_defaults method. (Idea for default argument merging supplied
50
+ by (Adam Q. Salter)
51
+
52
+ * The -T output will only self-truncate if the output is a tty.
53
+ However, if RAKE_COLUMNS is explicitly set, it will be honored in
54
+ any case. (Patch provided by Gavin Stark).
55
+
56
+ * Numerous fixes for running under windows. A big thanks to Bheeshmar
57
+ Redheendran for spending a good part of the afternoon at the
58
+ Lonestar Ruby Conference to help me work out these issues.
59
+
3
60
  == Version 0.8.1
4
61
 
5
62
  * Removed requires on parsedate.rb (in Ftptools)
@@ -9,7 +66,6 @@
9
66
 
10
67
  * Added task parameters (e.g. "rake build[version7]")
11
68
  * Made task parameters passable to prerequisites.
12
- * The 'desc' command will now document task argument names.
13
69
  * Comments are limited to 80 columns or so (suggested by Jamis Buck).
14
70
  * Added -D to display full comments (suggested by Jamis Buck).
15
71
  * The rake program will set the status value used in any explicit
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  = RAKE -- Ruby Make
2
2
 
3
- Supporting Rake version: 0.7.x
3
+ Supporting Rake version: 0.8.3
4
4
 
5
5
  This package contains Rake, a simple ruby build program with
6
6
  capabilities similar to make.
@@ -13,20 +13,26 @@ Rake has the following features:
13
13
 
14
14
  * Users can specify tasks with prerequisites.
15
15
 
16
- * Rake supports rule patterns to sythesize implicit tasks.
16
+ * Rake supports rule patterns to synthesize implicit tasks.
17
17
 
18
18
  * Flexible FileLists that act like arrays but know about manipulating
19
19
  file names and paths.
20
20
 
21
21
  * A library of prepackaged tasks to make building rakefiles easier.
22
22
 
23
-
24
23
  == Download
25
24
 
26
25
  The latest version of rake can be found at
27
26
 
28
27
  * http://rubyforge.org/project/showfiles.php?group_id=50
29
28
 
29
+ == Source Repository
30
+
31
+ Rake is currently hosted at github. The github web page is
32
+ http://github.com/jimweirich/rake. The public git clone URL is
33
+
34
+ * git://github.com/jimweirich/rake.git
35
+
30
36
  == Installation
31
37
 
32
38
  === Normal Installation
@@ -47,6 +53,8 @@ Download and install rake with the following.
47
53
 
48
54
  If you wish to run the unit and functional tests that come with Rake:
49
55
 
56
+ * Install the 'session' gem in order to run the functional tests. adf
57
+ asdf asdf
50
58
  * CD into the top project directory of rake.
51
59
  * Type one of the following:
52
60
 
@@ -60,6 +68,8 @@ If you wish to run the unit and functional tests that come with Rake:
60
68
  * Rake Documentation Home: http://docs.rubyrake.org
61
69
  * Rake Project Page: http://rubyforge.org/projects/rake
62
70
  * Rake API Documents: http://rake.rubyforge.org
71
+ * Rake Source Code Repo: http://github.com/jimweirich/rake
72
+ * Rake Git Repo Clone URL: git://github.com/jimweirich/rake.git
63
73
 
64
74
  == Presentations and Articles about Rake
65
75
 
@@ -158,7 +168,7 @@ Options are:
158
168
  [<tt><em>name</em>=<em>value</em></tt>]
159
169
  Set the environment variable <em>name</em> to <em>value</em>
160
170
  during the execution of the <b>rake</b> command. You can access
161
- the value by using ENV['<em>name</em>'].
171
+ the value by using ENV['<em>name</em>'].
162
172
 
163
173
  [<tt>--classic-namespace</tt> (-n)]
164
174
  Import the Task, FileTask, and FileCreateTask into the top-level
@@ -167,10 +177,22 @@ Options are:
167
177
  'rake/classic_namespace'</code> in your Rakefile to get the
168
178
  classic behavior.
169
179
 
180
+ [<tt>--describe</tt> _pattern_ (-D)]
181
+ Describe the tasks (matching optional PATTERN), then exit.
182
+
170
183
  [<tt>--dry-run</tt> (-n)]
171
184
  Do a dry run. Print the tasks invoked and executed, but do not
172
185
  actually execute any of the actions.
173
186
 
187
+ [<tt>--execute</tt> _code_ (-e)]
188
+ Execute some Ruby code and exit.
189
+
190
+ [<tt>--execute-print</tt> _code_ (-p)]
191
+ Execute some Ruby code, print the result, and exit.
192
+
193
+ [<tt>--execute-continue</tt> _code_ (-p)]
194
+ Execute some Ruby code, then continue with normal task processing.
195
+
174
196
  [<tt>--help</tt> (-H)]
175
197
  Display some help text and exit.
176
198
 
@@ -187,22 +209,43 @@ Options are:
187
209
  Do not echo commands from FileUtils.
188
210
 
189
211
  [<tt>--rakefile</tt> _filename_ (-f)]
190
- Use _filename_ as the name of the rakefile. The default rakefile
212
+ Use _filename_ as the name of the rakefile. The default rakefile
191
213
  names are +rakefile+ and +Rakefile+ (with +rakefile+ taking
192
- precedence). If the rakefile is not found in the current
193
- directory, +rake+ will search parent directories for a match. The
214
+ precedence). If the rakefile is not found in the current
215
+ directory, +rake+ will search parent directories for a match. The
194
216
  directory where the Rakefile is found will become the current
195
217
  directory for the actions executed in the Rakefile.
196
218
 
219
+ [<tt>--rakelibdir</tt> _rakelibdir_ (-R)]
220
+ Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')
221
+
197
222
  [<tt>--require</tt> _name_ (-r)]
198
223
  Require _name_ before executing the Rakefile.
199
224
 
225
+ [<tt>--rules</tt>]
226
+ Trace the rules resolution.
227
+
228
+ [<tt>--silent (-s)]
229
+ Like --quiet, but also suppresses the 'in directory' announcement.
230
+
231
+ [<tt>--system</tt> (-g)]
232
+ Use the system wide (global) rakefiles. The project Rakefile is
233
+ ignored. By default, the system wide rakefiles are used only if no
234
+ project Rakefile is found. On Unix-like system, the system wide
235
+ rake files are located in $HOME/.rake. On a windows system they
236
+ are stored in $APPDATA/Rake.
237
+
238
+ [<tt>--no-system</tt> (-G)]
239
+ Use the project level Rakefile, ignoring the system-wide (global)
240
+ rakefiles.
241
+
200
242
  [<tt>--tasks</tt> (-T)]
201
243
  Display a list of the major tasks and their comments. Comments
202
244
  are defined using the "desc" command.
203
245
 
204
246
  [<tt>--trace</tt> (-t)]
205
- Turn on invoke/execute tracing. Also enable full backtrace on errors.
247
+ Turn on invoke/execute tracing. Also enable full backtrace on
248
+ errors.
206
249
 
207
250
  [<tt>--usage</tt> (-h)]
208
251
  Display a usage message and exit.
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ require 'rake/clean'
16
16
  require 'rake/testtask'
17
17
  require 'rake/rdoctask'
18
18
 
19
- CLEAN.include('**/*.o', '*.dot')
19
+ CLEAN.include('**/*.o', '*.dot', '**/.*.rbc')
20
20
  CLOBBER.include('doc/example/main', 'testdata')
21
21
  CLOBBER.include('test/data/**/temp_*')
22
22
  CLOBBER.include('test/data/chains/play.*')
@@ -25,6 +25,9 @@ CLOBBER.include('test/data/file_creation_task/src')
25
25
  CLOBBER.include('TAGS')
26
26
  CLOBBER.include('coverage', 'rcov_aggregate')
27
27
 
28
+ # Prevent OS X from including extended attribute junk in the tar output
29
+ ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
30
+
28
31
  def announce(msg='')
29
32
  STDERR.puts msg
30
33
  end
@@ -92,9 +95,13 @@ begin
92
95
 
93
96
  Rcov::RcovTask.new do |t|
94
97
  t.libs << "test"
98
+ dot_rakes =
95
99
  t.rcov_opts = [
96
- '-xRakefile', '-xrakefile', '-xpublish.rf', '--text-report',
97
- ]
100
+ '-xRakefile', '-xrakefile', '-xpublish.rf',
101
+ '-xlib/rake/contrib', '-x/Library',
102
+ '--text-report',
103
+ '--sort coverage'
104
+ ] + FileList['rakelib/*.rake'].pathmap("-x%p")
98
105
  t.test_files = FileList[
99
106
  'test/test*.rb', 'test/functional.rb'
100
107
  ]
@@ -148,6 +155,7 @@ PKG_FILES = FileList[
148
155
  'test/**/*.rf',
149
156
  'test/**/*.mf',
150
157
  'test/**/Rakefile',
158
+ 'test/**/subdir',
151
159
  'doc/**/*'
152
160
  ]
153
161
  PKG_FILES.exclude('doc/example/*.o')
@@ -156,7 +164,7 @@ PKG_FILES.exclude(%r{doc/example/main$})
156
164
  if ! defined?(Gem)
157
165
  puts "Package Target requires RubyGEMs"
158
166
  else
159
- spec = Gem::Specification.new do |s|
167
+ SPEC = Gem::Specification.new do |s|
160
168
 
161
169
  #### Basic information.
162
170
 
@@ -207,10 +215,18 @@ else
207
215
  # end
208
216
  end
209
217
 
210
- package_task = Rake::GemPackageTask.new(spec) do |pkg|
218
+ package_task = Rake::GemPackageTask.new(SPEC) do |pkg|
211
219
  pkg.need_zip = true
212
220
  pkg.need_tar = true
213
221
  end
222
+
223
+ file "rake.gemspec" => ["Rakefile", "lib/rake.rb"] do |t|
224
+ require 'yaml'
225
+ open(t.name, "w") { |f| f.puts SPEC.to_yaml }
226
+ end
227
+
228
+ desc "Create a stand-alone gemspec"
229
+ task :gemspec => "rake.gemspec"
214
230
  end
215
231
 
216
232
  # Misc tasks =========================================================
data/bin/rake CHANGED
File without changes
@@ -1,4 +1,4 @@
1
- = Rakefile Format
1
+ = Rakefile Format (as of version 0.8.2)
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
@@ -150,6 +150,131 @@ to do extra synchronization for Rake's benefit. However, if there are
150
150
  user data structures shared between the parallel prerequisites, the
151
151
  user must do whatever is necessary to prevent race conditions.
152
152
 
153
+ == Tasks with Arguments
154
+
155
+ Prior to version 0.8.0, rake was only able to handle command line
156
+ arguments of the form NAME=VALUE that were passed into Rake via the
157
+ ENV hash. Many folks had asked for some kind of simple command line
158
+ arguments, perhaps using "--" to separate regular task names from
159
+ argument values on the command line. The problem is that there was no
160
+ easy way to associate positional arguments on the command line with
161
+ different tasks. Suppose both tasks :a and :b expect a command line
162
+ argument: does the first value go with :a? What if :b is run first?
163
+ Should it then get the first command line argument.
164
+
165
+ Rake 0.8.0 solves this problem by explicitly passing values directly
166
+ to the tasks that need them. For example, if I had a release task
167
+ that required a version number, I could say:
168
+
169
+ rake release[0.8.2]
170
+
171
+ And the string "0.8.2" will be passed to the :release task. Multiple
172
+ arguments can be passed by separating them with a comma, for example:
173
+
174
+ rake name[john,doe]
175
+
176
+ Just a few words of caution. The rake task name and its arguments
177
+ need to be a single command line argument to rake. This generally
178
+ means no spaces. If spaces are needed, then the entire rake +
179
+ argument string should be quoted. Something like this:
180
+
181
+ rake "name[billy bob, smith]"
182
+
183
+ (Quoting rules vary between operating systems and shells, so make sure
184
+ you consult the proper docs for your OS/shell).
185
+
186
+ === Tasks that Expect Parameters
187
+
188
+ Parameters are only given to tasks that are setup to expect them. In
189
+ order to handle named parameters, the task declaration syntax for
190
+ tasks has been extended slightly.
191
+
192
+ For example, a task that needs a first name and last name might be
193
+ declared as:
194
+
195
+ task :name, [:first_name, :last_name]
196
+
197
+ The first argument is still the name of the task (:name in this case).
198
+ The next to argumements are the names of the parameters expected by
199
+ :name in an array (:first_name and :last_name in the example).
200
+
201
+ To access the values of the paramters, the block defining the task
202
+ behaviour can now accept a second parameter:
203
+
204
+ task :name, [:first_name, :last_name] do |t, args|
205
+ puts "First name is #{args.first_name}"
206
+ puts "Last name is #{args.last_name}"
207
+ end
208
+
209
+ The first argument of the block "t" is always bound to the current
210
+ task object. The second argument "args" is an open-struct like object
211
+ that allows access to the task arguments. Extra command line
212
+ arguments to a task are ignored. Missing command line arguments are
213
+ given the nil value.
214
+
215
+ If you wish to specify default values for the arguments, you can use
216
+ the with_defaults method in the task body. Here is the above example
217
+ where we specify default values for the first and last names:
218
+
219
+ task :name, [:first_name, :last_name] do |t, args|
220
+ args.with_defaults(:first_name => "John", :last_name => "Dough")
221
+ puts "First name is #{args.first_name}"
222
+ puts "Last name is #{args.last_name}"
223
+ end
224
+
225
+ === Tasks that Expect Parameters and Have Prerequisites
226
+
227
+ Tasks that use parameters have a slightly different format for
228
+ prerequisites. Use the <tt>:needs</tt> keyword to specify the
229
+ prerequisites for tasks with arguments. For example:
230
+
231
+ task :name, [:first_name, :last_name] => [:pre_name] do |t, args|
232
+ args.with_defaults(:first_name => "John", :last_name => "Dough")
233
+ puts "First name is #{args.first_name}"
234
+ puts "Last name is #{args.last_name}"
235
+ end
236
+
237
+ === Deprecated Task Parameters Format
238
+
239
+ There is an older format for declaring task parameters that omitted
240
+ the task array and used the :needs keyword to introduce the
241
+ dependencies. That format is still supported for compatibility, but
242
+ is not recommended for use.
243
+
244
+ == Accessing Task Programatically
245
+
246
+ Sometimes it is useful to manipulate tasks programatically in a
247
+ Rakefile. To find a task object, use the <tt>:[]</tt> operator on the
248
+ <tt>Rake::Task</tt>.
249
+
250
+ === Programmatic Task Example
251
+
252
+ For example, the following Rakefile defines two tasks. The :doit task
253
+ simply prints a simple "DONE" message. The :dont class will lookup
254
+ the doit class and remove (clear) all of its prerequisites and
255
+ actions.
256
+
257
+ task :doit do
258
+ puts "DONE"
259
+ end
260
+
261
+ task :dont do
262
+ Rake::Task[:doit].clear
263
+ end
264
+
265
+ Running this example:
266
+
267
+ $ rake doit
268
+ (in /Users/jim/working/git/rake/x)
269
+ DONE
270
+ $ rake dont doit
271
+ (in /Users/jim/working/git/rake/x)
272
+ $
273
+
274
+ The ability to programmatically manipulate tasks gives rake very
275
+ powerful meta-programming capabilities w.r.t. task execution, but
276
+ should be used with cation.
277
+
153
278
  == Rules
154
279
 
155
280
  When a file is named as a prerequisite, but does not have a file task
@@ -372,8 +497,6 @@ Or give it a glob pattern:
372
497
 
373
498
  fl = FileList['*.rb']
374
499
 
375
-
376
-
377
500
  == Odds and Ends
378
501
 
379
502
  === do/end verses { }
File without changes
@@ -0,0 +1,114 @@
1
+ = Rake 0.8.0/0.8.1 Released
2
+
3
+ Rake version 0.8.0 is a new release of rake that includes serveral new
4
+ features.
5
+
6
+ == Changes
7
+
8
+ === New Features in Version 0.8.0
9
+
10
+ * Tasks can now receive command line parameters. See the examples
11
+ below for more details.
12
+
13
+ * Comments are limited to 80 columns on output, but full comments can
14
+ be seen by using the -D parameter. (feature suggested by Jamis
15
+ Buck).
16
+
17
+ * Explicit exit(n) calls will now set the exit status to n. (patch
18
+ provided by Stephen Touset).
19
+
20
+ * Rake is now compatible with Ruby 1.9.
21
+
22
+ Version 0.8.1 is a minor update that includes additional Ruby 1.9
23
+ compatibility fixes.
24
+
25
+ == What is Rake
26
+
27
+ Rake is a build tool similar to the make program in many ways. But
28
+ instead of cryptic make recipes, Rake uses standard Ruby code to
29
+ declare tasks and dependencies. You have the full power of a modern
30
+ scripting language built right into your build tool.
31
+
32
+ == Availability
33
+
34
+ The easiest way to get and install rake is via RubyGems ...
35
+
36
+ gem install rake (you may need root/admin privileges)
37
+
38
+ Otherwise, you can get it from the more traditional places:
39
+
40
+ Home Page:: http://rake.rubyforge.org/
41
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
42
+
43
+ == Task Argument Examples
44
+
45
+ Prior to version 0.8.0, rake was only able to handle command line
46
+ arguments of the form NAME=VALUE that were passed into Rake via the
47
+ ENV hash. Many folks had asked for some kind of simple command line
48
+ arguments, perhaps using "--" to separate regular task names from
49
+ argument values on the command line. The problem is that there was no
50
+ easy way to associate positional arguments on the command line with
51
+ different tasks. Suppose both tasks :a and :b expect a command line
52
+ argument: does the first value go with :a? What if :b is run first?
53
+ Should it then get the first command line argument.
54
+
55
+ Rake 0.8.0 solves this problem by explicitly passing values directly
56
+ to the tasks that need them. For example, if I had a release task
57
+ that required a version number, I could say:
58
+
59
+ rake release[0.8.0]
60
+
61
+ And the string "0.8.0" will be passed to the :release task. Multiple
62
+ arguments can be passed by separating them with a comma, for example:
63
+
64
+ rake name[john,doe]
65
+
66
+ Just a few words of caution. The rake task name and its arguments
67
+ need to be a single command line argument to rake. This generally
68
+ means no spaces. If spaces are needed, then the entire rake +
69
+ argument string should be quoted. Something like this:
70
+
71
+ rake "name[billy bob, smith]"
72
+
73
+ (Quoting rules vary between operating systems and shells, so make sure
74
+ you consult the proper docs for your OS/shell).
75
+
76
+ === Tasks that Expect Parameters
77
+
78
+ Parameters are only given to tasks that are setup to expect them. In
79
+ order to handle named parameters, the task declaration syntax for
80
+ tasks has been extended slightly.
81
+
82
+ For example, a task that needs a first name and last name might be
83
+ declared as:
84
+
85
+ task :name, :first_name, :last_name
86
+
87
+ The first argument is still the name of the task (:name in this case).
88
+ The next to argumements are the names of the parameters expected by
89
+ :name (:first_name and :last_name in the example).
90
+
91
+ To access the values of the paramters, the block defining the task
92
+ behaviour can now accept a second parameter:
93
+
94
+ task :name, :first_name, :last_name do |t, args|
95
+ puts "First name is #{args.first_name}"
96
+ puts "Last name is #{args.last_name}"
97
+ end
98
+
99
+ The first argument of the block "t" is always bound to the current
100
+ task object. The second argument "args" is an open-struct like object
101
+ that allows access to the task arguments. Extra command line
102
+ arguments to a task are ignored. Missing command line arguments are
103
+ given the nil value.
104
+
105
+ == Thanks
106
+
107
+ As usual, it was input from users that drove a alot of these changes. The
108
+ following people either contributed patches, made suggestions or made
109
+ otherwise helpful comments. Thanks to ...
110
+
111
+ * Jamis Buck (for comment formatting suggestions)
112
+ * Stephen Touset (for exit status patch).
113
+
114
+ -- Jim Weirich