pluto-update 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b534e9fb9d14aca449c32058b71a07a982614abe
4
- data.tar.gz: 1fd0907569cc6873315aefdc50fd253f1d74dc94
3
+ metadata.gz: 537a23fa41963fdb77dfea36a67d3971673b0ec4
4
+ data.tar.gz: ca620b5fb7c8e25e236095576919be7b0d48155a
5
5
  SHA512:
6
- metadata.gz: a876af41b04b12cd62adf1b94ed224565b73199ae5db6ce06470dc55bb1b84593c67e0774d1ea5611ec08155a9f0517c19c22a5cd43737fc8cbc48d648df595b
7
- data.tar.gz: 96bdd000fa51b8e84cf6b20ab91b8b1cc7f023c2f17a1d36122d2a3cd82aa75f336b67a0f81b9d68eec1fe60bed00ed3aa48c4753e7ef84e5b28e700b9262172
6
+ metadata.gz: e6d7563a0cc2e7b6a3e2081ef2b1c1c6e1e30c7ba115220efa4cbd7f7c1356b85ccb0e42e665a78d6663a92dc9d2aacc8237c456eafa449cf77a7bb93e324a26
7
+ data.tar.gz: b3fba603c49a729c325f0935457739a9d73c04d36d58482921999e63888ba8cf4df4f00e54865314c56909fabedfc19affe767a645e747767c537862bf469124
data/README.md CHANGED
@@ -33,16 +33,70 @@ title = Planet Ruby
33
33
  feed = http://vienna-rb.at/atom.xml
34
34
  ```
35
35
 
36
- For more samples, see [`nytimes.ini`](https://github.com/feedreader/pluto.samples/blob/master/nytimes.ini),
37
- [`js.ini`](https://github.com/feedreader/pluto.samples/blob/master/js.ini),
38
- [`dart.ini`](https://github.com/feedreader/pluto.samples/blob/master/dart.ini),
39
- [`haskell.ini`](https://github.com/feedreader/pluto.samples/blob/master/haskell.ini),
40
- [`viennarb.ini`](https://github.com/feedreader/pluto.samples/blob/master/viennarb.ini),
41
- [`beer.ini`](https://github.com/feedreader/pluto.samples/blob/master/beer.ini),
42
- [`football.ini`](https://github.com/feedreader/pluto.samples/blob/master/football.ini).
36
+ For more samples, see [`nytimes.ini`](https://github.com/feedreader/planets/blob/master/nytimes.ini),
37
+ [`js.ini`](https://github.com/feedreader/planets/blob/master/js.ini),
38
+ [`dart.ini`](https://github.com/feedreader/planets/blob/master/dart.ini),
39
+ [`haskell.ini`](https://github.com/feedreader/planets/blob/master/haskell.ini),
40
+ [`viennarb.ini`](https://github.com/feedreader/planets/blob/master/viennarb.ini),
41
+ [`beer.ini`](https://github.com/feedreader/planets/blob/master/beer.ini),
42
+ [`football.ini`](https://github.com/feedreader/planets/blob/master/football.ini).
43
43
 
44
44
 
45
45
 
46
+ ### Shortcuts / Helpers
47
+
48
+ #### Meetup
49
+
50
+ ```
51
+ meetup = vienna-rb
52
+ ```
53
+
54
+ gets auto-completed to
55
+
56
+ ```
57
+ link = http://www.meetup.com/vienna-rb
58
+ feed = http://www.meetup.com/vienna-rb/events/rss/vienna.rb/
59
+ ```
60
+
61
+ #### Google Groups
62
+
63
+ ```
64
+ googlegroups = beerdb
65
+ ```
66
+
67
+ gets auto-completed to
68
+
69
+ ```
70
+ link = https://groups.google.com/group/beerdb
71
+ feed = https://groups.google.com/forum/feed/beerdb/topics/atom.xml?num=15
72
+ ```
73
+
74
+ #### GitHub Project
75
+
76
+ ```
77
+ github = jekyll/jekyll
78
+ ```
79
+
80
+ gets auto-completed to
81
+
82
+ ```
83
+ link = https://github.com/jekyll/jekyll
84
+ feed = https://github.com/jekyll/jekyll/commits/master.atom
85
+ ```
86
+
87
+ #### Rubygems
88
+
89
+ ```
90
+ rubygems = jekyll
91
+ ```
92
+
93
+ gets auto-completed to
94
+
95
+ ```
96
+ link = http://rubygems.org/gems/jekyll
97
+ feed = http://rubygems.org/gems/jekyll/versions.atom
98
+ ```
99
+
46
100
 
47
101
  ## License
48
102
 
@@ -82,8 +82,7 @@ private
82
82
  subscriber = Subscriber.new
83
83
  subscriber.debug = debug? ? true : false # pass along debug flag
84
84
 
85
- site_key = site_rec.key
86
- subscriber.update_subscriptions_for( site_key, site_config )
85
+ subscriber.update_subscriptions_for( site_rec.key, site_config )
87
86
  end
88
87
 
89
88
 
@@ -13,15 +13,16 @@ class Subscriber
13
13
  def debug?() @debug || false; end
14
14
 
15
15
 
16
- def update_subscriptions( config, opts={} )
17
- # !!!! -- depreciated API - remove - do NOT use anymore
18
- puts "*** warn - [Pluto::Subscriber] depreciated API -- use update_subscriptions_for( site_key )"
19
- update_subscriptions_for( 'planet', config, opts ) # default to planet site_key
20
- end
21
-
22
-
16
+ def update_subscriptions_for( name, config, opts={} )
17
+
18
+ ## note: allow (optional) config of site key too
19
+ site_key = config['key'] || config['slug']
20
+ if site_key.nil?
21
+ ## if no key configured; use (file)name; remove -_ chars
22
+ ## e.g. jekyll-meta becomes jekyllmeta etc.
23
+ site_key = name.downcase.gsub( /[\-_]/, '' )
24
+ end
23
25
 
24
- def update_subscriptions_for( site_key, config, opts={} )
25
26
  site_attribs = {
26
27
  title: config['title'] || config['name'], # support either title or name
27
28
  url: config['source'] || config['url'], # support source or url for source url for auto-update (optional)
@@ -44,7 +45,7 @@ class Subscriber
44
45
  site_rec.update_attributes!( site_attribs )
45
46
 
46
47
  # -- log update activity
47
- Activity.create!( text: "update subscriptions >#{site_key}<" )
48
+ Activity.create!( text: "update subscriptions for site >#{site_key}<" )
48
49
 
49
50
  #### todo/fix:
50
51
  ## double check - how to handle delete
@@ -62,7 +63,8 @@ class Subscriber
62
63
  ## todo: downcase key - why ??? why not???
63
64
 
64
65
  # skip "top-level" feed keys e.g. title, etc. or planet planet sections (e.g. planet,defaults)
65
- next if ['title','name','name2','title2','subtitle',
66
+ next if ['key','slug',
67
+ 'title','name','name2','title2','subtitle',
66
68
  'source', 'url',
67
69
  'include','includes','exclude','excludes',
68
70
  'feeds',
@@ -92,10 +94,47 @@ class Subscriber
92
94
  avatar: feed_hash[ 'avatar' ] || feed_hash[ 'face'],
93
95
  github: feed_hash[ 'github' ],
94
96
  twitter: feed_hash[ 'twitter' ],
95
- meetup: feed_hash[ 'meetup' ],
97
+ ## meetup: feed_hash[ 'meetup' ], -- remove from schema - virtual attrib ?? - why? why not??
96
98
  }
97
99
  feed_attribs[:encoding] = feed_hash['encoding']||feed_hash['charset'] if feed_hash['encoding']||feed_hash['charset']
98
100
 
101
+ #####
102
+ ##
103
+ # auto-fill; convenience helpers
104
+
105
+ if feed_hash['meetup']
106
+ ## link/url = http://www.meetup.com/vienna-rb
107
+ ## feed/feed_url = http://www.meetup.com/vienna-rb/events/rss/vienna.rb/
108
+
109
+ feed_attribs[:url] = "http://www.meetup.com/#{feed_hash['meetup']}" if feed_attribs[:url].nil?
110
+ feed_attribs[:feed_url] = "http://www.meetup.com/#{feed_hash['meetup']}/events/rss/#{feed_hash['meetup']}/" if feed_attribs[:feed_url].nil?
111
+ end
112
+
113
+ if feed_hash['googlegroups']
114
+ ## link/url = https://groups.google.com/group/beerdb or
115
+ ## https://groups.google.com/forum/#!forum/beerdb
116
+ ## feed/feed_url = https://groups.google.com/forum/feed/beerdb/topics/atom.xml?num=15
117
+
118
+ feed_attribs[:url] = "https://groups.google.com/group/#{feed_hash['googlegroups']}" if feed_attribs[:url].nil?
119
+ feed_attribs[:feed_url] = "https://groups.google.com/forum/feed//#{feed_hash['googlegroups']}/topics/atom.xml?num=15" if feed_attribs[:feed_url].nil?
120
+ end
121
+
122
+ if feed_hash['github'] && feed_hash['github'].index('/') ## e.g. jekyll/jekyll
123
+ ## link/url = https://github.com/jekyll/jekyll
124
+ ## feed/feed_url = https://github.com/jekyll/jekyll/commits/master.atom
125
+
126
+ feed_attribs[:url] = "https://github.com/#{feed_hash['github']}" if feed_attribs[:url].nil?
127
+ feed_attribs[:feed_url] = "https://github.com/#{feed_hash['github']}/commits/master.atom" if feed_attribs[:feed_url].nil?
128
+ end
129
+
130
+ if feed_hash['rubygems']
131
+ ## link/url = http://rubygems.org/gems/jekyll
132
+ ## feed/feed_url = http://rubygems.org/gems/jekyll/versions.atom
133
+
134
+ feed_attribs[:url] = "http://rubygems.org/gems/#{feed_hash['rubygems']}" if feed_attribs[:url].nil?
135
+ feed_attribs[:feed_url] = "http://rubygems.org/gems/#{feed_hash['rubygems']}/versions.atom" if feed_attribs[:feed_url].nil?
136
+ end
137
+
99
138
 
100
139
  puts "Updating feed subscription >#{feed_key}< - >#{feed_attribs[:feed_url]}<..."
101
140
 
@@ -9,13 +9,13 @@ class Updater
9
9
 
10
10
  ### fix!!!!!: change config to text - yes/no - why? why not??
11
11
  # or pass along struct
12
- # - with hash and text and format(e.g. ini/yml) as fields???
12
+ # - with hash and text and format(e.g. ini) as fields???
13
13
  #
14
14
  # - why? - we need to get handle on md5 digest/hash plus on plain text, ideally to store in db
15
15
  ## - pass along unparsed text!! - not hash struct
16
16
  # - will get saved in db plus we need to generate md5 hash
17
- # - add filename e.g. ruby.ini|ruby.conf|ruby.yml as opt ??
18
- # or add config format as opt e.g. ini or yml?
17
+ # - add filename e.g. ruby.ini|ruby.conf as opt ??
18
+ # or add config format as opt e.g. ini?
19
19
 
20
20
  def initialize( opts, config )
21
21
  @opts = opts
@@ -25,12 +25,21 @@ class Updater
25
25
  attr_reader :opts, :config
26
26
 
27
27
  def run( arg )
28
- arg = arg.downcase.gsub('.ini','').gsub('.yml','') # remove file extension if present
28
+ arg = arg.downcase.gsub('.ini','') # remove file extension if present
29
29
 
30
30
  update_for( arg )
31
31
  end
32
32
 
33
- def update_for( site_key )
33
+ def update_for( name )
34
+
35
+ ## note: allow (optional) config of site key too
36
+ site_key = config['key'] || config['slug']
37
+ if site_key.nil?
38
+ ## if no key configured; use (file)name; remove -_ chars
39
+ ## e.g. jekyll-meta becomes jekyllmeta etc.
40
+ site_key = name.downcase.gsub( /[\-_]/, '' )
41
+ end
42
+
34
43
  ###################
35
44
  # step 1) update subscriptions
36
45
  subscriber = Subscriber.new
@@ -4,7 +4,7 @@
4
4
  module PlutoUpdate
5
5
 
6
6
  MAJOR = 1
7
- MINOR = 2
7
+ MINOR = 3
8
8
  PATCH = 0
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
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.2.0
4
+ version: 1.3.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-15 00:00:00.000000000 Z
11
+ date: 2014-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pluto-models