pluto-update 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/lib/pluto/update/subscriber.rb +28 -11
- data/lib/pluto/update/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b534e9fb9d14aca449c32058b71a07a982614abe
|
4
|
+
data.tar.gz: 1fd0907569cc6873315aefdc50fd253f1d74dc94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a876af41b04b12cd62adf1b94ed224565b73199ae5db6ce06470dc55bb1b84593c67e0774d1ea5611ec08155a9f0517c19c22a5cd43737fc8cbc48d648df595b
|
7
|
+
data.tar.gz: 96bdd000fa51b8e84cf6b20ab91b8b1cc7f023c2f17a1d36122d2a3cd82aa75f336b67a0f81b9d68eec1fe60bed00ed3aa48c4753e7ef84e5b28e700b9262172
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# pluto-update gem - planet feed 'n' subscription updater
|
2
2
|
|
3
|
-
* home :: [github.com/feedreader/pluto
|
4
|
-
* bugs :: [github.com/feedreader/pluto
|
3
|
+
* home :: [github.com/feedreader/pluto.update](https://github.com/feedreader/pluto.update)
|
4
|
+
* bugs :: [github.com/feedreader/pluto.update/issues](https://github.com/feedreader/pluto.update/issues)
|
5
5
|
* gem :: [rubygems.org/gems/pluto-update](https://rubygems.org/gems/pluto-update)
|
6
6
|
* rdoc :: [rubydoc.info/gems/pluto-update](http://rubydoc.info/gems/pluto-update)
|
7
7
|
* forum :: [groups.google.com/group/feedreader](http://groups.google.com/group/feedreader)
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'pluto-update' do
|
|
8
8
|
self.summary = "pluto-update - planet feed 'n' subscription updater"
|
9
9
|
self.description = summary
|
10
10
|
|
11
|
-
self.urls = ['https://github.com/feedreader/pluto
|
11
|
+
self.urls = ['https://github.com/feedreader/pluto.update']
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
14
|
self.email = 'feedreader@googlegroups.com'
|
@@ -20,10 +20,14 @@ class Subscriber
|
|
20
20
|
end
|
21
21
|
|
22
22
|
|
23
|
+
|
23
24
|
def update_subscriptions_for( site_key, config, opts={} )
|
24
25
|
site_attribs = {
|
25
|
-
title:
|
26
|
-
url:
|
26
|
+
title: config['title'] || config['name'], # support either title or name
|
27
|
+
url: config['source'] || config['url'], # support source or url for source url for auto-update (optional)
|
28
|
+
author: config['author'] || config['owner'],
|
29
|
+
email: config['email'],
|
30
|
+
updated: Time.now, ## track last_update via pluto (w/ update_subscription_for fn)
|
27
31
|
}
|
28
32
|
|
29
33
|
logger.debug "site_attribs: #{site_attribs.inspect}"
|
@@ -42,6 +46,12 @@ class Subscriber
|
|
42
46
|
# -- log update activity
|
43
47
|
Activity.create!( text: "update subscriptions >#{site_key}<" )
|
44
48
|
|
49
|
+
#### todo/fix:
|
50
|
+
## double check - how to handle delete
|
51
|
+
## feeds might get referenced by other sites
|
52
|
+
## cannot just delete feeds; only save to delete join table (subscriptions)
|
53
|
+
## check if feed "lingers" on with no reference (to site)???
|
54
|
+
|
45
55
|
# clean out subscriptions and add again
|
46
56
|
logger.debug "before site.subscriptions.delete_all - count: #{site_rec.subscriptions.count}"
|
47
57
|
site_rec.subscriptions.destroy_all # note: use destroy_all NOT delete_all (delete_all tries by default only nullify)
|
@@ -52,10 +62,11 @@ class Subscriber
|
|
52
62
|
## todo: downcase key - why ??? why not???
|
53
63
|
|
54
64
|
# skip "top-level" feed keys e.g. title, etc. or planet planet sections (e.g. planet,defaults)
|
55
|
-
next if ['title','title2','
|
65
|
+
next if ['title','name','name2','title2','subtitle',
|
56
66
|
'source', 'url',
|
57
67
|
'include','includes','exclude','excludes',
|
58
68
|
'feeds',
|
69
|
+
'author', 'owner', 'email',
|
59
70
|
'planet','defaults'].include?( key )
|
60
71
|
|
61
72
|
### todo/check:
|
@@ -70,27 +81,33 @@ class Subscriber
|
|
70
81
|
# e.g. fill up auto_title, auto_url, etc.
|
71
82
|
|
72
83
|
feed_attribs = {
|
73
|
-
feed_url: feed_hash[ 'feed' ] || feed_hash[ 'feed_url' ],
|
74
|
-
url: feed_hash[ 'link' ] || feed_hash[ 'url' ],
|
84
|
+
feed_url: feed_hash[ 'feed' ] || feed_hash[ 'feed_url' ] || feed_hash[ 'xml_url' ],
|
85
|
+
url: feed_hash[ 'link' ] || feed_hash[ 'url' ] || feed_hash[ 'html_url' ],
|
75
86
|
title: feed_hash[ 'title' ] || feed_hash[ 'name' ],
|
76
|
-
title2: feed_hash[ 'title2' ],
|
87
|
+
title2: feed_hash[ 'title2' ] || feed_hash[ 'name2' ] || feed_hash[ 'subtitle'],
|
77
88
|
includes: feed_hash[ 'includes' ] || feed_hash[ 'include' ],
|
78
89
|
excludes: feed_hash[ 'excludes' ] || feed_hash[ 'exclude' ],
|
79
|
-
|
80
|
-
|
90
|
+
author: feed_hash[ 'author' ] || feed_hash[ 'owner' ],
|
91
|
+
email: feed_hash[ 'email' ],
|
92
|
+
avatar: feed_hash[ 'avatar' ] || feed_hash[ 'face'],
|
93
|
+
github: feed_hash[ 'github' ],
|
94
|
+
twitter: feed_hash[ 'twitter' ],
|
95
|
+
meetup: feed_hash[ 'meetup' ],
|
81
96
|
}
|
97
|
+
feed_attribs[:encoding] = feed_hash['encoding']||feed_hash['charset'] if feed_hash['encoding']||feed_hash['charset']
|
98
|
+
|
82
99
|
|
83
100
|
puts "Updating feed subscription >#{feed_key}< - >#{feed_attribs[:feed_url]}<..."
|
84
101
|
|
85
102
|
feed_rec = Feed.find_by_key( feed_key )
|
86
103
|
if feed_rec.nil?
|
87
|
-
feed_rec
|
88
|
-
feed_attribs[
|
104
|
+
feed_rec = Feed.new
|
105
|
+
feed_attribs[:key] = feed_key
|
89
106
|
|
90
107
|
## use object_id: feed.id and object_type: Feed
|
91
108
|
## change - model/table/schema!!!
|
92
109
|
## todo: add parent_action_id - why? why not?
|
93
|
-
Activity.create!( text: "new feed >#{feed_key}< - #{feed_attribs[
|
110
|
+
Activity.create!( text: "new feed >#{feed_key}< - #{feed_attribs[:title]}" )
|
94
111
|
end
|
95
112
|
|
96
113
|
feed_rec.update_attributes!( feed_attribs )
|
data/lib/pluto/update/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluto-update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pluto-models
|
@@ -85,7 +85,7 @@ files:
|
|
85
85
|
- lib/pluto/update/subscriber.rb
|
86
86
|
- lib/pluto/update/updater.rb
|
87
87
|
- lib/pluto/update/version.rb
|
88
|
-
homepage: https://github.com/feedreader/pluto
|
88
|
+
homepage: https://github.com/feedreader/pluto.update
|
89
89
|
licenses:
|
90
90
|
- Public Domain
|
91
91
|
metadata: {}
|