Skip to content

Commit f5ae751

Browse files
committed
Fixes for harvest shell date parsing bug due to the Chronic dependancy.
1 parent 81a6983 commit f5ae751

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
RUBY_OAI_VERSION = '0.0.6'
1+
RUBY_OAI_VERSION = '0.0.8'
22

33
require 'rubygems'
44
require 'rake'

lib/oai/harvester/shell.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ def start
4545
else
4646
self.send(cmd.shift, cmd.join(" "))
4747
end
48-
rescue
49-
puts "Not a recognized command, or bad options. Type 'help' for clues."
50-
puts $!
51-
puts $!.backtrace.join("\n")
48+
rescue NoMethodError
49+
puts "Not a recognized command. Type 'help' for clues."
50+
rescue
51+
puts "An error occurred:"
52+
puts $!
53+
puts $!.backtrace.join("\n")
5254
end
5355
end
5456
end
@@ -73,7 +75,7 @@ def harvest(options)
7375
banner "Harvesting '#{site}'"
7476
if date && !date.empty?
7577
begin
76-
date = Chronic.parse(date.join(' ')).utc
78+
date = Time.parse(date.join(' ')).utc
7779
rescue NoMethodError
7880
puts "Couldn't parse the date supplied"
7981
return
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'test_helper'
2+
3+
class LowResolutionDatesTest < Test::Unit::TestCase
4+
5+
def test_low_res_date_parsing
6+
client = OAI::Client.new 'http://caltechcstr.library.caltech.edu/perl/oai2'
7+
8+
date = Date.new 2003, 1, 1
9+
10+
# get a list of identifier headers
11+
assert_nothing_raised { client.list_identifiers :from => date }
12+
end
13+
14+
end

0 commit comments

Comments
 (0)