[前][次][番号順一覧][スレッド一覧]

ruby-changes:36478

From: drbrain <ko1@a...>
Date: Tue, 25 Nov 2014 16:03:59 +0900 (JST)
Subject: [ruby-changes:36478] drbrain:r48560 (trunk): * lib/rake: Update to rake 10.4.0

drbrain	2014-11-25 16:03:36 +0900 (Tue, 25 Nov 2014)

  New Revision: 48560

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48560

  Log:
    * lib/rake:  Update to rake 10.4.0
    * test/rake:  ditto.
    * NEWS:  ditto.
    
    * test/lib/minitest/unit.rb:  Add compatibility shim for minitest 5.
      This only provides minitest 5 unit test naming compatibility.

  Added files:
    trunk/lib/rake/late_time.rb
    trunk/test/rake/test_rake_late_time.rb
  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/lib/rake/application.rb
    trunk/lib/rake/contrib/.document
    trunk/lib/rake/ext/time.rb
    trunk/lib/rake/file_task.rb
    trunk/lib/rake/packagetask.rb
    trunk/lib/rake/task_manager.rb
    trunk/lib/rake.rb
    trunk/test/lib/minitest/unit.rb
    trunk/test/rake/helper.rb
    trunk/test/rake/support/rakefile_definitions.rb
    trunk/test/rake/test_rake_application.rb
    trunk/test/rake/test_rake_definitions.rb
    trunk/test/rake/test_rake_file_task.rb
    trunk/test/rake/test_rake_thread_pool.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48559)
+++ ChangeLog	(revision 48560)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Nov 25 15:59:46 2014  Eric Hodel  <drbrain@s...>
+
+	* lib/rake:  Update to rake 10.4.0
+	* test/rake:  ditto.
+	* NEWS:  ditto.
+
+	* test/lib/minitest/unit.rb:  Add compatibility shim for minitest 5.
+	  This only provides minitest 5 unit test naming compatibility.
+
 Tue Nov 25 15:26:33 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* tool/vcs.rb (get_revisions): use Time.new instead of Time.mktime
Index: lib/rake/ext/time.rb
===================================================================
--- lib/rake/ext/time.rb	(revision 48559)
+++ lib/rake/ext/time.rb	(revision 48560)
@@ -1,12 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake/ext/time.rb#L1
 #--
-# Extensions to time to allow comparisons with an early time class.
+# Extensions to time to allow comparisons with early and late time classes.
 
 require 'rake/early_time'
+require 'rake/late_time'
 
 class Time # :nodoc: all
   alias rake_original_time_compare :<=>
   def <=>(other)
-    if Rake::EarlyTime === other
+    if Rake::EarlyTime === other || Rake::LateTime === other
       - other.<=>(self)
     else
       rake_original_time_compare(other)
Index: lib/rake/file_task.rb
===================================================================
--- lib/rake/file_task.rb	(revision 48559)
+++ lib/rake/file_task.rb	(revision 48560)
@@ -21,7 +21,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/file_task.rb#L21
       if File.exist?(name)
         File.mtime(name.to_s)
       else
-        Rake::EARLY
+        Rake::LATE
       end
     end
 
Index: lib/rake/application.rb
===================================================================
--- lib/rake/application.rb	(revision 48559)
+++ lib/rake/application.rb	(revision 48560)
@@ -20,6 +20,9 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L20
     include TaskManager
     include TraceOutput
 
+    # The command-line arguments rake is using (defaults to ARGV)
+    attr_reader :argv # :nodoc:
+
     # The name of the application (typically 'rake')
     attr_reader :name
 
@@ -45,6 +48,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L48
     # Initialize a Rake::Application object.
     def initialize
       super
+      @argv = ARGV.dup
       @name = 'rake'
       @rakefiles = DEFAULT_RAKEFILES.dup
       @rakefile = nil
@@ -73,6 +77,8 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L77
     # call +top_level+ to run your top level tasks.
     def run
       standard_exception_handling do
+        @argv = argv
+
         init
         load_rakefile
         top_level
@@ -633,7 +639,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L639
 
         standard_rake_options.each { |args| opts.on(*args) }
         opts.environment('RAKEOPT')
-      end.parse!
+      end.parse! @argv
     end
 
     # Similar to the regular Ruby +require+ command, but will check
@@ -729,7 +735,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L735
     # Environmental assignments are processed at this time as well.
     def collect_command_line_tasks # :nodoc:
       @top_level_tasks = []
-      ARGV.each do |arg|
+      @argv.each do |arg|
         if arg =~ /^(\w+)=(.*)$/m
           ENV[$1] = $2
         else
Index: lib/rake/late_time.rb
===================================================================
--- lib/rake/late_time.rb	(revision 0)
+++ lib/rake/late_time.rb	(revision 48560)
@@ -0,0 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake/late_time.rb#L1
+module Rake
+  # LateTime is a fake timestamp that occurs _after_ any other time value.
+  class LateTime
+    include Comparable
+    include Singleton
+
+    def <=>(other)
+      1
+    end
+
+    def to_s
+      '<LATE TIME>'
+    end
+  end
+
+  LATE = LateTime.instance
+end
Index: lib/rake/packagetask.rb
===================================================================
--- lib/rake/packagetask.rb	(revision 48559)
+++ lib/rake/packagetask.rb	(revision 48560)
@@ -143,10 +143,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/packagetask.rb#L143
         end
       end
 
-      directory package_dir
-
-      file package_dir_path => @package_files do
-        mkdir_p package_dir rescue nil
+      directory package_dir_path => @package_files do
         @package_files.each do |fn|
           f = File.join(package_dir_path, fn)
           fdir = File.dirname(f)
Index: lib/rake/task_manager.rb
===================================================================
--- lib/rake/task_manager.rb	(revision 48559)
+++ lib/rake/task_manager.rb	(revision 48560)
@@ -111,7 +111,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/task_manager.rb#L111
       if args.empty?
         task_name = key
         arg_names = []
-        deps = value
+        deps = value || []
       else
         task_name = args.shift
         arg_names = key
Index: lib/rake/contrib/.document
===================================================================
--- lib/rake/contrib/.document	(revision 48559)
+++ lib/rake/contrib/.document	(revision 48560)
@@ -1 +0,0 @@
-
Index: lib/rake.rb
===================================================================
--- lib/rake.rb	(revision 48559)
+++ lib/rake.rb	(revision 48560)
@@ -21,7 +21,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake.rb#L21
 #++
 
 module Rake
-  VERSION = '10.3.2'
+  VERSION = '10.4.0'
 end
 
 require 'rake/version'
@@ -63,6 +63,7 @@ require 'rake/file_utils_ext' https://github.com/ruby/ruby/blob/trunk/lib/rake.rb#L63
 require 'rake/file_list'
 require 'rake/default_loader'
 require 'rake/early_time'
+require 'rake/late_time'
 require 'rake/name_space'
 require 'rake/task_manager'
 require 'rake/application'
Index: NEWS
===================================================================
--- NEWS	(revision 48559)
+++ NEWS	(revision 48560)
@@ -180,6 +180,11 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L180
   * New methods:
     * Pathname#birthtime
 
+* Rake
+  * Updated to Rake 10.4.0.  For full release notes see:
+
+    http://docs.seattlerb.org/rake/History_rdoc.html#label-10.4.0
+
 * RubyGems
   * Updated to RubyGems 2.4.2.  For full release notes see:
 
Index: test/rake/test_rake_thread_pool.rb
===================================================================
--- test/rake/test_rake_thread_pool.rb	(revision 48559)
+++ test/rake/test_rake_thread_pool.rb	(revision 48560)
@@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_thread_pool.rb#L1
 require File.expand_path('../helper', __FILE__)
 require 'rake/thread_pool'
-require 'test/unit/assertions'
 
 class TestRakeTestThreadPool < Rake::TestCase
   include Rake
Index: test/rake/helper.rb
===================================================================
--- test/rake/helper.rb	(revision 48559)
+++ test/rake/helper.rb	(revision 48560)
@@ -2,7 +2,7 @@ require 'rubygems' https://github.com/ruby/ruby/blob/trunk/test/rake/helper.rb#L2
 $:.unshift File.expand_path('../../lib', __FILE__)
 
 begin
-  gem 'minitest', '~> 4'
+  gem 'minitest', '~> 5'
 rescue Gem::LoadError
 end
 
@@ -21,7 +21,7 @@ rescue NoMethodError, LoadError https://github.com/ruby/ruby/blob/trunk/test/rake/helper.rb#L21
   require 'test/support/rakefile_definitions'
 end
 
-class Rake::TestCase < MiniTest::Unit::TestCase
+class Rake::TestCase < Minitest::Test
   include FileCreation
 
   include Rake::DSL
Index: test/rake/test_rake_file_task.rb
===================================================================
--- test/rake/test_rake_file_task.rb	(revision 48559)
+++ test/rake/test_rake_file_task.rb	(revision 48560)
@@ -24,6 +24,7 @@ class TestRakeFileTask < Rake::TestCase https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_file_task.rb#L24
     File.delete(ftask.name) rescue nil
 
     assert ftask.needed?, "file should be needed"
+    assert_equal Rake::LATE, ftask.timestamp
 
     open(ftask.name, "w") { |f| f.puts "HI" }
 
@@ -84,19 +85,14 @@ class TestRakeFileTask < Rake::TestCase https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_file_task.rb#L85
   end
 
   def test_existing_file_depends_on_non_existing_file
-    @ran = false
-
     create_file(OLDFILE)
     delete_file(NEWFILE)
-    file NEWFILE do
-      @ran = true
-    end
-
-    file OLDFILE => NEWFILE
+    file NEWFILE            do |t| @runs << t.name end
+    file OLDFILE => NEWFILE do |t| @runs << t.name end
 
     Task[OLDFILE].invoke
 
-    assert @ran
+    assert_equal [NEWFILE, OLDFILE], @runs
   end
 
   def test_needed_eh_build_all
Index: test/rake/test_rake_late_time.rb
===================================================================
--- test/rake/test_rake_late_time.rb	(revision 0)
+++ test/rake/test_rake_late_time.rb	(revision 48560)
@@ -0,0 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_late_time.rb#L1
+require File.expand_path('../helper', __FILE__)
+
+class TestRakeLateTime < Rake::TestCase
+  def test_late_time_comparisons
+    late = Rake::LATE
+    assert_equal late, late
+    assert late >= Time.now
+    assert late > Time.now
+    assert late != Time.now
+    assert Time.now < late
+    assert Time.now <= late
+    assert Time.now != late
+  end
+
+  def test_to_s
+    assert_equal '<LATE TIME>', Rake::LATE.to_s
+  end
+end
Index: test/rake/test_rake_application.rb
===================================================================
--- test/rake/test_rake_application.rb	(revision 48559)
+++ test/rake/test_rake_application.rb	(revision 48560)
@@ -10,9 +10,9 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L10
   end
 
   def setup_command_line(*options)
-    ARGV.clear
+    @app.argv.clear
     options.each do |option|
-      ARGV << option
+      @app.argv << option
     end
   end
 
@@ -268,7 +268,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L268
   end
 
   def test_load_rakefile_not_found
-    ARGV.clear
+    @app.argv.clear
     Dir.chdir @tempdir
     ENV['RAKE_SYSTEM'] = 'not_exist'
 
@@ -378,7 +378,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L378
 
     @app.handle_options
 
-    assert !ARGV.include?(valid_option)
+    assert !@app.argv.include?(valid_option)
     assert @app.options.trace
   end
 
@@ -406,14 +406,14 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L406
     setup_command_line("--trace", "sometask")
 
     @app.handle_options
-    assert ARGV.include?("sometask")
+    assert @app.argv.include?("sometask")
     assert @app.options.trace
   end
 
   def test_good_run
     ran = false
 
-    ARGV << '--rakelib=""'
+    @app.argv << '--rakelib=""'
 
     @app.options.silent = true
 
@@ -468,7 +468,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L468
     }
     assert_match(/see full trace/i, err)
   ensure
-    ARGV.clear
+    @app.argv.clear
   end
 
   def test_bad_run_with_trace
@@ -479,7 +479,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L479
     }
     refute_match(/see full trace/i, err)
   ensure
-    ARGV.clear
+    @app.argv.clear
   end
 
   def test_bad_run_with_backtrace
@@ -492,7 +492,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L492
     }
     refute_match(/see full trace/, err)
   ensure
-    ARGV.clear
+    @app.argv.clear
   end
 
   CustomError = Class.new(RuntimeError)
@@ -549,7 +549,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L549
     end
     assert_match(/Secondary Error/, err)
   ensure
-    ARGV.clear
+    @app.argv.clear
   end
 
   def test_run_with_bad_options
@@ -559,7 +559,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L559
       capture_io { @app.run }
     }
   ensure
-    ARGV.clear
+    @app.argv.clear
   end
 
   def test_standard_exception_handling_invalid_option
Index: test/rake/support/rakefile_definitions.rb
===================================================================
--- test/rake/support/rakefile_definitions.rb	(revision 48559)
+++ test/rake/support/rakefile_definitions.rb	(revision 48560)
@@ -460,7 +460,7 @@ end https://github.com/ruby/ruby/blob/trunk/test/rake/support/rakefile_definitions.rb#L460
     TEST_TASK
     open 'a_test.rb', 'w' do |io|
       io << "require 'minitest/autorun'\n"
-      io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
+      io << "class ExitTaskTest < Minitest::Test\n"
       io << "  def test_exit\n"
       io << "    assert false, 'this should fail'\n"
       io << "  end\n"
Index: test/rake/test_rake_definitions.rb
===================================================================
--- test/rake/test_rake_definitions.rb	(revision 48559)
+++ test/rake/test_rake_definitions.rb	(revision 48560)
@@ -59,6 +59,11 @@ class TestRakeDefinitions < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_definitions.rb#L59
     assert_raises(RuntimeError) { Task[:x].invoke }
   end
 
+  def test_falsey_dependencies
+    task :x => nil
+    assert_equal [], Task[:x].prerequisites
+  end
+
   def test_implicit_file_dependencies
     runs = []
     create_existing_file
Index: test/lib/minitest/unit.rb
===================================================================
--- test/lib/minitest/unit.rb	(revision 48559)
+++ test/lib/minitest/unit.rb	(revision 48560)
@@ -1412,6 +1412,8 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/test/lib/minitest/unit.rb#L1412
       include MiniTest::Assertions
     end # class TestCase
   end # class Unit
+
+  Test = Unit::TestCase
 end # module MiniTest
 
 Minitest = MiniTest # :nodoc: because ugh... I typo this all the time

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]