rake 0.7.1 → 0.7.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 +35 -0
- data/Rakefile +27 -11
- data/doc/jamis.rb +1 -1
- data/doc/rakefile.rdoc +18 -0
- data/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/lib/rake.rb +308 -279
- data/lib/rake/clean.rb +3 -1
- data/lib/rake/contrib/ftptools.rb +21 -21
- data/lib/rake/contrib/rubyforgepublisher.rb +3 -3
- data/lib/rake/contrib/sshpublisher.rb +1 -1
- data/lib/rake/contrib/sys.rb +20 -21
- data/lib/rake/gempackagetask.rb +9 -8
- data/lib/rake/loaders/makefile.rb +11 -12
- data/lib/rake/packagetask.rb +38 -32
- data/lib/rake/rdoctask.rb +14 -14
- data/lib/rake/ruby182_test_unit_fix.rb +4 -4
- data/lib/rake/runtest.rb +4 -4
- data/lib/rake/testtask.rb +26 -27
- data/test/capture_stdout.rb +26 -0
- data/test/data/unittest/Rakefile +1 -0
- data/test/filecreation.rb +2 -3
- data/test/functional.rb +1 -1
- data/test/reqfile.rb +3 -0
- data/test/reqfile2.rb +3 -0
- data/test/session_functional.rb +2 -2
- data/test/test_application.rb +406 -0
- data/test/test_earlytime.rb +4 -0
- data/test/test_file_creation_task.rb +6 -0
- data/test/test_file_task.rb +1 -2
- data/test/test_filelist.rb +55 -8
- data/test/test_fileutils.rb +107 -9
- data/test/test_namespace.rb +18 -10
- data/test/test_package_task.rb +26 -26
- data/test/test_pathmap.rb +42 -36
- data/test/test_rake.rb +13 -0
- data/test/test_rules.rb +92 -15
- data/test/test_task_manager.rb +13 -13
- data/test/test_tasks.rb +42 -2
- data/test/test_top_level_functions.rb +79 -0
- metadata +54 -44
data/lib/rake/clean.rb
CHANGED
@@ -16,7 +16,9 @@
|
|
16
16
|
require 'rake'
|
17
17
|
|
18
18
|
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
19
|
-
CLEAN.clear_exclude
|
19
|
+
CLEAN.clear_exclude.exclude { |fn|
|
20
|
+
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
21
|
+
}
|
20
22
|
|
21
23
|
desc "Remove any temporary products."
|
22
24
|
task :clean do
|
@@ -48,7 +48,7 @@ module Rake # :nodoc:
|
|
48
48
|
def parse_mode(m)
|
49
49
|
result = 0
|
50
50
|
(1..9).each do |i|
|
51
|
-
|
51
|
+
result = 2*result + ((m[i]==?-) ? 0 : 1)
|
52
52
|
end
|
53
53
|
result
|
54
54
|
end
|
@@ -56,12 +56,12 @@ module Rake # :nodoc:
|
|
56
56
|
def determine_time(d1, d2, d3)
|
57
57
|
elements = ParseDate.parsedate("#{d1} #{d2} #{d3}")
|
58
58
|
if elements[0].nil?
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
today = self.class.date.today
|
60
|
+
if elements[1] > today.month
|
61
|
+
elements[0] = today.year - 1
|
62
|
+
else
|
63
|
+
elements[0] = today.year
|
64
|
+
end
|
65
65
|
end
|
66
66
|
elements = elements.collect { |el| el.nil? ? 0 : el }
|
67
67
|
Time.mktime(*elements[0,7])
|
@@ -79,12 +79,12 @@ module Rake # :nodoc:
|
|
79
79
|
# Create an uploader and pass it to the given block as +up+.
|
80
80
|
# When the block is complete, close the uploader.
|
81
81
|
def connect(path, host, account, password)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
82
|
+
up = self.new(path, host, account, password)
|
83
|
+
begin
|
84
|
+
yield(up)
|
85
|
+
ensure
|
86
|
+
up.close
|
87
|
+
end
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -103,13 +103,13 @@ module Rake # :nodoc:
|
|
103
103
|
def makedirs(path)
|
104
104
|
route = []
|
105
105
|
File.split(path).each do |dir|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
106
|
+
route << dir
|
107
|
+
current_dir = File.join(route)
|
108
|
+
if @created[current_dir].nil?
|
109
|
+
@created[current_dir] = true
|
110
|
+
puts "Creating Directory #{current_dir}" if @verbose
|
111
|
+
@ftp.mkdir(current_dir) rescue nil
|
112
|
+
end
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -117,7 +117,7 @@ module Rake # :nodoc:
|
|
117
117
|
# path.
|
118
118
|
def upload_files(wildcard)
|
119
119
|
Dir[wildcard].each do |fn|
|
120
|
-
|
120
|
+
upload(fn)
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
data/lib/rake/contrib/sys.rb
CHANGED
@@ -97,13 +97,13 @@ module Sys
|
|
97
97
|
def delete(*wildcards)
|
98
98
|
wildcards.each do |wildcard|
|
99
99
|
Dir[wildcard].each do |fn|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
100
|
+
if File.directory?(fn)
|
101
|
+
log "Deleting directory #{fn}"
|
102
|
+
Dir.delete(fn)
|
103
|
+
else
|
104
|
+
log "Deleting file #{fn}"
|
105
|
+
File.delete(fn)
|
106
|
+
end
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
@@ -112,18 +112,18 @@ module Sys
|
|
112
112
|
def delete_all(*wildcards)
|
113
113
|
wildcards.each do |wildcard|
|
114
114
|
Dir[wildcard].each do |fn|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
115
|
+
next if ! File.exist?(fn)
|
116
|
+
if File.directory?(fn)
|
117
|
+
Dir["#{fn}/*"].each do |subfn|
|
118
|
+
next if subfn=='.' || subfn=='..'
|
119
|
+
delete_all(subfn)
|
120
|
+
end
|
121
|
+
log "Deleting directory #{fn}"
|
122
|
+
Dir.delete(fn)
|
123
|
+
else
|
124
|
+
log "Deleting file #{fn}"
|
125
|
+
File.delete(fn)
|
126
|
+
end
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -177,7 +177,7 @@ module Sys
|
|
177
177
|
def for_files(*wildcards)
|
178
178
|
wildcards.each do |wildcard|
|
179
179
|
Dir[wildcard].each do |fn|
|
180
|
-
|
180
|
+
yield(fn)
|
181
181
|
end
|
182
182
|
end
|
183
183
|
end
|
@@ -204,4 +204,3 @@ module Sys
|
|
204
204
|
end
|
205
205
|
|
206
206
|
end
|
207
|
-
|
data/lib/rake/gempackagetask.rb
CHANGED
@@ -77,22 +77,23 @@ module Rake
|
|
77
77
|
def define
|
78
78
|
super
|
79
79
|
task :package => [:gem]
|
80
|
+
desc "Build the gem file #{gem_file}"
|
80
81
|
task :gem => ["#{package_dir}/#{gem_file}"]
|
81
82
|
file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
when_writing("Creating GEM") {
|
84
|
+
Gem::Builder.new(gem_spec).build
|
85
|
+
verbose(true) {
|
86
|
+
mv gem_file, "#{package_dir}/#{gem_file}"
|
87
|
+
}
|
88
|
+
}
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
91
92
|
def gem_file
|
92
93
|
if @gem_spec.platform == Gem::Platform::RUBY
|
93
|
-
|
94
|
+
"#{package_name}.gem"
|
94
95
|
else
|
95
|
-
|
96
|
+
"#{package_name}-#{@gem_spec.platform}.gem"
|
96
97
|
end
|
97
98
|
end
|
98
99
|
|
@@ -9,17 +9,17 @@ module Rake
|
|
9
9
|
def load(fn)
|
10
10
|
buffer = ''
|
11
11
|
open(fn) do |mf|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
mf.each do |line|
|
13
|
+
next if line =~ /^\s*#/
|
14
|
+
buffer << line
|
15
|
+
if buffer =~ /\\$/
|
16
|
+
buffer.sub!(/\\\n/, ' ')
|
17
|
+
state = :append
|
18
|
+
else
|
19
|
+
process_line(buffer)
|
20
|
+
buffer = ''
|
21
|
+
end
|
22
|
+
end
|
23
23
|
end
|
24
24
|
process_line(buffer) if buffer != ''
|
25
25
|
end
|
@@ -37,5 +37,4 @@ module Rake
|
|
37
37
|
|
38
38
|
# Install the handler
|
39
39
|
Rake.application.add_loader('mf', MakefileLoader.new)
|
40
|
-
|
41
40
|
end
|
data/lib/rake/packagetask.rb
CHANGED
@@ -68,6 +68,12 @@ module Rake
|
|
68
68
|
# List of files to be included in the package.
|
69
69
|
attr_accessor :package_files
|
70
70
|
|
71
|
+
# Tar command for gzipped or bzip2ed archives. The default is 'tar'.
|
72
|
+
attr_accessor :tar_command
|
73
|
+
|
74
|
+
# Zip command for zipped archives. The default is 'zip'.
|
75
|
+
attr_accessor :zip_command
|
76
|
+
|
71
77
|
# Create a Package Task with the given name and version.
|
72
78
|
def initialize(name=nil, version=nil)
|
73
79
|
init(name, version)
|
@@ -85,6 +91,8 @@ module Rake
|
|
85
91
|
@need_tar_gz = false
|
86
92
|
@need_tar_bz2 = false
|
87
93
|
@need_zip = false
|
94
|
+
@tar_command = 'tar'
|
95
|
+
@zip_command = 'zip'
|
88
96
|
end
|
89
97
|
|
90
98
|
# Create the tasks defined by this task library.
|
@@ -100,50 +108,50 @@ module Rake
|
|
100
108
|
|
101
109
|
desc "Remove package products"
|
102
110
|
task :clobber_package do
|
103
|
-
|
111
|
+
rm_r package_dir rescue nil
|
104
112
|
end
|
105
113
|
|
106
114
|
task :clobber => [:clobber_package]
|
107
115
|
|
108
116
|
[
|
109
|
-
|
110
|
-
|
111
|
-
|
117
|
+
[need_tar, tgz_file, "z"],
|
118
|
+
[need_tar_gz, tar_gz_file, "z"],
|
119
|
+
[need_tar_bz2, tar_bz2_file, "j"]
|
112
120
|
].each do |(need, file, flag)|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
+
if need
|
122
|
+
task :package => ["#{package_dir}/#{file}"]
|
123
|
+
file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
|
124
|
+
chdir(package_dir) do
|
125
|
+
sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}}
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
121
129
|
end
|
122
130
|
|
123
131
|
if need_zip
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
132
|
+
task :package => ["#{package_dir}/#{zip_file}"]
|
133
|
+
file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
|
134
|
+
chdir(package_dir) do
|
135
|
+
sh %{#{@zip_command} -r #{zip_file} #{package_name}}
|
136
|
+
end
|
137
|
+
end
|
130
138
|
end
|
131
139
|
|
132
140
|
directory package_dir
|
133
141
|
|
134
142
|
file package_dir_path => @package_files do
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
143
|
+
mkdir_p package_dir rescue nil
|
144
|
+
@package_files.each do |fn|
|
145
|
+
f = File.join(package_dir_path, fn)
|
146
|
+
fdir = File.dirname(f)
|
147
|
+
mkdir_p(fdir) if !File.exist?(fdir)
|
148
|
+
if File.directory?(fn)
|
149
|
+
mkdir_p(f)
|
150
|
+
else
|
151
|
+
rm_f f
|
152
|
+
safe_ln(fn, f)
|
153
|
+
end
|
154
|
+
end
|
147
155
|
end
|
148
156
|
self
|
149
157
|
end
|
@@ -174,5 +182,3 @@ module Rake
|
|
174
182
|
end
|
175
183
|
|
176
184
|
end
|
177
|
-
|
178
|
-
|
data/lib/rake/rdoctask.rb
CHANGED
@@ -68,7 +68,7 @@ module Rake
|
|
68
68
|
attr_accessor :external
|
69
69
|
|
70
70
|
# Create an RDoc task named <em>rdoc</em>. Default task name is +rdoc+.
|
71
|
-
def initialize(name=:rdoc)
|
71
|
+
def initialize(name=:rdoc) # :yield: self
|
72
72
|
@name = name
|
73
73
|
@rdoc_files = Rake::FileList.new
|
74
74
|
@rdoc_dir = 'html'
|
@@ -84,7 +84,7 @@ module Rake
|
|
84
84
|
# Create the tasks defined by this task lib.
|
85
85
|
def define
|
86
86
|
if name.to_s != "rdoc"
|
87
|
-
|
87
|
+
desc "Build the RDOC HTML Files"
|
88
88
|
end
|
89
89
|
|
90
90
|
desc "Build the #{name} HTML Files"
|
@@ -95,7 +95,7 @@ module Rake
|
|
95
95
|
|
96
96
|
desc "Remove rdoc products"
|
97
97
|
task paste("clobber_", name) do
|
98
|
-
|
98
|
+
rm_r rdoc_dir rescue nil
|
99
99
|
end
|
100
100
|
|
101
101
|
task :clobber => [paste("clobber_", name)]
|
@@ -103,15 +103,15 @@ module Rake
|
|
103
103
|
directory @rdoc_dir
|
104
104
|
task name => [rdoc_target]
|
105
105
|
file rdoc_target => @rdoc_files + [$rakefile] do
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
106
|
+
rm_r @rdoc_dir rescue nil
|
107
|
+
args = option_list + @rdoc_files
|
108
|
+
if @external
|
109
|
+
argstring = args.join(' ')
|
110
|
+
sh %{ruby -Ivendor vender/rd #{argstring}}
|
111
|
+
else
|
112
|
+
require 'rdoc/rdoc'
|
113
|
+
RDoc::RDoc.new.document(args)
|
114
|
+
end
|
115
115
|
end
|
116
116
|
self
|
117
117
|
end
|
@@ -127,9 +127,9 @@ module Rake
|
|
127
127
|
|
128
128
|
def quote(str)
|
129
129
|
if @external
|
130
|
-
|
130
|
+
"'#{str}'"
|
131
131
|
else
|
132
|
-
|
132
|
+
str
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -2,9 +2,9 @@ module Test
|
|
2
2
|
module Unit
|
3
3
|
module Collector
|
4
4
|
class Dir
|
5
|
-
|
5
|
+
undef collect_file
|
6
6
|
def collect_file(name, suites, already_gathered)
|
7
|
-
|
7
|
+
# loadpath = $:.dup
|
8
8
|
dir = File.dirname(File.expand_path(name))
|
9
9
|
$:.unshift(dir) unless $:.first == dir
|
10
10
|
if(@req)
|
@@ -14,8 +14,8 @@ module Test
|
|
14
14
|
end
|
15
15
|
find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
|
16
16
|
ensure
|
17
|
-
|
18
|
-
|
17
|
+
# $:.replace(loadpath)
|
18
|
+
$:.delete_at $:.rindex(dir)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/rake/runtest.rb
CHANGED
@@ -10,11 +10,11 @@ module Rake
|
|
10
10
|
Dir["#{pattern}"].each { |fn|
|
11
11
|
puts fn if log_enabled
|
12
12
|
begin
|
13
|
-
|
13
|
+
load fn
|
14
14
|
rescue Exception => ex
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
puts "Error in #{fn}: #{ex.message}"
|
16
|
+
puts ex.backtrace
|
17
|
+
assert false
|
18
18
|
end
|
19
19
|
}
|
20
20
|
end
|