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.

@@ -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
- result = 2*result + ((m[i]==?-) ? 0 : 1)
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
- 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
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
- up = self.new(path, host, account, password)
83
- begin
84
- yield(up)
85
- ensure
86
- up.close
87
- end
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
- 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
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
- upload(fn)
120
+ upload(fn)
121
121
  end
122
122
  end
123
123
 
@@ -9,9 +9,9 @@ module Rake
9
9
 
10
10
  def initialize(projname, user)
11
11
  super(
12
- "#{user}@rubyforge.org",
13
- "/var/www/gforge-projects/#{projname}",
14
- "html")
12
+ "#{user}@rubyforge.org",
13
+ "/var/www/gforge-projects/#{projname}",
14
+ "html")
15
15
  end
16
16
  end
17
17
 
@@ -40,7 +40,7 @@ module Rake
40
40
  # Upload the local directory to the remote directory.
41
41
  def upload
42
42
  @files.each do |fn|
43
- sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
43
+ sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
44
44
  end
45
45
  end
46
46
  end
@@ -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
- 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
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
- 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
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
- yield(fn)
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
-
@@ -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
- when_writing("Creating GEM") {
83
- Gem::Builder.new(gem_spec).build
84
- verbose(true) {
85
- mv gem_file, "#{package_dir}/#{gem_file}"
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
- "#{package_name}.gem"
94
+ "#{package_name}.gem"
94
95
  else
95
- "#{package_name}-#{@gem_spec.platform}.gem"
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
- 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
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
@@ -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
- rm_r package_dir rescue nil
111
+ rm_r package_dir rescue nil
104
112
  end
105
113
 
106
114
  task :clobber => [:clobber_package]
107
115
 
108
116
  [
109
- [need_tar, tgz_file, "z"],
110
- [need_tar_gz, tar_gz_file, "z"],
111
- [need_tar_bz2, tar_bz2_file, "j"]
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
- if need
114
- task :package => ["#{package_dir}/#{file}"]
115
- file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
116
- chdir(package_dir) do
117
- sh %{tar #{flag}cvf #{file} #{package_name}}
118
- end
119
- end
120
- end
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
- task :package => ["#{package_dir}/#{zip_file}"]
125
- file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
126
- chdir(package_dir) do
127
- sh %{zip -r #{zip_file} #{package_name}}
128
- end
129
- end
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
- mkdir_p package_dir rescue nil
136
- @package_files.each do |fn|
137
- f = File.join(package_dir_path, fn)
138
- fdir = File.dirname(f)
139
- mkdir_p(fdir) if !File.exist?(fdir)
140
- if File.directory?(fn)
141
- mkdir_p(f)
142
- else
143
- rm_f f
144
- safe_ln(fn, f)
145
- end
146
- end
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
-
@@ -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) # :yield: self
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
- desc "Build the RDOC HTML Files"
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
- rm_r rdoc_dir rescue nil
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
- 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
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
- "'#{str}'"
130
+ "'#{str}'"
131
131
  else
132
- str
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
- undef collect_file
5
+ undef collect_file
6
6
  def collect_file(name, suites, already_gathered)
7
- # loadpath = $:.dup
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
- # $:.replace(loadpath)
18
- $:.delete_at $:.rindex(dir)
17
+ # $:.replace(loadpath)
18
+ $:.delete_at $:.rindex(dir)
19
19
  end
20
20
  end
21
21
  end
@@ -10,11 +10,11 @@ module Rake
10
10
  Dir["#{pattern}"].each { |fn|
11
11
  puts fn if log_enabled
12
12
  begin
13
- load fn
13
+ load fn
14
14
  rescue Exception => ex
15
- puts "Error in #{fn}: #{ex.message}"
16
- puts ex.backtrace
17
- assert false
15
+ puts "Error in #{fn}: #{ex.message}"
16
+ puts ex.backtrace
17
+ assert false
18
18
  end
19
19
  }
20
20
  end