rake 0.9.3 → 0.9.4

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.

@@ -31,18 +31,6 @@ Download and install rake with the following.
31
31
 
32
32
  gem install rake
33
33
 
34
- === Normal Installation
35
-
36
- You can download the source tarball of the latest version of Rake from
37
-
38
- * http://rubyforge.org/project/showfiles.php?group_id=50
39
-
40
- Extract the tarball and run
41
-
42
- % ruby install.rb
43
-
44
- from its distribution directory.
45
-
46
34
  == Usage
47
35
 
48
36
  === Simple Example
@@ -2,6 +2,7 @@ require 'shellwords'
2
2
  require 'optparse'
3
3
 
4
4
  require 'rake/task_manager'
5
+ require 'rake/file_list'
5
6
  require 'rake/thread_pool'
6
7
  require 'rake/thread_history_display'
7
8
  require 'rake/win32'
@@ -204,7 +205,7 @@ module Rake
204
205
  def have_rakefile
205
206
  @rakefiles.each do |fn|
206
207
  if File.exist?(fn)
207
- others = Rake.glob(fn, File::FNM_CASEFOLD)
208
+ others = FileList.glob(fn, File::FNM_CASEFOLD)
208
209
  return others.size == 1 ? others.first : fn
209
210
  elsif fn == ''
210
211
  return fn
@@ -609,7 +610,7 @@ module Rake
609
610
  end
610
611
 
611
612
  def glob(path, &block)
612
- Rake.glob(path.gsub("\\", '/')).each(&block)
613
+ FileList.glob(path.gsub("\\", '/')).each(&block)
613
614
  end
614
615
  private :glob
615
616
 
@@ -5,6 +5,7 @@
5
5
 
6
6
  require 'date'
7
7
  require 'net/ftp'
8
+ require 'rake/file_list'
8
9
 
9
10
  module Rake # :nodoc:
10
11
 
@@ -127,8 +128,7 @@ module Rake # :nodoc:
127
128
  # Upload all files matching +wildcard+ to the uploader's root
128
129
  # path.
129
130
  def upload_files(wildcard)
130
- fail "OUCH"
131
- Rake.glob(wildcard).each do |fn|
131
+ FileList.glob(wildcard).each do |fn|
132
132
  upload(fn)
133
133
  end
134
134
  end
@@ -10,6 +10,7 @@ begin
10
10
  rescue LoadError
11
11
  end
12
12
  require 'rbconfig'
13
+ require 'rake/file_list'
13
14
 
14
15
  ######################################################################
15
16
  # Sys provides a number of file manipulation tools for the convenience
@@ -27,7 +28,7 @@ module Sys
27
28
  # Install all the files matching +wildcard+ into the +dest_dir+
28
29
  # directory. The permission mode is set to +mode+.
29
30
  def install(wildcard, dest_dir, mode)
30
- Rake.glob(wildcard).each do |fn|
31
+ FileList.glob(wildcard).each do |fn|
31
32
  File.install(fn, dest_dir, mode, $verbose)
32
33
  end
33
34
  end
@@ -81,7 +82,7 @@ module Sys
81
82
  # recursively delete directories.
82
83
  def delete(*wildcards)
83
84
  wildcards.each do |wildcard|
84
- Rake.glob(wildcard).each do |fn|
85
+ FileList.glob(wildcard).each do |fn|
85
86
  if File.directory?(fn)
86
87
  log "Deleting directory #{fn}"
87
88
  Dir.delete(fn)
@@ -96,10 +97,10 @@ module Sys
96
97
  # Recursively delete all files and directories matching +wildcard+.
97
98
  def delete_all(*wildcards)
98
99
  wildcards.each do |wildcard|
99
- Rake.glob(wildcard).each do |fn|
100
+ FileList.glob(wildcard).each do |fn|
100
101
  next if ! File.exist?(fn)
101
102
  if File.directory?(fn)
102
- Rake.glob("#{fn}/*").each do |subfn|
103
+ FileList.glob("#{fn}/*").each do |subfn|
103
104
  next if subfn=='.' || subfn=='..'
104
105
  delete_all(subfn)
105
106
  end
@@ -161,7 +162,7 @@ module Sys
161
162
  # Perform a block with each file matching a set of wildcards.
162
163
  def for_files(*wildcards)
163
164
  wildcards.each do |wildcard|
164
- Rake.glob(wildcard).each do |fn|
165
+ FileList.glob(wildcard).each do |fn|
165
166
  yield(fn)
166
167
  end
167
168
  end
@@ -172,7 +173,7 @@ module Sys
172
173
  private # ----------------------------------------------------------
173
174
 
174
175
  def for_matching_files(wildcard, dest_dir)
175
- Rake.glob(wildcard).each do |fn|
176
+ FileList.glob(wildcard).each do |fn|
176
177
  dest_file = File.join(dest_dir, fn)
177
178
  parent = File.dirname(dest_file)
178
179
  makedirs(parent) if ! File.directory?(parent)
@@ -340,7 +340,7 @@ module Rake
340
340
 
341
341
  # Add matching glob patterns.
342
342
  def add_matching(pattern)
343
- Rake.glob(pattern).each do |fn|
343
+ FileList.glob(pattern).each do |fn|
344
344
  self << fn unless exclude?(fn)
345
345
  end
346
346
  end
@@ -383,6 +383,13 @@ module Rake
383
383
  def [](*args)
384
384
  new(*args)
385
385
  end
386
+
387
+ # Get a sorted list of files matching the pattern. This method
388
+ # should be prefered to Dir[pattern] and Dir.glob[pattern] because
389
+ # the files returned are guaranteed to be sorted.
390
+ def glob(pattern, *args)
391
+ Dir.glob(pattern, *args).sort
392
+ end
386
393
  end
387
394
  end
388
395
  end
@@ -8,6 +8,8 @@ require 'rake'
8
8
 
9
9
  task :phony
10
10
 
11
- def (Rake::Task[:phony]).timestamp
12
- Time.at 0
11
+ Rake::Task[:phony].tap do |task|
12
+ def task.timestamp # :nodoc:
13
+ Time.at 0
14
+ end
13
15
  end
@@ -32,13 +32,6 @@ module Rake
32
32
  application.options.rakelib << file
33
33
  end
34
34
  end
35
-
36
- # Get a sorted list of files matching the pattern. This method
37
- # should be prefered to Dir[pattern] and Dir.glob[pattern] because
38
- # the files returned are guaranteed to be sorted.
39
- def glob(pattern, *args)
40
- Dir.glob(pattern, *args).sort
41
- end
42
35
  end
43
36
 
44
37
  end
@@ -1,11 +1,12 @@
1
1
  require 'test/unit'
2
2
  require 'test/unit/assertions'
3
+ require 'rake/file_list'
3
4
 
4
5
  module Rake
5
6
  include Test::Unit::Assertions
6
7
 
7
8
  def run_tests(pattern='test/test*.rb', log_enabled=false)
8
- Rake.glob(pattern).each { |fn|
9
+ FileList.glob(pattern).each { |fn|
9
10
  $stderr.puts fn if log_enabled
10
11
  begin
11
12
  require fn
@@ -96,9 +96,12 @@ module Rake
96
96
  desc "Run tests" + (@name==:test ? "" : " for #{@name}")
97
97
  task @name do
98
98
  FileUtilsExt.verbose(@verbose) do
99
- ruby "#{ruby_opts_string} #{run_code} #{file_list_string} #{option_list}" do |ok, status|
99
+ args = "#{ruby_opts_string} #{run_code} #{file_list_string} #{option_list}"
100
+ ruby args do |ok, status|
100
101
  if !ok && status.respond_to?(:signaled?) && status.signaled?
101
102
  raise SignalException.new(status.termsig)
103
+ elsif !ok
104
+ fail "Command failed with status (#{status.exitstatus}): [ruby #{args}]"
102
105
  end
103
106
  end
104
107
  end
@@ -3,7 +3,7 @@ module Rake
3
3
  NUMBERS = [
4
4
  MAJOR = 0,
5
5
  MINOR = 9,
6
- BUILD = 3,
6
+ BUILD = 4,
7
7
  ]
8
8
  end
9
9
  VERSION = Version::NUMBERS.join('.')
@@ -519,4 +519,31 @@ task :default => :test
519
519
  end
520
520
  end
521
521
 
522
+ def rakefile_failing_test_task
523
+ rakefile <<-TEST_TASK
524
+ require 'rake/testtask'
525
+
526
+ task :default => :test
527
+ Rake::TestTask.new(:test) do |t|
528
+ t.test_files = ['a_test.rb']
529
+ end
530
+ TEST_TASK
531
+ open 'a_test.rb', 'w' do |io|
532
+ io << "require 'minitest/autorun'\n"
533
+ io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
534
+ io << " def test_exit\n"
535
+ io << " assert false, 'this should fail'\n"
536
+ io << " end\n"
537
+ io << "end\n"
538
+ end
539
+ end
540
+
541
+ def rakefile_stand_alone_filelist
542
+ open 'stand_alone_filelist.rb', 'w' do |io|
543
+ io << "require 'rake/file_list'\n"
544
+ io << "FL = Rake::FileList['*.rb']\n"
545
+ io << "puts FL\n"
546
+ end
547
+ end
548
+
522
549
  end
@@ -439,6 +439,21 @@ class TestRakeFunctional < Rake::TestCase
439
439
  end
440
440
  end
441
441
 
442
+ def test_failing_test_sets_exit_status
443
+ rakefile_failing_test_task
444
+ rake
445
+ assert_equal 1, @exit.exitstatus
446
+ end
447
+
448
+ def test_stand_alone_filelist
449
+ rakefile_stand_alone_filelist
450
+
451
+ run_ruby @ruby_options + ["stand_alone_filelist.rb"]
452
+
453
+ assert_match(/^stand_alone_filelist\.rb$/, @out)
454
+ assert_equal 0, @exit.exitstatus
455
+ end
456
+
442
457
  private
443
458
 
444
459
  # Run a shell Ruby command with command line options (using the
@@ -458,14 +473,16 @@ class TestRakeFunctional < Rake::TestCase
458
473
  def run_ruby(option_list)
459
474
  puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
460
475
 
461
- inn, out, err = Open3.popen3(Gem.ruby, *option_list)
476
+ inn, out, err, wait = Open3.popen3(Gem.ruby, *option_list)
462
477
  inn.close
463
478
 
464
479
  @out = out.read
465
480
  @err = err.read
481
+ @exit = wait.value
466
482
 
467
483
  puts "OUTPUT: [#{@out}]" if @verbose
468
484
  puts "ERROR: [#{@err}]" if @verbose
485
+ puts "EXIT: [#{@exit.inspect}]" if @verbose
469
486
  puts "PWD: [#{Dir.pwd}]" if @verbose
470
487
  end
471
488
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-12 00:00:00.000000000 Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -74,7 +74,6 @@ files:
74
74
  - Rakefile
75
75
  - TODO
76
76
  - bin/rake
77
- - lib/rake.rb
78
77
  - lib/rake/alt_system.rb
79
78
  - lib/rake/application.rb
80
79
  - lib/rake/backtrace.rb
@@ -127,6 +126,7 @@ files:
127
126
  - lib/rake/thread_pool.rb
128
127
  - lib/rake/version.rb
129
128
  - lib/rake/win32.rb
129
+ - lib/rake.rb
130
130
  - test/file_creation.rb
131
131
  - test/helper.rb
132
132
  - test/test_private_reader.rb
@@ -175,11 +175,11 @@ files:
175
175
  - test/test_sys.rb
176
176
  - test/test_thread_history_display.rb
177
177
  - doc/command_line_usage.rdoc
178
- - doc/example/Rakefile1
179
- - doc/example/Rakefile2
180
178
  - doc/example/a.c
181
179
  - doc/example/b.c
182
180
  - doc/example/main.c
181
+ - doc/example/Rakefile1
182
+ - doc/example/Rakefile2
183
183
  - doc/glossary.rdoc
184
184
  - doc/jamis.rb
185
185
  - doc/proto_rake.rdoc