rake 0.8.7 → 0.9.0.beta.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rake might be problematic. Click here for more details.
- data/.gemtest +0 -0
- data/CHANGES +77 -9
- data/{README → README.rdoc} +14 -10
- data/Rakefile +113 -110
- data/TODO +1 -1
- data/doc/command_line_usage.rdoc +18 -6
- data/doc/glossary.rdoc +2 -2
- data/doc/jamis.rb +2 -2
- data/doc/proto_rake.rdoc +22 -22
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +60 -28
- 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/install.rb +14 -12
- data/lib/rake.rb +28 -2470
- data/lib/rake/alt_system.rb +7 -6
- data/lib/rake/application.rb +585 -0
- data/lib/rake/classic_namespace.rb +1 -0
- data/lib/rake/clean.rb +14 -14
- 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 +146 -0
- data/lib/rake/early_time.rb +18 -0
- data/lib/rake/environment.rb +40 -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 +132 -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/pathmap.rb +1 -0
- data/lib/rake/pseudo_status.rb +24 -0
- data/lib/rake/rake_module.rb +25 -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 +327 -0
- data/lib/rake/task_argument_error.rb +7 -0
- data/lib/rake/task_arguments.rb +74 -0
- data/lib/rake/task_manager.rb +329 -0
- data/lib/rake/tasklib.rb +1 -2
- data/lib/rake/testtask.rb +51 -26
- data/lib/rake/version.rb +12 -0
- data/lib/rake/win32.rb +4 -4
- data/test/contrib/test_sys.rb +7 -30
- data/test/data/comments/Rakefile +18 -0
- data/test/data/default/Rakefile +1 -1
- 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 +4 -2
- data/test/data/verbose/Rakefile +34 -0
- data/test/functional/functional_test.rb +25 -0
- data/test/{session_functional.rb → functional/session_based_tests.rb} +134 -23
- data/test/in_environment.rb +6 -4
- data/test/{test_application.rb → lib/application_test.rb} +277 -136
- data/test/{test_clean.rb → lib/clean_test.rb} +1 -0
- data/test/{test_definitions.rb → lib/definitions_test.rb} +2 -2
- data/test/lib/dsl_test.rb +52 -0
- data/test/{test_earlytime.rb → lib/earlytime_test.rb} +1 -2
- data/test/lib/environment_test.rb +18 -0
- data/test/{test_extension.rb → lib/extension_test.rb} +2 -2
- data/test/{test_file_creation_task.rb → lib/file_creation_task_test.rb} +0 -0
- data/test/{test_file_task.rb → lib/file_task_test.rb} +3 -3
- data/test/{test_filelist.rb → lib/filelist_test.rb} +28 -24
- data/test/{test_fileutils.rb → lib/fileutils_test.rb} +26 -21
- 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} +14 -6
- data/test/{test_namespace.rb → lib/namespace_test.rb} +0 -0
- data/test/lib/package_task_test.rb +82 -0
- 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} +1 -2
- data/test/{test_task_arguments.rb → lib/task_arguments_test.rb} +5 -5
- data/test/{test_task_manager.rb → lib/task_manager_test.rb} +5 -5
- data/test/{test_tasks.rb → lib/task_test.rb} +69 -4
- 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} +3 -3
- data/test/{test_win32.rb → lib/win32_test.rb} +19 -0
- data/test/rake_test_setup.rb +4 -9
- data/test/ruby_version_test.rb +3 -0
- data/test/test_helper.rb +12 -0
- metadata +100 -44
- 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
|
#
|
@@ -15,19 +13,21 @@
|
|
15
13
|
|
16
14
|
require 'rake'
|
17
15
|
|
18
|
-
|
19
|
-
CLEAN
|
20
|
-
|
21
|
-
|
16
|
+
Rake::DSL.environment do
|
17
|
+
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
18
|
+
CLEAN.clear_exclude.exclude { |fn|
|
19
|
+
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
20
|
+
}
|
22
21
|
|
23
|
-
desc "Remove any temporary products."
|
24
|
-
task :clean do
|
25
|
-
|
26
|
-
end
|
22
|
+
desc "Remove any temporary products."
|
23
|
+
task :clean do
|
24
|
+
CLEAN.each { |fn| rm_r fn rescue nil }
|
25
|
+
end
|
27
26
|
|
28
|
-
CLOBBER = Rake::FileList.new
|
27
|
+
CLOBBER = Rake::FileList.new
|
29
28
|
|
30
|
-
desc "Remove any generated file."
|
31
|
-
task :clobber => [:clean] do
|
32
|
-
|
29
|
+
desc "Remove any generated file."
|
30
|
+
task :clobber => [:clean] do
|
31
|
+
CLOBBER.each { |fn| rm_r fn rescue nil }
|
32
|
+
end
|
33
33
|
end
|
@@ -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,146 @@
|
|
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
|
+
|
139
|
+
# Include the Rake DSL commands in the top level Ruby scope.
|
140
|
+
def self.include_in_top_scope
|
141
|
+
Object.send(:include, Rake::DSL)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
extend FileUtilsExt
|
146
|
+
end
|