drake 0.8.3.1.0.14 → 0.8.4.1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +27 -0
- data/CHANGES.drake +4 -0
- data/README +98 -198
- data/Rakefile +2 -4
- data/Rakefile.drake +0 -4
- data/doc/command_line_usage.rdoc +102 -0
- data/doc/rakefile.rdoc +4 -4
- data/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/lib/rake.rb +94 -60
- data/lib/rake/alt_system.rb +108 -0
- data/lib/rake/contrib/publisher.rb +1 -1
- data/lib/rake/contrib/sys.rb +1 -1
- data/lib/rake/gempackagetask.rb +0 -6
- data/lib/rake/loaders/makefile.rb +8 -1
- data/lib/rake/packagetask.rb +0 -1
- data/lib/rake/rdoctask.rb +79 -17
- data/lib/rake/testtask.rb +1 -1
- data/lib/rake/win32.rb +11 -10
- data/test/Rakefile.seq +1 -1
- data/test/Rakefile.simple +14 -25
- data/test/check_no_expansion.rb +5 -0
- data/test/data/sample.mf +2 -0
- data/test/rake_test_setup.rb +14 -0
- data/test/session_functional.rb +2 -0
- data/test/test_application.rb +25 -44
- data/test/test_definitions.rb +4 -1
- data/test/test_file_task.rb +20 -16
- data/test/test_filelist.rb +8 -3
- data/test/test_fileutils.rb +45 -44
- data/test/test_invocation_chain.rb +8 -2
- data/test/test_makefile_loader.rb +2 -1
- data/test/test_namespace.rb +30 -11
- data/test/test_package_task.rb +3 -1
- data/test/test_parallel.rb +4 -15
- data/test/test_pathmap.rb +3 -2
- data/test/test_pseudo_status.rb +26 -0
- data/test/test_rdoc_task.rb +88 -0
- data/test/test_require.rb +3 -1
- data/test/test_rules.rb +7 -5
- data/test/test_task_manager.rb +4 -1
- data/test/test_tasks.rb +7 -4
- data/test/test_test_task.rb +2 -0
- data/test/test_top_level_functions.rb +4 -2
- data/test/test_win32.rb +29 -14
- metadata +12 -4
@@ -0,0 +1,108 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2008 James M. Lawrence
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person
|
5
|
+
# obtaining a copy of this software and associated documentation files
|
6
|
+
# (the "Software"), to deal in the Software without restriction,
|
7
|
+
# including without limitation the rights to use, copy, modify, merge,
|
8
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
9
|
+
# and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
19
|
+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
20
|
+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
#
|
24
|
+
|
25
|
+
require 'rbconfig'
|
26
|
+
|
27
|
+
#
|
28
|
+
# Alternate implementations of system() and backticks `` on Windows
|
29
|
+
# for ruby-1.8 and earlier.
|
30
|
+
#
|
31
|
+
module Rake::AltSystem
|
32
|
+
WINDOWS = Config::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def define_module_function(name, &block)
|
36
|
+
define_method(name, &block)
|
37
|
+
module_function(name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
if WINDOWS and RUBY_VERSION < "1.9.0"
|
42
|
+
RUNNABLE_EXTS = %w[com exe bat cmd]
|
43
|
+
RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i
|
44
|
+
|
45
|
+
define_module_function :kernel_system, &Kernel.method(:system)
|
46
|
+
define_module_function :kernel_backticks, &Kernel.method(:'`')
|
47
|
+
|
48
|
+
module_function
|
49
|
+
|
50
|
+
def repair_command(cmd)
|
51
|
+
"call " + (
|
52
|
+
if cmd =~ %r!\A\s*\".*?\"!
|
53
|
+
# already quoted
|
54
|
+
cmd
|
55
|
+
elsif match = cmd.match(%r!\A\s*(\S+)!)
|
56
|
+
if match[1] =~ %r!/!
|
57
|
+
# avoid x/y.bat interpretation as x with option /y
|
58
|
+
%Q!"#{match[1]}"! + match.post_match
|
59
|
+
else
|
60
|
+
# a shell command will fail if quoted
|
61
|
+
cmd
|
62
|
+
end
|
63
|
+
else
|
64
|
+
# empty or whitespace
|
65
|
+
cmd
|
66
|
+
end
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def find_runnable(file)
|
71
|
+
if file =~ RUNNABLE_PATTERN
|
72
|
+
file
|
73
|
+
else
|
74
|
+
RUNNABLE_EXTS.each { |ext|
|
75
|
+
if File.exist?(test = "#{file}.#{ext}")
|
76
|
+
return test
|
77
|
+
end
|
78
|
+
}
|
79
|
+
nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def system(cmd, *args)
|
84
|
+
repaired = (
|
85
|
+
if args.empty?
|
86
|
+
[repair_command(cmd)]
|
87
|
+
elsif runnable = find_runnable(cmd)
|
88
|
+
[File.expand_path(runnable), *args]
|
89
|
+
else
|
90
|
+
# non-existent file
|
91
|
+
[cmd, *args]
|
92
|
+
end
|
93
|
+
)
|
94
|
+
kernel_system(*repaired)
|
95
|
+
end
|
96
|
+
|
97
|
+
def backticks(cmd)
|
98
|
+
kernel_backticks(repair_command(cmd))
|
99
|
+
end
|
100
|
+
|
101
|
+
define_module_function :'`', &method(:backticks)
|
102
|
+
else
|
103
|
+
# Non-Windows or ruby-1.9+: same as Kernel versions
|
104
|
+
define_module_function :system, &Kernel.method(:system)
|
105
|
+
define_module_function :backticks, &Kernel.method(:'`')
|
106
|
+
define_module_function :'`', &Kernel.method(:'`')
|
107
|
+
end
|
108
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# Copyright 2003, 2004 by Jim Weirich (jim@weirichhouse.org)
|
3
|
+
# Copyright 2003, 2004, 2005, 2006, 2007, 2008 by Jim Weirich (jim@weirichhouse.org)
|
4
4
|
# All rights reserved.
|
5
5
|
|
6
6
|
# Permission is granted for use, copying, modification, distribution,
|
data/lib/rake/contrib/sys.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright
|
4
|
+
# Copyright 2003, 2004, 2005, 2006, 2007, 2008 by Jim Weirich (jim@weirichhouse.org)
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining
|
7
7
|
# a copy of this software and associated documentation files (the
|
data/lib/rake/gempackagetask.rb
CHANGED
@@ -9,12 +9,6 @@ require 'rake/packagetask'
|
|
9
9
|
require 'rubygems/user_interaction'
|
10
10
|
require 'rubygems/builder'
|
11
11
|
|
12
|
-
begin
|
13
|
-
Gem.manage_gems
|
14
|
-
rescue NoMethodError => ex
|
15
|
-
# Using rubygems prior to 0.6.1
|
16
|
-
end
|
17
|
-
|
18
12
|
module Rake
|
19
13
|
|
20
14
|
# Create a package based upon a Gem spec. Gem packages, as well as
|
@@ -4,11 +4,13 @@ module Rake
|
|
4
4
|
|
5
5
|
# Makefile loader to be used with the import file loader.
|
6
6
|
class MakefileLoader
|
7
|
+
SPACE_MARK = "__&NBSP;__"
|
7
8
|
|
8
9
|
# Load the makefile dependencies in +fn+.
|
9
10
|
def load(fn)
|
10
11
|
open(fn) do |mf|
|
11
12
|
lines = mf.read
|
13
|
+
lines.gsub!(/\\ /, SPACE_MARK)
|
12
14
|
lines.gsub!(/#[^\n]*\n/m, "")
|
13
15
|
lines.gsub!(/\\\n/, ' ')
|
14
16
|
lines.split("\n").each do |line|
|
@@ -23,11 +25,16 @@ module Rake
|
|
23
25
|
def process_line(line)
|
24
26
|
file_tasks, args = line.split(':')
|
25
27
|
return if args.nil?
|
26
|
-
dependents = args.split
|
28
|
+
dependents = args.split.map { |d| respace(d) }
|
27
29
|
file_tasks.strip.split.each do |file_task|
|
30
|
+
file_task = respace(file_task)
|
28
31
|
file file_task => dependents
|
29
32
|
end
|
30
33
|
end
|
34
|
+
|
35
|
+
def respace(str)
|
36
|
+
str.gsub(/#{SPACE_MARK}/, ' ')
|
37
|
+
end
|
31
38
|
end
|
32
39
|
|
33
40
|
# Install the handler
|
data/lib/rake/packagetask.rb
CHANGED
data/lib/rake/rdoctask.rb
CHANGED
@@ -28,6 +28,11 @@ module Rake
|
|
28
28
|
# rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
29
29
|
# end
|
30
30
|
#
|
31
|
+
# The +rd+ object passed to the block is an RDocTask object. See the
|
32
|
+
# attributes list for the RDocTask class for available customization options.
|
33
|
+
#
|
34
|
+
# == Specifying different task names
|
35
|
+
#
|
31
36
|
# You may wish to give the task a different name, such as if you are
|
32
37
|
# generating two sets of documentation. For instance, if you want to have a
|
33
38
|
# development set of documentation including private methods:
|
@@ -39,7 +44,17 @@ module Rake
|
|
39
44
|
# end
|
40
45
|
#
|
41
46
|
# The tasks would then be named :<em>rdoc_dev</em>, :clobber_<em>rdoc_dev</em>, and
|
42
|
-
# :re<em>rdoc_dev</em>.
|
47
|
+
# :re<em>rdoc_dev</em>.
|
48
|
+
#
|
49
|
+
# If you wish to have completely different task names, then pass a Hash as
|
50
|
+
# first argument. With the <tt>:rdoc</tt>, <tt>:clobber_rdoc</tt> and
|
51
|
+
# <tt>:rerdoc</tt> options, you can customize the task names to your liking.
|
52
|
+
# For example:
|
53
|
+
#
|
54
|
+
# Rake::RDocTask.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force")
|
55
|
+
#
|
56
|
+
# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc_clean</tt> and
|
57
|
+
# <tt>:rdoc:force</tt>.
|
43
58
|
#
|
44
59
|
class RDocTask < TaskLib
|
45
60
|
# Name of the main, top level task. (default is :rdoc)
|
@@ -48,7 +63,7 @@ module Rake
|
|
48
63
|
# Name of directory to receive the html output files. (default is "html")
|
49
64
|
attr_accessor :rdoc_dir
|
50
65
|
|
51
|
-
# Title of RDoc documentation. (
|
66
|
+
# Title of RDoc documentation. (defaults to rdoc's default)
|
52
67
|
attr_accessor :title
|
53
68
|
|
54
69
|
# Name of file to be used as the main, top level file of the
|
@@ -61,14 +76,24 @@ module Rake
|
|
61
76
|
# List of files to be included in the rdoc generation. (default is [])
|
62
77
|
attr_accessor :rdoc_files
|
63
78
|
|
64
|
-
#
|
79
|
+
# Additional list of options to be passed rdoc. (default is [])
|
65
80
|
attr_accessor :options
|
66
81
|
|
67
|
-
#
|
82
|
+
# Whether to run the rdoc process as an external shell (default is false)
|
68
83
|
attr_accessor :external
|
69
|
-
|
70
|
-
|
71
|
-
|
84
|
+
|
85
|
+
attr_accessor :inline_source
|
86
|
+
|
87
|
+
# Create an RDoc task with the given name. See the RDocTask class overview
|
88
|
+
# for documentation.
|
89
|
+
def initialize(name = :rdoc) # :yield: self
|
90
|
+
if name.is_a?(Hash)
|
91
|
+
invalid_options = name.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc]
|
92
|
+
if !invalid_options.empty?
|
93
|
+
raise ArgumentError, "Invalid option(s) passed to RDocTask.new: #{invalid_options.join(", ")}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
72
97
|
@name = name
|
73
98
|
@rdoc_files = Rake::FileList.new
|
74
99
|
@rdoc_dir = 'html'
|
@@ -76,6 +101,7 @@ module Rake
|
|
76
101
|
@title = nil
|
77
102
|
@template = nil
|
78
103
|
@external = false
|
104
|
+
@inline_source = true
|
79
105
|
@options = []
|
80
106
|
yield self if block_given?
|
81
107
|
define
|
@@ -83,31 +109,32 @@ module Rake
|
|
83
109
|
|
84
110
|
# Create the tasks defined by this task lib.
|
85
111
|
def define
|
86
|
-
if
|
112
|
+
if rdoc_task_name != "rdoc"
|
87
113
|
desc "Build the RDOC HTML Files"
|
114
|
+
else
|
115
|
+
desc "Build the #{rdoc_task_name} HTML Files"
|
88
116
|
end
|
89
|
-
|
90
|
-
desc "Build the #{name} HTML Files"
|
91
|
-
task name
|
117
|
+
task rdoc_task_name
|
92
118
|
|
93
119
|
desc "Force a rebuild of the RDOC files"
|
94
|
-
task
|
120
|
+
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
|
95
121
|
|
96
122
|
desc "Remove rdoc products"
|
97
|
-
task
|
123
|
+
task clobber_task_name do
|
98
124
|
rm_r rdoc_dir rescue nil
|
99
125
|
end
|
100
126
|
|
101
|
-
task :clobber => [
|
127
|
+
task :clobber => [clobber_task_name]
|
102
128
|
|
103
129
|
directory @rdoc_dir
|
104
|
-
task
|
130
|
+
task rdoc_task_name => [rdoc_target]
|
105
131
|
file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
|
106
132
|
rm_r @rdoc_dir rescue nil
|
133
|
+
@before_running_rdoc.call if @before_running_rdoc
|
107
134
|
args = option_list + @rdoc_files
|
108
135
|
if @external
|
109
136
|
argstring = args.join(' ')
|
110
|
-
sh %{ruby -Ivendor
|
137
|
+
sh %{ruby -Ivendor vendor/rd #{argstring}}
|
111
138
|
else
|
112
139
|
require 'rdoc/rdoc'
|
113
140
|
RDoc::RDoc.new.document(args)
|
@@ -122,6 +149,7 @@ module Rake
|
|
122
149
|
result << "--main" << quote(main) if main
|
123
150
|
result << "--title" << quote(title) if title
|
124
151
|
result << "-T" << quote(template) if template
|
152
|
+
result << "--inline-source" if inline_source && !@options.include?("--inline-source") && !@options.include?("-S")
|
125
153
|
result
|
126
154
|
end
|
127
155
|
|
@@ -136,12 +164,46 @@ module Rake
|
|
136
164
|
def option_string
|
137
165
|
option_list.join(' ')
|
138
166
|
end
|
167
|
+
|
168
|
+
# The block passed to this method will be called just before running the
|
169
|
+
# RDoc generator. It is allowed to modify RDocTask attributes inside the
|
170
|
+
# block.
|
171
|
+
def before_running_rdoc(&block)
|
172
|
+
@before_running_rdoc = block
|
173
|
+
end
|
139
174
|
|
140
175
|
private
|
141
|
-
|
176
|
+
|
142
177
|
def rdoc_target
|
143
178
|
"#{rdoc_dir}/index.html"
|
144
179
|
end
|
180
|
+
|
181
|
+
def rdoc_task_name
|
182
|
+
case name
|
183
|
+
when Hash
|
184
|
+
(name[:rdoc] || "rdoc").to_s
|
185
|
+
else
|
186
|
+
name.to_s
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def clobber_task_name
|
191
|
+
case name
|
192
|
+
when Hash
|
193
|
+
(name[:clobber_rdoc] || "clobber_rdoc").to_s
|
194
|
+
else
|
195
|
+
"clobber_#{name}"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def rerdoc_task_name
|
200
|
+
case name
|
201
|
+
when Hash
|
202
|
+
(name[:rerdoc] || "rerdoc").to_s
|
203
|
+
else
|
204
|
+
"re#{name}"
|
205
|
+
end
|
206
|
+
end
|
145
207
|
|
146
208
|
end
|
147
209
|
end
|
data/lib/rake/testtask.rb
CHANGED
data/lib/rake/win32.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
|
1
2
|
module Rake
|
2
|
-
|
3
|
+
require 'rake/alt_system'
|
4
|
+
|
3
5
|
# Win 32 interface methods for Rake. Windows specific functionality
|
4
6
|
# will be placed here to collect that knowledge in one spot.
|
5
7
|
module Win32
|
@@ -12,38 +14,37 @@ module Rake
|
|
12
14
|
class << self
|
13
15
|
# True if running on a windows system.
|
14
16
|
def windows?
|
15
|
-
|
17
|
+
AltSystem::WINDOWS
|
16
18
|
end
|
17
19
|
|
18
20
|
# Run a command line on windows.
|
19
21
|
def rake_system(*cmd)
|
20
|
-
|
21
|
-
system("call #{cmd}")
|
22
|
-
else
|
23
|
-
system(*cmd)
|
24
|
-
end
|
22
|
+
AltSystem.system(*cmd)
|
25
23
|
end
|
26
24
|
|
27
25
|
# The standard directory containing system wide rake files on
|
28
26
|
# Win 32 systems. Try the following environment variables (in
|
29
27
|
# order):
|
30
28
|
#
|
31
|
-
# *
|
29
|
+
# * HOME
|
32
30
|
# * HOMEDRIVE + HOMEPATH
|
31
|
+
# * APPDATA
|
33
32
|
# * USERPROFILE
|
34
33
|
#
|
35
34
|
# If the above are not defined, the return nil.
|
36
35
|
def win32_system_dir #:nodoc:
|
37
|
-
win32_shared_path = ENV['
|
36
|
+
win32_shared_path = ENV['HOME']
|
38
37
|
if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
|
39
38
|
win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
|
40
39
|
end
|
40
|
+
|
41
|
+
win32_shared_path ||= ENV['APPDATA']
|
41
42
|
win32_shared_path ||= ENV['USERPROFILE']
|
42
43
|
raise Win32HomeError, "Unable to determine home path environment variable." if
|
43
44
|
win32_shared_path.nil? or win32_shared_path.empty?
|
44
45
|
normalize(File.join(win32_shared_path, 'Rake'))
|
45
46
|
end
|
46
|
-
|
47
|
+
|
47
48
|
# Normalize a win32 path so that the slashes are all forward slashes.
|
48
49
|
def normalize(path)
|
49
50
|
path.gsub(/\\/, '/')
|
data/test/Rakefile.seq
CHANGED
data/test/Rakefile.simple
CHANGED
@@ -1,29 +1,18 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
puts "task default"
|
4
|
-
end
|
2
|
+
require 'thread'
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
task :default => [:a, :b]
|
5
|
+
task :a => [:x, :y]
|
6
|
+
task :b
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
stuff
|
13
|
-
end
|
14
|
-
|
15
|
-
task :b do
|
16
|
-
puts "task b"
|
17
|
-
stuff
|
18
|
-
end
|
19
|
-
|
20
|
-
task :x do
|
21
|
-
puts "task x"
|
22
|
-
stuff
|
23
|
-
end
|
24
|
-
|
25
|
-
task :y do
|
26
|
-
puts "task y"
|
27
|
-
stuff
|
28
|
-
end
|
8
|
+
mutex = Mutex.new
|
9
|
+
STDOUT.sync = true
|
29
10
|
|
11
|
+
%w[a b x y].each { |name|
|
12
|
+
task name.to_sym do
|
13
|
+
mutex.synchronize {
|
14
|
+
puts "task #{name}"
|
15
|
+
}
|
16
|
+
sleep(1)
|
17
|
+
end
|
18
|
+
}
|