pluto 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ Hoe.spec 'pluto' do
19
19
 
20
20
  self.extra_deps = [
21
21
  ['pakman', '>= 0.5'],
22
- ['fetcher', '>= 0.3'],
22
+ ['fetcher', '>= 0.4.1'], # use min. 0.4.1 - added cache/conditional GET support
23
23
  ['logutils', '>= 0.6'],
24
24
  ['feedutils', '>= 0.3.2'], # use min. 0.3.2 - added fix for rss.item.guid missing; no more auto-summary in atom
25
25
  ['props', '>= 1.0.2'], # use min. 1.0.2 - added ini support
@@ -236,7 +236,6 @@ command [:merge, :m] do |c|
236
236
 
237
237
  c.desc 'Database name'
238
238
  c.arg_name 'NAME'
239
- c.default_value '<PLANET>.db e.g. ruby.db'
240
239
  c.flag [:n, :dbname]
241
240
 
242
241
 
@@ -283,7 +282,6 @@ command [:update, :up, :u] do |c|
283
282
 
284
283
  c.desc 'Database name'
285
284
  c.arg_name 'NAME'
286
- c.default_value '<PLANET>.db e.g. ruby.db'
287
285
  c.flag [:n, :dbname]
288
286
 
289
287
 
@@ -340,7 +338,6 @@ command [:build, :b] do |c|
340
338
 
341
339
  c.desc 'Database name'
342
340
  c.arg_name 'NAME'
343
- c.default_value '<PLANET>.db e.g. ruby.db'
344
341
  c.flag [:n, :dbname]
345
342
 
346
343
 
@@ -11,7 +11,16 @@ class Opts
11
11
  @verbose = true if options[:verbose] == true
12
12
 
13
13
  @db_path = options[:dbpath] if options[:dbpath].present?
14
- @db_name = options[:dbname] if options[:dbname].present?
14
+
15
+ if options[:dbname].present?
16
+ ##########
17
+ # note: c.default_value '<PLANET>.db e.g. ruby.db'
18
+ # gli2 will set default if present - thus, do NOT set a default value
19
+ # otherwise it will get set
20
+
21
+ @db_name = options[:dbname]
22
+ puts "setting opts.db_name to '#{options[:dbname]}'"
23
+ end
15
24
 
16
25
  @config_path = options[:config] if options[:config].present?
17
26
  @output_path = options[:output] if options[:output].present?
@@ -84,7 +84,23 @@ class Fetcher
84
84
  ## and http_last_modified headers
85
85
  ## and brute force body_old == body_new etc.
86
86
 
87
+ ### todo/fix: normalize/unifiy feed_url
88
+ ## - same in fetcher - use shared utitlity method or similar
89
+
90
+ @worker.use_cache = true
91
+ @worker.cache[ feed_url ] = {
92
+ 'etag' => feed_rec.http_etag,
93
+ 'last-modified' => feed_rec.http_last_modified
94
+ }
95
+
87
96
  response = @worker.get( feed_url )
97
+ @worker.use_cache = false # fix/todo: restore old use_cache setting instead of false
98
+
99
+ if response.code == '304' # not modified (conditional GET - e.g. using etag/last-modified)
100
+ puts "OK - fetching feed '#{feed_key}' - HTTP status #{response.code} #{response.message}"
101
+ return nil # no updates available; nothing to do
102
+ end
103
+
88
104
 
89
105
  feed_fetched = Time.now
90
106
 
@@ -125,11 +141,11 @@ class Fetcher
125
141
  feed_attribs = {
126
142
  http_code: response.code.to_i,
127
143
  http_etag: response.header[ 'etag' ],
128
- http_last_modified: response.header[ 'last-modified' ],
144
+ http_last_modified: response.header[ 'last-modified' ], ## note: last_modified header gets stored as plain text (not datetime)
129
145
  body: feed_xml,
130
146
  fetched: feed_fetched
131
147
  }
132
-
148
+
133
149
  ## if debug?
134
150
  puts "http header - etag: #{response.header['etag']} - #{response.header['etag'].class.name}"
135
151
  puts "http header - last-modified: #{response.header['last-modified']} - #{response.header['last-modified'].class.name}"
@@ -59,7 +59,8 @@ class CreateDb < ActiveRecord::Migration
59
59
 
60
60
  t.integer :http_code # last http status code e.g. 200,404,etc.
61
61
  t.string :http_etag # last http header etag
62
- t.datetime :http_last_modified # last http header last-modified
62
+ ## note: save last-modified header as text (not datetime) - pass through as is
63
+ t.string :http_last_modified # last http header last-modified - note: save header as plain text!!! pass along in next request as-is
63
64
 
64
65
  t.text :body # last http response body (complete feed!)
65
66
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Pluto
3
- VERSION = '0.8.8'
3
+ VERSION = '0.8.9'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pluto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-04 00:00:00.000000000 Z
12
+ date: 2013-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pakman
16
- requirement: &82398980 !ruby/object:Gem::Requirement
16
+ requirement: &77270490 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '0.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *82398980
24
+ version_requirements: *77270490
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fetcher
27
- requirement: &82398670 !ruby/object:Gem::Requirement
27
+ requirement: &77270080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: '0.3'
32
+ version: 0.4.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *82398670
35
+ version_requirements: *77270080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: logutils
38
- requirement: &82398350 !ruby/object:Gem::Requirement
38
+ requirement: &77269570 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.6'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *82398350
46
+ version_requirements: *77269570
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: feedutils
49
- requirement: &82398090 !ruby/object:Gem::Requirement
49
+ requirement: &77268950 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.3.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *82398090
57
+ version_requirements: *77268950
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: props
60
- requirement: &82397860 !ruby/object:Gem::Requirement
60
+ requirement: &77268430 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.2
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *82397860
68
+ version_requirements: *77268430
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: textutils
71
- requirement: &82397520 !ruby/object:Gem::Requirement
71
+ requirement: &77268060 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.6.8
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *82397520
79
+ version_requirements: *77268060
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: gli
82
- requirement: &82397240 !ruby/object:Gem::Requirement
82
+ requirement: &77267780 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 2.5.6
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *82397240
90
+ version_requirements: *77267780
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rdoc
93
- requirement: &82396970 !ruby/object:Gem::Requirement
93
+ requirement: &77267490 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '3.10'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *82396970
101
+ version_requirements: *77267490
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: hoe
104
- requirement: &82396660 !ruby/object:Gem::Requirement
104
+ requirement: &77267190 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '3.3'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *82396660
112
+ version_requirements: *77267190
113
113
  description: pluto - Another Planet Generator (Lets You Build Web Pages from Published
114
114
  Web Feeds)
115
115
  email: feedreader@googlegroups.com