greensock-rails 1.11.5.0 → 1.11.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/greensock/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/greensock/TimelineLite.js +6 -6
  4. data/vendor/assets/javascripts/greensock/TimelineMax.js +10 -10
  5. data/vendor/assets/javascripts/greensock/TweenLite.js +13 -10
  6. data/vendor/assets/javascripts/greensock/TweenMax.js +56 -31
  7. data/vendor/assets/javascripts/greensock/plugins/BezierPlugin.js +9 -3
  8. data/vendor/assets/javascripts/greensock/plugins/CSSPlugin.js +23 -10
  9. data/vendor/assets/javascripts/greensock/utils/Draggable.js +14 -4
  10. data/vendor/bundle/cache/rake-10.2.2.gem +0 -0
  11. data/vendor/bundle/gems/rake-10.2.2/doc/command_line_usage.rdoc +158 -0
  12. data/vendor/bundle/gems/rake-10.2.2/doc/example/Rakefile1 +38 -0
  13. data/vendor/bundle/gems/rake-10.2.2/doc/example/Rakefile2 +35 -0
  14. data/vendor/bundle/gems/rake-10.2.2/doc/example/a.c +6 -0
  15. data/vendor/bundle/gems/rake-10.2.2/doc/example/b.c +6 -0
  16. data/vendor/bundle/gems/rake-10.2.2/doc/example/main.c +11 -0
  17. data/vendor/bundle/gems/rake-10.2.2/doc/glossary.rdoc +51 -0
  18. data/vendor/bundle/gems/rake-10.2.2/doc/jamis.rb +591 -0
  19. data/vendor/bundle/gems/rake-10.2.2/doc/proto_rake.rdoc +127 -0
  20. data/vendor/bundle/gems/rake-10.2.2/doc/rake.1.gz +0 -0
  21. data/vendor/bundle/gems/rake-10.2.2/doc/rakefile.rdoc +653 -0
  22. data/vendor/bundle/gems/rake-10.2.2/doc/rational.rdoc +151 -0
  23. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
  24. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
  25. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
  26. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
  27. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
  28. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
  29. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
  30. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
  31. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
  32. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
  33. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
  34. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
  35. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
  36. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
  37. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
  38. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.8.6.rdoc +37 -0
  39. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
  40. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
  41. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
  42. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
  43. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
  44. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.3.rdoc +102 -0
  45. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.4.rdoc +60 -0
  46. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.5.rdoc +55 -0
  47. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-0.9.6.rdoc +64 -0
  48. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-10.0.0.rdoc +178 -0
  49. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-10.0.1.rdoc +58 -0
  50. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-10.0.2.rdoc +53 -0
  51. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-10.0.3.rdoc +191 -0
  52. data/vendor/bundle/gems/rake-10.2.2/doc/release_notes/rake-10.1.0.rdoc +61 -0
  53. data/vendor/cache/rake-10.2.2.gem +0 -0
  54. metadata +46 -2
@@ -0,0 +1,127 @@
1
+ = Original Prototype Rake
2
+
3
+ This is the original 100 line prototype rake program.
4
+
5
+ ---
6
+ #!/usr/bin/env ruby
7
+
8
+ require 'ftools'
9
+
10
+ class Task
11
+ TASKS = Hash.new
12
+
13
+ attr_reader :prerequisites
14
+
15
+ def initialize(task_name)
16
+ @name = task_name
17
+ @prerequisites = []
18
+ @actions = []
19
+ end
20
+
21
+ def enhance(deps=nil, &block)
22
+ @prerequisites |= deps if deps
23
+ @actions << block if block_given?
24
+ self
25
+ end
26
+
27
+ def name
28
+ @name.to_s
29
+ end
30
+
31
+ def invoke
32
+ @prerequisites.each { |n| Task[n].invoke }
33
+ execute if needed?
34
+ end
35
+
36
+ def execute
37
+ return if @triggered
38
+ @triggered = true
39
+ @actions.collect { |act| result = act.call(self) }.last
40
+ end
41
+
42
+ def needed?
43
+ true
44
+ end
45
+
46
+ def timestamp
47
+ Time.now
48
+ end
49
+
50
+ class << self
51
+ def [](task_name)
52
+ TASKS[intern(task_name)] or fail "Don't know how to rake #{task_name}"
53
+ end
54
+
55
+ def define_task(args, &block)
56
+ case args
57
+ when Hash
58
+ fail "Too Many Target Names: #{args.keys.join(' ')}" if args.size > 1
59
+ fail "No Task Name Given" if args.size < 1
60
+ task_name = args.keys[0]
61
+ deps = args[task_name]
62
+ else
63
+ task_name = args
64
+ deps = []
65
+ end
66
+ deps = deps.collect {|d| intern(d) }
67
+ get(task_name).enhance(deps, &block)
68
+ end
69
+
70
+ def get(task_name)
71
+ name = intern(task_name)
72
+ TASKS[name] ||= self.new(name)
73
+ end
74
+
75
+ def intern(task_name)
76
+ (Symbol === task_name) ? task_name : task_name.intern
77
+ end
78
+ end
79
+ end
80
+
81
+ class FileTask < Task
82
+ def needed?
83
+ return true unless File.exist?(name)
84
+ latest_prereq = @prerequisites.collect{|n| Task[n].timestamp}.max
85
+ return false if latest_prereq.nil?
86
+ timestamp < latest_prereq
87
+ end
88
+
89
+ def timestamp
90
+ File.new(name.to_s).mtime
91
+ end
92
+ end
93
+
94
+ def task(args, &block)
95
+ Task.define_task(args, &block)
96
+ end
97
+
98
+ def file(args, &block)
99
+ FileTask.define_task(args, &block)
100
+ end
101
+
102
+ def sys(cmd)
103
+ puts cmd
104
+ system(cmd) or fail "Command Failed: [#{cmd}]"
105
+ end
106
+
107
+ def rake
108
+ begin
109
+ here = Dir.pwd
110
+ while ! File.exist?("Rakefile")
111
+ Dir.chdir("..")
112
+ fail "No Rakefile found" if Dir.pwd == here
113
+ here = Dir.pwd
114
+ end
115
+ puts "(in #{Dir.pwd})"
116
+ load "./Rakefile"
117
+ ARGV.push("default") if ARGV.size == 0
118
+ ARGV.each { |task_name| Task[task_name].invoke }
119
+ rescue Exception => ex
120
+ puts "rake aborted ... #{ex.message}"
121
+ puts ex.backtrace.find {|str| str =~ /Rakefile/ } || ""
122
+ end
123
+ end
124
+
125
+ if __FILE__ == $0 then
126
+ rake
127
+ end
@@ -0,0 +1,653 @@
1
+ = Rakefile Format
2
+
3
+ First of all, there is no special format for a Rakefile. A Rakefile
4
+ contains executable Ruby code. Anything legal in a ruby script is
5
+ allowed in a Rakefile.
6
+
7
+ Now that we understand there is no special syntax in a Rakefile, there
8
+ are some conventions that are used in a Rakefile that are a little
9
+ unusual in a typical Ruby program. Since a Rakefile is tailored to
10
+ specifying tasks and actions, the idioms used in a Rakefile are
11
+ designed to support that.
12
+
13
+ So, what goes into a Rakefile?
14
+
15
+ == Tasks
16
+
17
+ Tasks are the main unit of work in a Rakefile. Tasks have a name
18
+ (usually given as a symbol or a string), a list of prerequisites (more
19
+ symbols or strings) and a list of actions (given as a block).
20
+
21
+ === Simple Tasks
22
+
23
+ A task is declared by using the +task+ method. +task+ takes a single
24
+ parameter that is the name of the task.
25
+
26
+ task :name
27
+
28
+ === Tasks with Prerequisites
29
+
30
+ Any prerequisites are given as a list (enclosed in square brackets)
31
+ following the name and an arrow (=>).
32
+
33
+ task name: [:prereq1, :prereq2]
34
+
35
+ *NOTE:* Although this syntax looks a little funky, it is legal
36
+ Ruby. We are constructing a hash where the key is :name and the value
37
+ for that key is the list of prerequisites. It is equivalent to the
38
+ following ...
39
+
40
+ hash = Hash.new
41
+ hash[:name] = [:prereq1, :prereq2]
42
+ task(hash)
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
+
58
+ === Tasks with Actions
59
+
60
+ Actions are defined by passing a block to the +task+ method. Any Ruby
61
+ code can be placed in the block. The block may reference the task
62
+ object via the block parameter.
63
+
64
+ task name: [:prereq1, :prereq2] do |t|
65
+ # actions (may reference t)
66
+ end
67
+
68
+ === Multiple Definitions
69
+
70
+ A task may be specified more than once. Each specification adds its
71
+ prerequisites and actions to the existing definition. This allows one
72
+ part of a rakefile to specify the actions and a different rakefile
73
+ (perhaps separately generated) to specify the dependencies.
74
+
75
+ For example, the following is equivalent to the single task
76
+ specification given above.
77
+
78
+ task :name
79
+ task name: :prereq1
80
+ task name: %w[prereq2]
81
+ task :name do |t|
82
+ # actions
83
+ end
84
+
85
+ == File Tasks
86
+
87
+ Some tasks are designed to create a file from one or more other files.
88
+ Tasks that generate these files may be skipped if the file already
89
+ exists. File tasks are used to specify file creation tasks.
90
+
91
+ File tasks are declared using the +file+ method (instead of the +task+
92
+ method). In addition, file tasks are usually named with a string
93
+ rather than a symbol.
94
+
95
+ The following file task creates a executable program (named +prog+)
96
+ given two object files named +a.o+ and +b.o+. The tasks
97
+ for creating +a.o+ and +b.o+ are not shown.
98
+
99
+ file "prog" => ["a.o", "b.o"] do |t|
100
+ sh "cc -o #{t.name} #{t.prerequisites.join(' ')}"
101
+ end
102
+
103
+ == Directory Tasks
104
+
105
+ It is common to need to create directories upon demand. The
106
+ +directory+ convenience method is a short-hand for creating a FileTask
107
+ that creates the directory. For example, the following declaration
108
+ ...
109
+
110
+ directory "testdata/examples/doc"
111
+
112
+ is equivalent to ...
113
+
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
117
+
118
+ The +directory+ method does not accept prerequisites or actions, but
119
+ both prerequisites and actions can be added later. For example ...
120
+
121
+ directory "testdata"
122
+ file "testdata" => ["otherdata"]
123
+ file "testdata" do
124
+ cp Dir["standard_data/*.data"], "testdata"
125
+ end
126
+
127
+ == Tasks with Parallel Prerequisites
128
+
129
+ Rake allows parallel execution of prerequisites using the following syntax:
130
+
131
+ multitask copy_files: %w[copy_src copy_doc copy_bin] do
132
+ puts "All Copies Complete"
133
+ end
134
+
135
+ In this example, +copy_files+ is a normal rake task. Its actions are
136
+ executed whenever all of its prerequisites are done. The big
137
+ difference is that the prerequisites (+copy_src+, +copy_bin+ and
138
+ +copy_doc+) are executed in parallel. Each of the prerequisites are
139
+ run in their own Ruby thread, possibly allowing faster overall runtime.
140
+
141
+ === Secondary Prerequisites
142
+
143
+ If any of the primary prerequisites of a multitask have common secondary
144
+ prerequisites, all of the primary/parallel prerequisites will wait
145
+ until the common prerequisites have been run.
146
+
147
+ For example, if the <tt>copy_<em>xxx</em></tt> tasks have the
148
+ following prerequisites:
149
+
150
+ task copy_src: :prep_for_copy
151
+ task copy_bin: :prep_for_copy
152
+ task copy_doc: :prep_for_copy
153
+
154
+ Then the +prep_for_copy+ task is run before starting all the copies in
155
+ parallel. Once +prep_for_copy+ is complete, +copy_src+, +copy_bin+,
156
+ and +copy_doc+ are all run in parallel. Note that +prep_for_copy+ is
157
+ run only once, even though it is referenced in multiple threads.
158
+
159
+ === Thread Safety
160
+
161
+ The Rake internal data structures are thread-safe with respect
162
+ to the multitask parallel execution, so there is no need for the user
163
+ to do extra synchronization for Rake's benefit. However, if there are
164
+ user data structures shared between the parallel prerequisites, the
165
+ user must do whatever is necessary to prevent race conditions.
166
+
167
+ == Tasks with Arguments
168
+
169
+ Prior to version 0.8.0, rake was only able to handle command line
170
+ arguments of the form NAME=VALUE that were passed into Rake via the
171
+ ENV hash. Many folks had asked for some kind of simple command line
172
+ arguments, perhaps using "--" to separate regular task names from
173
+ argument values on the command line. The problem is that there was no
174
+ easy way to associate positional arguments on the command line with
175
+ different tasks. Suppose both tasks :a and :b expect a command line
176
+ argument: does the first value go with :a? What if :b is run first?
177
+ Should it then get the first command line argument.
178
+
179
+ Rake 0.8.0 solves this problem by explicitly passing values directly
180
+ to the tasks that need them. For example, if I had a release task
181
+ that required a version number, I could say:
182
+
183
+ rake release[0.8.2]
184
+
185
+ And the string "0.8.2" will be passed to the :release task. Multiple
186
+ arguments can be passed by separating them with a comma, for example:
187
+
188
+ rake name[john,doe]
189
+
190
+ Just a few words of caution. The rake task name and its arguments
191
+ need to be a single command line argument to rake. This generally
192
+ means no spaces. If spaces are needed, then the entire name +
193
+ argument string should be quoted. Something like this:
194
+
195
+ rake "name[billy bob, smith]"
196
+
197
+ (Quoting rules vary between operating systems and shells, so make sure
198
+ you consult the proper docs for your OS/shell).
199
+
200
+ === Task Arguments and the Environment
201
+
202
+ Task argument values can also be picked up from the environment. For
203
+ example, if the "release" task expected a parameter named
204
+ "release_version", then either
205
+
206
+ rake release[0.8.2]
207
+
208
+ or
209
+
210
+ RELEASE_VERSION=0.8.2 rake release
211
+
212
+ or, alternatively
213
+
214
+ rake release RELEASE_VERSION=0.8.2
215
+
216
+ will work. Environment variable names must either match the task
217
+ parameter exactly, or match an all-uppercase version of the task
218
+ parameter.
219
+
220
+ *NOTE:* A variable declared within a rake command will
221
+ not persist in the environment:
222
+
223
+ $ export VALUE=old
224
+ $ rake print_value VALUE=new
225
+ new
226
+ $ rake print_value
227
+ old
228
+
229
+ === Tasks that Expect Parameters
230
+
231
+ Parameters are only given to tasks that are setup to expect them. In
232
+ order to handle named parameters, the task declaration syntax for
233
+ tasks has been extended slightly.
234
+
235
+ For example, a task that needs a first name and last name might be
236
+ declared as:
237
+
238
+ task :name, [:first_name, :last_name]
239
+
240
+ The first argument is still the name of the task (:name in this case).
241
+ The next two arguments are the names of the parameters expected by
242
+ :name in an array (:first_name and :last_name in the example).
243
+
244
+ To access the values of the parameters, the block defining the task
245
+ behaviour can now accept a second parameter:
246
+
247
+ task :name, [:first_name, :last_name] do |t, args|
248
+ puts "First name is #{args.first_name}"
249
+ puts "Last name is #{args.last_name}"
250
+ end
251
+
252
+ The first argument of the block "t" is always bound to the current
253
+ task object. The second argument "args" is an open-struct like object
254
+ that allows access to the task arguments. Extra command line
255
+ arguments to a task are ignored. Missing command line arguments are
256
+ picked up from matching environment variables. If there are no
257
+ matching environment variables, they are given the nil value.
258
+
259
+ If you wish to specify default values for the arguments, you can use
260
+ the with_defaults method in the task body. Here is the above example
261
+ where we specify default values for the first and last names:
262
+
263
+ task :name, [:first_name, :last_name] do |t, args|
264
+ args.with_defaults(:first_name => "John", :last_name => "Dough")
265
+ puts "First name is #{args.first_name}"
266
+ puts "Last name is #{args.last_name}"
267
+ end
268
+
269
+ === Tasks that Expect Parameters and Have Prerequisites
270
+
271
+ Tasks that use parameters have a slightly different format for
272
+ prerequisites. Use the arrow notation to indicate the prerequisites
273
+ for tasks with arguments. For example:
274
+
275
+ task :name, [:first_name, :last_name] => [:pre_name] do |t, args|
276
+ args.with_defaults(:first_name => "John", :last_name => "Dough")
277
+ puts "First name is #{args.first_name}"
278
+ puts "Last name is #{args.last_name}"
279
+ end
280
+
281
+ === Tasks that take Variable-length Parameters
282
+
283
+ Tasks that need to handle a list of values as a parameter can use the
284
+ extras method of the args variable. This allows for tasks that can
285
+ loop over a variable number of values, and its compatible with named
286
+ parameters as well:
287
+
288
+ task :email, [:message] do |t, args|
289
+ mail = Mail.new(args.message)
290
+ recipients = args.extras
291
+ recipients.each do |target|
292
+ mail.send_to(target)
293
+ end
294
+ end
295
+
296
+ There is also the convenience method to_a that returns all parameters
297
+ in the sequential order they were given, including those associated
298
+ with named parameters.
299
+
300
+ === Deprecated Task Parameters Format
301
+
302
+ There is an older format for declaring task parameters that omitted
303
+ the task argument array and used the :needs keyword to introduce the
304
+ dependencies. That format is still supported for compatibility, but
305
+ is not recommended for use. The older format may be dropped in future
306
+ versions of rake.
307
+
308
+ == Accessing Task Programmatically
309
+
310
+ Sometimes it is useful to manipulate tasks programmatically in a
311
+ Rakefile. To find a task object use Rake::Task.[].
312
+
313
+ === Programmatic Task Example
314
+
315
+ For example, the following Rakefile defines two tasks. The :doit task
316
+ simply prints a simple "DONE" message. The :dont class will lookup
317
+ the doit class and remove (clear) all of its prerequisites and
318
+ actions.
319
+
320
+ task :doit do
321
+ puts "DONE"
322
+ end
323
+
324
+ task :dont do
325
+ Rake::Task[:doit].clear
326
+ end
327
+
328
+ Running this example:
329
+
330
+ $ rake doit
331
+ (in /Users/jim/working/git/rake/x)
332
+ DONE
333
+ $ rake dont doit
334
+ (in /Users/jim/working/git/rake/x)
335
+ $
336
+
337
+ The ability to programmatically manipulate tasks gives rake very
338
+ powerful meta-programming capabilities w.r.t. task execution, but
339
+ should be used with caution.
340
+
341
+ == Rules
342
+
343
+ When a file is named as a prerequisite, but does not have a file task
344
+ defined for it, Rake will attempt to synthesize a task by looking at a
345
+ list of rules supplied in the Rakefile.
346
+
347
+ Suppose we were trying to invoke task "mycode.o", but no task is
348
+ defined for it. But the rakefile has a rule that look like this ...
349
+
350
+ rule '.o' => ['.c'] do |t|
351
+ sh "cc #{t.source} -c -o #{t.name}"
352
+ end
353
+
354
+ This rule will synthesize any task that ends in ".o". It has a
355
+ prerequisite a source file with an extension of ".c" must exist. If
356
+ Rake is able to find a file named "mycode.c", it will automatically
357
+ create a task that builds "mycode.o" from "mycode.c".
358
+
359
+ If the file "mycode.c" does not exist, rake will attempt
360
+ to recursively synthesize a rule for it.
361
+
362
+ When a task is synthesized from a rule, the +source+ attribute of the
363
+ task is set to the matching source file. This allows us to write
364
+ rules with actions that reference the source file.
365
+
366
+ === Advanced Rules
367
+
368
+ Any regular expression may be used as the rule pattern. Additionally,
369
+ a proc may be used to calculate the name of the source file. This
370
+ allows for complex patterns and sources.
371
+
372
+ The following rule is equivalent to the example above.
373
+
374
+ rule( /\.o$/ => [
375
+ proc {|task_name| task_name.sub(/\.[^.]+$/, '.c') }
376
+ ]) do |t|
377
+ sh "cc #{t.source} -c -o #{t.name}"
378
+ end
379
+
380
+ *NOTE:* Because of a _quirk_ in Ruby syntax, parenthesis are
381
+ required on *rule* when the first argument is a regular expression.
382
+
383
+ The following rule might be used for Java files ...
384
+
385
+ rule '.class' => [
386
+ proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') }
387
+ ] do |t|
388
+ java_compile(t.source, t.name)
389
+ end
390
+
391
+ *NOTE:* +java_compile+ is a hypothetical method that invokes the
392
+ java compiler.
393
+
394
+ == Importing Dependencies
395
+
396
+ Any ruby file (including other rakefiles) can be included with a
397
+ standard Ruby +require+ command. The rules and declarations in the
398
+ required file are just added to the definitions already accumulated.
399
+
400
+ Because the files are loaded _before_ the rake targets are evaluated,
401
+ the loaded files must be "ready to go" when the rake command is
402
+ invoked. This makes generated dependency files difficult to use. By
403
+ the time rake gets around to updating the dependencies file, it is too
404
+ late to load it.
405
+
406
+ The +import+ command addresses this by specifying a file to be loaded
407
+ _after_ the main rakefile is loaded, but _before_ any targets on the
408
+ command line are invoked. In addition, if the file name matches an
409
+ explicit task, that task is invoked before loading the file. This
410
+ allows dependency files to be generated and used in a single rake
411
+ command invocation.
412
+
413
+ Example:
414
+
415
+ require 'rake/loaders/makefile'
416
+
417
+ file ".depends.mf" => [SRC_LIST] do |t|
418
+ sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
419
+ end
420
+
421
+ import ".depends.mf"
422
+
423
+ If ".depends" does not exist, or is out of date w.r.t. the source
424
+ files, a new ".depends" file is generated using +makedepend+ before
425
+ loading.
426
+
427
+ == Comments
428
+
429
+ Standard Ruby comments (beginning with "#") can be used anywhere it is
430
+ legal in Ruby source code, including comments for tasks and rules.
431
+ However, if you wish a task to be described using the "-T" switch,
432
+ then you need to use the +desc+ command to describe the task.
433
+
434
+ Example:
435
+
436
+ desc "Create a distribution package"
437
+ task package: %w[ ... ] do ... end
438
+
439
+ The "-T" switch (or "--tasks" if you like to spell things out) will
440
+ display a list of tasks that have a description. If you use +desc+ to
441
+ describe your major tasks, you have a semi-automatic way of generating
442
+ a summary of your Rake file.
443
+
444
+ traken$ rake -T
445
+ (in /home/.../rake)
446
+ rake clean # Remove any temporary products.
447
+ rake clobber # Remove any generated file.
448
+ rake clobber_rdoc # Remove rdoc products
449
+ rake contrib_test # Run tests for contrib_test
450
+ rake default # Default Task
451
+ rake install # Install the application
452
+ rake lines # Count lines in the main rake file
453
+ rake rdoc # Build the rdoc HTML Files
454
+ rake rerdoc # Force a rebuild of the RDOC files
455
+ rake test # Run tests
456
+ rake testall # Run all test targets
457
+
458
+ Only tasks with descriptions will be displayed with the "-T" switch.
459
+ Use "-P" (or "--prereqs") to get a list of all tasks and their
460
+ prerequisites.
461
+
462
+ == Namespaces
463
+
464
+ As projects grow (and along with it, the number of tasks), it is
465
+ common for task names to begin to clash. For example, if you might
466
+ have a main program and a set of sample programs built by a single
467
+ Rakefile. By placing the tasks related to the main program in one
468
+ namespace, and the tasks for building the sample programs in a
469
+ different namespace, the task names will not interfere with each other.
470
+
471
+ For example:
472
+
473
+ namespace "main" do
474
+ task :build do
475
+ # Build the main program
476
+ end
477
+ end
478
+
479
+ namespace "samples" do
480
+ task :build do
481
+ # Build the sample programs
482
+ end
483
+ end
484
+
485
+ task build: %w[main:build samples:build]
486
+
487
+ Referencing a task in a separate namespace can be achieved by
488
+ prefixing the task name with the namespace and a colon
489
+ (e.g. "main:build" refers to the :build task in the +main+ namespace).
490
+ Nested namespaces are supported.
491
+
492
+ Note that the name given in the +task+ command is always the unadorned
493
+ task name without any namespace prefixes. The +task+ command always
494
+ defines a task in the current namespace.
495
+
496
+ === FileTasks
497
+
498
+ File task names are not scoped by the namespace command. Since the
499
+ name of a file task is the name of an actual file in the file system,
500
+ it makes little sense to include file task names in name space.
501
+ Directory tasks (created by the +directory+ command) are a type of
502
+ file task and are also not affected by namespaces.
503
+
504
+ === Name Resolution
505
+
506
+ When looking up a task name, rake will start with the current
507
+ namespace and attempt to find the name there. If it fails to find a
508
+ name in the current namespace, it will search the parent namespaces
509
+ until a match is found (or an error occurs if there is no match).
510
+
511
+ The "rake" namespace is a special implicit namespace that refers to
512
+ the toplevel names.
513
+
514
+ If a task name begins with a "^" character, the name resolution will
515
+ start in the parent namespace. Multiple "^" characters are allowed.
516
+
517
+ Here is an example file with multiple :run tasks and how various names
518
+ resolve in different locations.
519
+
520
+ task :run
521
+
522
+ namespace "one" do
523
+ task :run
524
+
525
+ namespace "two" do
526
+ task :run
527
+
528
+ # :run => "one:two:run"
529
+ # "two:run" => "one:two:run"
530
+ # "one:two:run" => "one:two:run"
531
+ # "one:run" => "one:run"
532
+ # "^run" => "one:run"
533
+ # "^^run" => "rake:run" (the top level task)
534
+ # "rake:run" => "rake:run" (the top level task)
535
+ end
536
+
537
+ # :run => "one:run"
538
+ # "two:run" => "one:two:run"
539
+ # "^run" => "rake:run"
540
+ end
541
+
542
+ # :run => "rake:run"
543
+ # "one:run" => "one:run"
544
+ # "one:two:run" => "one:two:run"
545
+
546
+ == FileLists
547
+
548
+ FileLists are the way Rake manages lists of files. You can treat a
549
+ FileList as an array of strings for the most part, but FileLists
550
+ support some additional operations.
551
+
552
+ === Creating a FileList
553
+
554
+ Creating a file list is easy. Just give it the list of file names:
555
+
556
+ fl = FileList['file1.rb', file2.rb']
557
+
558
+ Or give it a glob pattern:
559
+
560
+ fl = FileList['*.rb']
561
+
562
+ == Odds and Ends
563
+
564
+ === do/end versus { }
565
+
566
+ Blocks may be specified with either a +do+/+end+ pair, or with curly
567
+ braces in Ruby. We _strongly_ recommend using +do+/+end+ to specify the
568
+ actions for tasks and rules. Because the rakefile idiom tends to
569
+ leave off parentheses on the task/file/rule methods, unusual
570
+ ambiguities can arise when using curly braces.
571
+
572
+ For example, suppose that the method +object_files+ returns a list of
573
+ object files in a project. Now we use +object_files+ as the
574
+ prerequisites in a rule specified with actions in curly braces.
575
+
576
+ # DON'T DO THIS!
577
+ file "prog" => object_files {
578
+ # Actions are expected here (but it doesn't work)!
579
+ }
580
+
581
+ Because curly braces have a higher precedence than +do+/+end+, the
582
+ block is associated with the +object_files+ method rather than the
583
+ +file+ method.
584
+
585
+ This is the proper way to specify the task ...
586
+
587
+ # THIS IS FINE
588
+ file "prog" => object_files do
589
+ # Actions go here
590
+ end
591
+
592
+ == Rakefile Path
593
+
594
+ When issuing the +rake+ command in a terminal, Rake will look
595
+ for a Rakefile in the current directory. If a Rakefile is not found,
596
+ it will search parent directories until one is found.
597
+
598
+ For example, if a Rakefile resides in the +project/+ directory,
599
+ moving deeper into the project's directory tree will not have an adverse
600
+ effect on rake tasks:
601
+
602
+ $ pwd
603
+ /home/user/project
604
+
605
+ $ cd lib/foo/bar
606
+ $ pwd
607
+ /home/user/project/lib/foo/bar
608
+
609
+ $ rake run_pwd
610
+ /home/user/project
611
+
612
+ As far as rake is concerned, all tasks are run from the directory in
613
+ which the Rakefile resides.
614
+
615
+ === Multiple Rake Files
616
+
617
+ Not all tasks need to be included in a single Rakefile. Additional
618
+ rake files (with the file extension "+.rake+") may be placed in
619
+ +rakelib+ directory located at the top level of a project (i.e.
620
+ the same directory that contains the main +Rakefile+).
621
+
622
+ Also, rails projects may include additional rake files in the
623
+ +lib/tasks+ directory.
624
+
625
+ === Clean and Clobber Tasks
626
+
627
+ Through <tt>require 'rake/clean'</tt> Rake provides +clean+ and +clobber+
628
+ tasks:
629
+
630
+ +clean+ ::
631
+ Clean up the project by deleting scratch files and backup files. Add files
632
+ to the +CLEAN+ FileList to have the +clean+ target handle them.
633
+
634
+ +clobber+ ::
635
+ Clobber all generated and non-source files in a project. The task depends
636
+ on +clean+, so all the +CLEAN+ files will be deleted as well as files in the
637
+ +CLOBBER+ FileList. The intent of this task is to return a project to its
638
+ pristine, just unpacked state.
639
+
640
+ You can add file names or glob patterns to both the +CLEAN+ and +CLOBBER+
641
+ lists.
642
+
643
+ === Phony Task
644
+
645
+ The phony task can be used as a dependency to allow file-based tasks to use
646
+ non-file-based-tasks as prerequisites without forcing them to rebuild. You
647
+ can <tt>require 'rake/phony'</tt> to add the +phony+ task.
648
+
649
+ ----
650
+
651
+ == See
652
+
653
+ * README.rdoc -- Main documentation for Rake.