File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ module Harvester
66 class Harvest
77 DIRECTORY_LAYOUT = "%Y/%m" . freeze
88
9- def initialize ( config = nil , directory = nil , date = nil )
9+ def initialize ( config = nil , directory = nil , date = nil , to = nil )
1010 @config = config || Config . load
1111 @directory = directory || @config . storage
1212 @from = date
1313 @from . freeze
14+ @until = to
15+ @until . freeze
1416 @parser = defined? ( XML ::Document ) ? 'libxml' : 'rexml'
1517 end
1618
@@ -30,7 +32,11 @@ def start(sites = nil, interactive = false)
3032
3133 def harvest ( site )
3234 opts = build_options_hash ( @config . sites [ site ] )
33- harvest_time = Time . now . utc
35+ if @until
36+ harvest_time = @until . to_time . utc . iso8601
37+ else
38+ harvest_time = Time . now . utc
39+ end
3440
3541 if "YYYY-MM-DD" == granularity ( opts [ :url ] )
3642 opts [ :until ] = harvest_time . strftime ( "%Y-%m-%d" )
@@ -153,4 +159,4 @@ def earliest(url)
153159 end
154160
155161 end
156- end
162+ end
You can’t perform that action at this time.
0 commit comments