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
6
6
class Harvest
7
7
DIRECTORY_LAYOUT = "%Y/%m" . freeze
8
8
9
- def initialize ( config = nil , directory = nil , date = nil )
9
+ def initialize ( config = nil , directory = nil , date = nil , to = nil )
10
10
@config = config || Config . load
11
11
@directory = directory || @config . storage
12
12
@from = date
13
13
@from . freeze
14
+ @until = to
15
+ @until . freeze
14
16
@parser = defined? ( XML ::Document ) ? 'libxml' : 'rexml'
15
17
end
16
18
@@ -30,7 +32,11 @@ def start(sites = nil, interactive = false)
30
32
31
33
def harvest ( site )
32
34
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
34
40
35
41
if "YYYY-MM-DD" == granularity ( opts [ :url ] )
36
42
opts [ :until ] = harvest_time . strftime ( "%Y-%m-%d" )
@@ -153,4 +159,4 @@ def earliest(url)
153
159
end
154
160
155
161
end
156
- end
162
+ end
You can’t perform that action at this time.
0 commit comments