diff --git a/CHANGES b/CHANGES index 5b256cc7e..a1cade7c3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ = Rake Changelog -== Pre-Version 0.7.4 +== Version 0.8.1 + +* Removed requires on parsedate.rb (in Ftptools) +* Removed ftools from rake.rb. Made it options in sys.rb + +== Version 0.8.0 * Added task parameters (e.g. "rake build[version7]") * Made task parameters passable to prerequisites. diff --git a/lib/rake.rb b/lib/rake.rb index 799a1b2d8..3fe70d4bb 100755 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -29,10 +29,9 @@ # as a library via a require statement, but it can be distributed # independently as an application. -RAKEVERSION = '0.8.0' +RAKEVERSION = '0.8.1' require 'rbconfig' -require 'ftools' require 'getoptlong' require 'fileutils' require 'singleton' diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb index 1d0923345..4cd02f3ec 100644 --- a/lib/rake/contrib/ftptools.rb +++ b/lib/rake/contrib/ftptools.rb @@ -6,7 +6,6 @@ # use. require 'date' -require 'parsedate' require 'net/ftp' module Rake # :nodoc: @@ -20,6 +19,10 @@ def self.date @date_class ||= Date end + def self.time + @time_class ||= Time + end + def initialize(path, entry) @path = path @mode, line, @owner, @group, size, d1, d2, d3, @name = entry.split(' ') @@ -54,17 +57,28 @@ def parse_mode(m) end def determine_time(d1, d2, d3) - elements = ParseDate.parsedate("#{d1} #{d2} #{d3}") - if elements[0].nil? - today = self.class.date.today - if elements[1] > today.month - elements[0] = today.year - 1 - else - elements[0] = today.year + now = self.class.time.now + if /:/ =~ d3 + h, m = d3.split(':') + result = Time.parse("#{d1} #{d2} #{now.year} #{d3}") + if result > now + result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}") end + else + result = Time.parse("#{d1} #{d2} #{d3}") end - elements = elements.collect { |el| el.nil? ? 0 : el } - Time.mktime(*elements[0,7]) + result +# elements = ParseDate.parsedate("#{d1} #{d2} #{d3}") +# if elements[0].nil? +# today = self.class.date.today +# if elements[1] > today.month +# elements[0] = today.year - 1 +# else +# elements[0] = today.year +# end +# end +# elements = elements.collect { |el| el.nil? ? 0 : el } +# Time.mktime(*elements[0,7]) end end diff --git a/lib/rake/contrib/sys.rb b/lib/rake/contrib/sys.rb index 668484c3c..06ac9e967 100644 --- a/lib/rake/contrib/sys.rb +++ b/lib/rake/contrib/sys.rb @@ -23,7 +23,10 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ # -require 'ftools' +begin + require 'ftools' +rescue LoadError +end require 'rbconfig' ###################################################################### diff --git a/rakelib/ruby19.rake b/rakelib/ruby19.rake index 0b64bc5ad..074d98989 100644 --- a/rakelib/ruby19.rake +++ b/rakelib/ruby19.rake @@ -1,6 +1,6 @@ module Ruby19 PROG = '/Users/jim/local/ruby19/bin/ruby' - GEM_HOME = '/Users/jim/local/ruby19/lib/ruby/gems/1.9' + GEM_HOME = '/Users/jim/local/ruby19.gems' RELEASE_FILES = FileList['bin/rake', 'lib/rake.rb', 'lib/rake/**/*'] RELEASE_FILES.exclude('lib/rake/lib', 'project.rake', 'lib/rake/plugins', 'lib/rake/contrib') diff --git a/test/filecreation.rb b/test/filecreation.rb index cf1ba66aa..7a8bc8783 100644 --- a/test/filecreation.rb +++ b/test/filecreation.rb @@ -1,7 +1,5 @@ #!/usr/bin/env ruby -require 'ftools' - module FileCreation OLDFILE = "testdata/old" NEWFILE = "testdata/new" diff --git a/test/test_ftp.rb b/test/test_ftp.rb index cb25627ac..15765900c 100644 --- a/test/test_ftp.rb +++ b/test/test_ftp.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require 'date' +require 'time' require 'test/unit' require 'rake/contrib/ftptools' @@ -8,13 +9,16 @@ class FakeDate def self.today Date.new(2003,10,3) end + def self.now + Time.local(2003,10,3,12,00,00) + end end class TestFtpFile < Test::Unit::TestCase def setup - Rake::FtpFile.class_eval { @date_class = FakeDate } + Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate } end def test_general diff --git a/test/test_rules.rb b/test/test_rules.rb index 53efe283a..f7c68e2ec 100644 --- a/test/test_rules.rb +++ b/test/test_rules.rb @@ -261,7 +261,7 @@ def test_second_rule_doest_run_if_first_triggers_with_reversed_rules def test_rule_with_proc_dependent_will_trigger ran = false - File.makedirs("testdata/src/jw") + mkdir_p("testdata/src/jw") create_file("testdata/src/jw/X.java") rule %r(classes/.*\.class) => [ proc { |fn| fn.pathmap("%{classes,testdata/src}d/%n.java") } @@ -278,7 +278,7 @@ def test_rule_with_proc_dependent_will_trigger def test_proc_returning_lists_are_flattened_into_prereqs ran = false - File.makedirs("testdata/flatten") + mkdir_p("testdata/flatten") create_file("testdata/flatten/a.txt") task 'testdata/flatten/b.data' do |t| ran = true