drake 0.8.7.0.2.4 → 0.9.0.0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/CHANGES +77 -9
- data/{CHANGES.drake → CHANGES-drake} +6 -2
- data/MIT-LICENSE +2 -0
- data/{README → README.rdoc} +30 -18
- data/Rakefile +144 -130
- data/Rakefile-drake +67 -0
- data/TODO +1 -1
- data/bin/drake +2 -0
- data/doc/command_line_usage.rdoc +25 -11
- data/doc/glossary.rdoc +2 -2
- data/doc/jamis.rb +2 -2
- data/doc/parallel.rdoc +37 -29
- data/doc/proto_rake.rdoc +22 -22
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +56 -33
- data/doc/rational.rdoc +6 -6
- data/doc/release_notes/rake-0.4.15.rdoc +1 -1
- data/doc/release_notes/rake-0.5.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.2.rdoc +3 -3
- data/doc/release_notes/rake-0.7.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.0.rdoc +1 -1
- data/doc/release_notes/rake-0.8.2.rdoc +3 -3
- data/doc/release_notes/rake-0.8.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.4.rdoc +1 -1
- data/doc/release_notes/rake-0.8.5.rdoc +1 -1
- data/doc/release_notes/rake-0.8.6.rdoc +1 -1
- data/doc/release_notes/rake-0.8.7.rdoc +1 -1
- data/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/install.rb +14 -12
- data/lib/rake.rb +31 -2527
- data/lib/rake/alt_system.rb +7 -6
- data/lib/rake/application.rb +626 -0
- data/lib/rake/classic_namespace.rb +1 -0
- data/lib/rake/clean.rb +2 -4
- data/lib/rake/cloneable.rb +25 -0
- data/lib/rake/contrib/compositepublisher.rb +2 -5
- data/lib/rake/contrib/ftptools.rb +5 -8
- data/lib/rake/contrib/publisher.rb +2 -8
- data/lib/rake/contrib/rubyforgepublisher.rb +2 -4
- data/lib/rake/contrib/sshpublisher.rb +4 -6
- data/lib/rake/contrib/sys.rb +7 -25
- data/lib/rake/default_loader.rb +10 -0
- data/lib/rake/dsl.rb +2 -0
- data/lib/rake/dsl_definition.rb +143 -0
- data/lib/rake/early_time.rb +18 -0
- data/lib/rake/ext/core.rb +27 -0
- data/lib/rake/ext/module.rb +39 -0
- data/lib/rake/ext/string.rb +167 -0
- data/lib/rake/ext/time.rb +14 -0
- data/lib/rake/file_creation_task.rb +24 -0
- data/lib/rake/file_list.rb +403 -0
- data/lib/rake/file_task.rb +47 -0
- data/lib/rake/file_utils.rb +112 -0
- data/lib/rake/file_utils_ext.rb +142 -0
- data/lib/rake/gempackagetask.rb +6 -90
- data/lib/rake/invocation_chain.rb +51 -0
- data/lib/rake/invocation_exception_mixin.rb +16 -0
- data/lib/rake/loaders/makefile.rb +13 -15
- data/lib/rake/multi_task.rb +16 -0
- data/lib/rake/name_space.rb +25 -0
- data/lib/rake/packagetask.rb +13 -12
- data/lib/rake/parallel.rb +17 -28
- data/lib/rake/pathmap.rb +1 -0
- data/lib/rake/pseudo_status.rb +24 -0
- data/lib/rake/rake_module.rb +29 -0
- data/lib/rake/rake_test_loader.rb +10 -2
- data/lib/rake/rdoctask.rb +211 -190
- data/lib/rake/ruby182_test_unit_fix.rb +9 -7
- data/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/lib/rake/runtest.rb +4 -6
- data/lib/rake/task.rb +351 -0
- data/lib/rake/task_argument_error.rb +7 -0
- data/lib/rake/task_arguments.rb +74 -0
- data/lib/rake/task_manager.rb +307 -0
- data/lib/rake/tasklib.rb +1 -2
- data/lib/rake/testtask.rb +57 -27
- data/lib/rake/version.rb +13 -0
- data/lib/rake/win32.rb +4 -4
- data/test/contrib/test_sys.rb +8 -31
- data/test/data/access/Rakefile +33 -0
- data/test/data/comments/Rakefile +18 -0
- data/test/data/default/Rakefile +1 -1
- data/test/data/deprecated_import/Rakefile +1 -0
- data/test/data/dryrun/Rakefile +1 -1
- data/test/data/file_creation_task/Rakefile +1 -1
- data/test/data/namespace/Rakefile +9 -0
- data/test/data/rakelib/test1.rb +1 -0
- data/test/data/verbose/Rakefile +34 -0
- data/test/{filecreation.rb → file_creation.rb} +11 -7
- data/test/functional/functional_test.rb +25 -0
- data/test/{session_functional.rb → functional/session_based_tests.rb} +141 -23
- data/test/in_environment.rb +7 -5
- data/test/{test_application.rb → lib/application_test.rb} +331 -143
- data/test/{test_clean.rb → lib/clean_test.rb} +1 -0
- data/test/{test_definitions.rb → lib/definitions_test.rb} +4 -4
- data/test/lib/dsl_test.rb +52 -0
- data/test/{test_earlytime.rb → lib/earlytime_test.rb} +1 -2
- data/test/{test_extension.rb → lib/extension_test.rb} +2 -2
- data/test/{test_file_creation_task.rb → lib/file_creation_task_test.rb} +1 -1
- data/test/{test_file_task.rb → lib/file_task_test.rb} +9 -5
- data/test/{test_filelist.rb → lib/filelist_test.rb} +38 -24
- data/test/{test_fileutils.rb → lib/fileutils_test.rb} +27 -22
- data/test/{test_ftp.rb → lib/ftp_test.rb} +0 -0
- data/test/{test_invocation_chain.rb → lib/invocation_chain_test.rb} +0 -0
- data/test/{test_makefile_loader.rb → lib/makefile_loader_test.rb} +0 -0
- data/test/{test_multitask.rb → lib/multitask_test.rb} +3 -2
- data/test/{test_namespace.rb → lib/namespace_test.rb} +0 -0
- data/test/lib/package_task_test.rb +82 -0
- data/test/{test_parallel.rb → lib/parallel_test.rb} +5 -5
- data/test/{test_pathmap.rb → lib/pathmap_test.rb} +3 -2
- data/test/{test_pseudo_status.rb → lib/pseudo_status_test.rb} +0 -0
- data/test/{test_rake.rb → lib/rake_test.rb} +1 -1
- data/test/{test_rdoc_task.rb → lib/rdoc_task_test.rb} +19 -23
- data/test/{test_require.rb → lib/require_test.rb} +8 -2
- data/test/{test_rules.rb → lib/rules_test.rb} +4 -5
- data/test/{test_task_arguments.rb → lib/task_arguments_test.rb} +5 -5
- data/test/{test_task_manager.rb → lib/task_manager_test.rb} +15 -5
- data/test/{test_tasks.rb → lib/task_test.rb} +91 -28
- data/test/{test_tasklib.rb → lib/tasklib_test.rb} +0 -0
- data/test/{test_test_task.rb → lib/test_task_test.rb} +3 -3
- data/test/lib/testtask_test.rb +49 -0
- data/test/{test_top_level_functions.rb → lib/top_level_functions_test.rb} +5 -3
- data/test/{test_win32.rb → lib/win32_test.rb} +19 -0
- data/test/rake_test_setup.rb +6 -10
- data/test/ruby_version_test.rb +3 -0
- data/test/test_helper.rb +19 -0
- metadata +108 -66
- data/Rakefile.drake +0 -73
- data/test/functional.rb +0 -15
- data/test/test_package_task.rb +0 -118
@@ -2,6 +2,7 @@
|
|
2
2
|
# Loading this file enables compatibility with older Rakefile that
|
3
3
|
# referenced Task from the top level.
|
4
4
|
|
5
|
+
warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake."
|
5
6
|
Task = Rake::Task
|
6
7
|
FileTask = Rake::FileTask
|
7
8
|
FileCreationTask = Rake::FileCreationTask
|
data/lib/rake/clean.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
# The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
|
4
2
|
# two rake tasks (:clean and :clobber).
|
5
3
|
#
|
@@ -16,8 +14,8 @@
|
|
16
14
|
require 'rake'
|
17
15
|
|
18
16
|
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
19
|
-
CLEAN.clear_exclude.exclude { |fn|
|
20
|
-
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
17
|
+
CLEAN.clear_exclude.exclude { |fn|
|
18
|
+
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
21
19
|
}
|
22
20
|
|
23
21
|
desc "Remove any temporary products."
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Rake
|
2
|
+
# ##########################################################################
|
3
|
+
# Mixin for creating easily cloned objects.
|
4
|
+
#
|
5
|
+
module Cloneable
|
6
|
+
# Clone an object by making a new object and setting all the instance
|
7
|
+
# variables to the same values.
|
8
|
+
def dup
|
9
|
+
sibling = self.class.new
|
10
|
+
instance_variables.each do |ivar|
|
11
|
+
value = self.instance_variable_get(ivar)
|
12
|
+
new_value = value.clone rescue value
|
13
|
+
sibling.instance_variable_set(ivar, new_value)
|
14
|
+
end
|
15
|
+
sibling.taint if tainted?
|
16
|
+
sibling
|
17
|
+
end
|
18
|
+
|
19
|
+
def clone
|
20
|
+
sibling = dup
|
21
|
+
sibling.freeze if frozen?
|
22
|
+
sibling
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
module Rake
|
4
2
|
|
5
3
|
# Manage several publishers as a single entity.
|
@@ -7,12 +5,12 @@ module Rake
|
|
7
5
|
def initialize
|
8
6
|
@publishers = []
|
9
7
|
end
|
10
|
-
|
8
|
+
|
11
9
|
# Add a publisher to the composite.
|
12
10
|
def add(pub)
|
13
11
|
@publishers << pub
|
14
12
|
end
|
15
|
-
|
13
|
+
|
16
14
|
# Upload all the individual publishers.
|
17
15
|
def upload
|
18
16
|
@publishers.each { |p| p.upload }
|
@@ -21,4 +19,3 @@ module Rake
|
|
21
19
|
|
22
20
|
end
|
23
21
|
|
24
|
-
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
# = Tools for FTP uploading.
|
4
2
|
#
|
5
3
|
# This file is still under development and is not released for general
|
@@ -25,7 +23,7 @@ module Rake # :nodoc:
|
|
25
23
|
|
26
24
|
def initialize(path, entry)
|
27
25
|
@path = path
|
28
|
-
@mode,
|
26
|
+
@mode, _, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
|
29
27
|
@size = size.to_i
|
30
28
|
@time = determine_time(d1, d2, d3)
|
31
29
|
end
|
@@ -59,7 +57,6 @@ module Rake # :nodoc:
|
|
59
57
|
def determine_time(d1, d2, d3)
|
60
58
|
now = self.class.time.now
|
61
59
|
if /:/ =~ d3
|
62
|
-
h, m = d3.split(':')
|
63
60
|
result = Time.parse("#{d1} #{d2} #{now.year} #{d3}")
|
64
61
|
if result > now
|
65
62
|
result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}")
|
@@ -102,7 +99,7 @@ module Rake # :nodoc:
|
|
102
99
|
end
|
103
100
|
end
|
104
101
|
|
105
|
-
# Create an FTP uploader
|
102
|
+
# Create an FTP uploader targeting the directory +path+ on +host+
|
106
103
|
# using the given account and password. +path+ will be the root
|
107
104
|
# path of the uploader.
|
108
105
|
def initialize(path, host, account, password)
|
@@ -121,7 +118,7 @@ module Rake # :nodoc:
|
|
121
118
|
current_dir = File.join(route)
|
122
119
|
if @created[current_dir].nil?
|
123
120
|
@created[current_dir] = true
|
124
|
-
puts "Creating Directory #{current_dir}" if @verbose
|
121
|
+
$stderr.puts "Creating Directory #{current_dir}" if @verbose
|
125
122
|
@ftp.mkdir(current_dir) rescue nil
|
126
123
|
end
|
127
124
|
end
|
@@ -134,7 +131,7 @@ module Rake # :nodoc:
|
|
134
131
|
upload(fn)
|
135
132
|
end
|
136
133
|
end
|
137
|
-
|
134
|
+
|
138
135
|
# Close the uploader.
|
139
136
|
def close
|
140
137
|
@ftp.close
|
@@ -144,7 +141,7 @@ module Rake # :nodoc:
|
|
144
141
|
|
145
142
|
# Upload a single file to the uploader's root path.
|
146
143
|
def upload(file)
|
147
|
-
puts "Uploading #{file}" if @verbose
|
144
|
+
$stderr.puts "Uploading #{file}" if @verbose
|
148
145
|
dir = File.dirname(file)
|
149
146
|
makedirs(dir)
|
150
147
|
@ftp.putbinaryfile(file, file) unless File.directory?(file)
|
@@ -1,19 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# Copyright 2003, 2004, 2005, 2006, 2007, 2008 by Jim Weirich (jim@weirichhouse.org)
|
1
|
+
# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
|
4
2
|
# All rights reserved.
|
5
3
|
|
6
|
-
# Permission is granted for use, copying, modification, distribution,
|
7
|
-
# and distribution of modified versions of this work as long as the
|
8
|
-
# above copyright notice is included.
|
9
|
-
|
10
4
|
# Configuration information about an upload host system.
|
11
5
|
# * name :: Name of host system.
|
12
6
|
# * webdir :: Base directory for the web information for the
|
13
7
|
# application. The application name (APP) is appended to
|
14
8
|
# this directory before using.
|
15
9
|
# * pkgdir :: Directory on the host system where packages can be
|
16
|
-
# placed.
|
10
|
+
# placed.
|
17
11
|
HostInfo = Struct.new(:name, :webdir, :pkgdir)
|
18
12
|
|
19
13
|
# Manage several publishers as a single entity.
|
@@ -1,12 +1,10 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'rake/contrib/sshpublisher'
|
4
2
|
|
5
3
|
module Rake
|
6
4
|
|
7
5
|
class RubyForgePublisher < SshDirPublisher
|
8
6
|
attr_reader :project, :proj_id, :user
|
9
|
-
|
7
|
+
|
10
8
|
def initialize(projname, user)
|
11
9
|
super(
|
12
10
|
"#{user}@rubyforge.org",
|
@@ -14,5 +12,5 @@ module Rake
|
|
14
12
|
"html")
|
15
13
|
end
|
16
14
|
end
|
17
|
-
|
15
|
+
|
18
16
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'rake/contrib/compositepublisher'
|
4
2
|
|
5
3
|
module Rake
|
@@ -12,12 +10,12 @@ module Rake
|
|
12
10
|
@remote_dir = remote_dir
|
13
11
|
@local_dir = local_dir
|
14
12
|
end
|
15
|
-
|
13
|
+
|
16
14
|
def upload
|
17
15
|
sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
|
18
16
|
end
|
19
17
|
end
|
20
|
-
|
18
|
+
|
21
19
|
# Publish an entire directory to a fresh remote directory using SSH.
|
22
20
|
class SshFreshDirPublisher < SshDirPublisher
|
23
21
|
def upload
|
@@ -26,7 +24,7 @@ module Rake
|
|
26
24
|
super
|
27
25
|
end
|
28
26
|
end
|
29
|
-
|
27
|
+
|
30
28
|
# Publish a list of files to an existing remote directory.
|
31
29
|
class SshFilePublisher
|
32
30
|
# Create a publisher using the give host information.
|
@@ -36,7 +34,7 @@ module Rake
|
|
36
34
|
@local_dir = local_dir
|
37
35
|
@files = files
|
38
36
|
end
|
39
|
-
|
37
|
+
|
40
38
|
# Upload the local directory to the remote directory.
|
41
39
|
def upload
|
42
40
|
@files.each do |fn|
|
data/lib/rake/contrib/sys.rb
CHANGED
@@ -1,26 +1,8 @@
|
|
1
|
-
|
1
|
+
warn 'Sys has been deprecated in favor of FileUtils'
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright 2003
|
5
|
-
#
|
6
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
-
# a copy of this software and associated documentation files (the
|
8
|
-
# "Software"), to deal in the Software without restriction, including
|
9
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
-
# the following conditions:
|
13
|
-
#
|
14
|
-
# The above copyright notice and this permission notice shall be
|
15
|
-
# included in all copies or substantial portions of the Software.
|
16
|
-
#
|
17
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
4
|
+
# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
|
5
|
+
# All rights reserved.
|
24
6
|
#++
|
25
7
|
#
|
26
8
|
begin
|
@@ -40,7 +22,7 @@ require 'rbconfig'
|
|
40
22
|
# in Ruby 1.8.
|
41
23
|
#
|
42
24
|
module Sys
|
43
|
-
RUBY =
|
25
|
+
RUBY = RbConfig::CONFIG['ruby_install_name']
|
44
26
|
|
45
27
|
# Install all the files matching +wildcard+ into the +dest_dir+
|
46
28
|
# directory. The permission mode is set to +mode+.
|
@@ -60,7 +42,7 @@ module Sys
|
|
60
42
|
def ruby(*args)
|
61
43
|
run "#{RUBY} #{args.join(' ')}"
|
62
44
|
end
|
63
|
-
|
45
|
+
|
64
46
|
# Copy a single file from +file_name+ to +dest_file+.
|
65
47
|
def copy(file_name, dest_file)
|
66
48
|
log "Copying file #{file_name} to #{dest_file}"
|
@@ -160,10 +142,10 @@ module Sys
|
|
160
142
|
return split_all(head) + [tail]
|
161
143
|
end
|
162
144
|
|
163
|
-
# Write a message to standard
|
145
|
+
# Write a message to standard error if $verbose is enabled.
|
164
146
|
def log(msg)
|
165
147
|
print " " if $trace && $verbose
|
166
|
-
puts msg if $verbose
|
148
|
+
$stderr.puts msg if $verbose
|
167
149
|
end
|
168
150
|
|
169
151
|
# Perform a block with $verbose disabled.
|
data/lib/rake/dsl.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
# Rake DSL functions.
|
2
|
+
require 'rake/file_utils_ext'
|
3
|
+
|
4
|
+
module Rake
|
5
|
+
module DSL
|
6
|
+
|
7
|
+
# Include the FileUtils file manipulation functions in the top
|
8
|
+
# level module, but mark them private so that they don't
|
9
|
+
# unintentionally define methods on other objects.
|
10
|
+
|
11
|
+
include FileUtilsExt
|
12
|
+
private(*FileUtils.instance_methods(false))
|
13
|
+
private(*FileUtilsExt.instance_methods(false))
|
14
|
+
|
15
|
+
# Declare a basic task.
|
16
|
+
#
|
17
|
+
# Example:
|
18
|
+
# task :clobber => [:clean] do
|
19
|
+
# rm_rf "html"
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
def task(*args, &block)
|
23
|
+
Rake::Task.define_task(*args, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# Declare a file task.
|
28
|
+
#
|
29
|
+
# Example:
|
30
|
+
# file "config.cfg" => ["config.template"] do
|
31
|
+
# open("config.cfg", "w") do |outfile|
|
32
|
+
# open("config.template") do |infile|
|
33
|
+
# while line = infile.gets
|
34
|
+
# outfile.puts line
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
def file(*args, &block)
|
41
|
+
Rake::FileTask.define_task(*args, &block)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Declare a file creation task.
|
45
|
+
# (Mainly used for the directory command).
|
46
|
+
def file_create(args, &block)
|
47
|
+
Rake::FileCreationTask.define_task(args, &block)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Declare a set of files tasks to create the given directories on
|
51
|
+
# demand.
|
52
|
+
#
|
53
|
+
# Example:
|
54
|
+
# directory "testdata/doc"
|
55
|
+
#
|
56
|
+
def directory(dir)
|
57
|
+
Rake.each_dir_parent(dir) do |d|
|
58
|
+
file_create d do |t|
|
59
|
+
mkdir_p t.name if ! File.exist?(t.name)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Declare a task that performs its prerequisites in
|
65
|
+
# parallel. Multitasks does *not* guarantee that its prerequisites
|
66
|
+
# will execute in any given order (which is obvious when you think
|
67
|
+
# about it)
|
68
|
+
#
|
69
|
+
# Example:
|
70
|
+
# multitask :deploy => [:deploy_gem, :deploy_rdoc]
|
71
|
+
#
|
72
|
+
def multitask(args, &block)
|
73
|
+
Rake::MultiTask.define_task(args, &block)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Create a new rake namespace and use it for evaluating the given
|
77
|
+
# block. Returns a NameSpace object that can be used to lookup
|
78
|
+
# tasks defined in the namespace.
|
79
|
+
#
|
80
|
+
# E.g.
|
81
|
+
#
|
82
|
+
# ns = namespace "nested" do
|
83
|
+
# task :run
|
84
|
+
# end
|
85
|
+
# task_run = ns[:run] # find :run in the given namespace.
|
86
|
+
#
|
87
|
+
def namespace(name=nil, &block)
|
88
|
+
name = name.to_s if name.kind_of?(Symbol)
|
89
|
+
name = name.to_str if name.respond_to?(:to_str)
|
90
|
+
unless name.kind_of?(String) || name.nil?
|
91
|
+
raise ArgumentError, "Expected a String or Symbol for a namespace name"
|
92
|
+
end
|
93
|
+
Rake.application.in_namespace(name, &block)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Declare a rule for auto-tasks.
|
97
|
+
#
|
98
|
+
# Example:
|
99
|
+
# rule '.o' => '.c' do |t|
|
100
|
+
# sh %{cc -o #{t.name} #{t.source}}
|
101
|
+
# end
|
102
|
+
#
|
103
|
+
def rule(*args, &block)
|
104
|
+
Rake::Task.create_rule(*args, &block)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Describe the next rake task.
|
108
|
+
#
|
109
|
+
# Example:
|
110
|
+
# desc "Run the Unit Tests"
|
111
|
+
# task :test => [:build]
|
112
|
+
# runtests
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
def desc(description)
|
116
|
+
Rake.application.last_description = description
|
117
|
+
end
|
118
|
+
|
119
|
+
# Import the partial Rakefiles +fn+. Imported files are loaded
|
120
|
+
# _after_ the current file is completely loaded. This allows the
|
121
|
+
# import statement to appear anywhere in the importing file, and yet
|
122
|
+
# allowing the imported files to depend on objects defined in the
|
123
|
+
# importing file.
|
124
|
+
#
|
125
|
+
# A common use of the import statement is to include files
|
126
|
+
# containing dependency declarations.
|
127
|
+
#
|
128
|
+
# See also the --rakelibdir command line option.
|
129
|
+
#
|
130
|
+
# Example:
|
131
|
+
# import ".depend", "my_rules"
|
132
|
+
#
|
133
|
+
def import(*fns)
|
134
|
+
fns.each do |fn|
|
135
|
+
Rake.application.add_import(fn)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
extend FileUtilsExt
|
141
|
+
end
|
142
|
+
|
143
|
+
self.extend Rake::DSL
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Rake
|
2
|
+
|
3
|
+
# EarlyTime is a fake timestamp that occurs _before_ any other time value.
|
4
|
+
class EarlyTime
|
5
|
+
include Comparable
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
def <=>(other)
|
9
|
+
-1
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
"<EARLY TIME>"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
EARLY = EarlyTime.instance
|
18
|
+
end
|