Skip to content

Commit

Permalink
Bumped to verion 0.8.1, removed references to ftools and parsedate fo…
Browse files Browse the repository at this point in the history
…r 1.9 compatibility

git-svn-id: svn+ssh://rubyforge.org/var/svn/rake/trunk@628 5af023f1-ac1a-0410-98d6-829a145c37ef
  • Loading branch information
jimweirich committed Dec 26, 2007
1 parent e65e3d4 commit 37d897e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 20 deletions.
7 changes: 6 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 1 addition & 2 deletions lib/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
34 changes: 24 additions & 10 deletions lib/rake/contrib/ftptools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# use.

require 'date'
require 'parsedate'
require 'net/ftp'

module Rake # :nodoc:
Expand All @@ -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(' ')
Expand Down Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion lib/rake/contrib/sys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

######################################################################
Expand Down
2 changes: 1 addition & 1 deletion rakelib/ruby19.rake
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
2 changes: 0 additions & 2 deletions test/filecreation.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env ruby

require 'ftools'

module FileCreation
OLDFILE = "testdata/old"
NEWFILE = "testdata/new"
Expand Down
6 changes: 5 additions & 1 deletion test/test_ftp.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#!/usr/bin/env ruby

require 'date'
require 'time'
require 'test/unit'
require 'rake/contrib/ftptools'

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
Expand Down
4 changes: 2 additions & 2 deletions test/test_rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand All @@ -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
Expand Down

0 comments on commit 37d897e

Please sign in to comment.