feed2email 0.10.0 → 0.11.1

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: dbcdf4e12f0075c8ecdb50cbbf4e4fdb9fef1959
4
- data.tar.gz: f47dae1909bc87274d37eade561c68caa6e5f8b9
3
+ metadata.gz: 800140876c0e1dc7bbde32a7571181b9580f6f2a
4
+ data.tar.gz: 5ae7e9f92dd34d65894d8a409e98c63435f821fd
5
5
  SHA512:
6
- metadata.gz: 8e7c27a67e616639c4e1bc9957e6b0189e7f7aaf9f5f55ad7f6f351196852671fa2c6690d0e30a797fcd02aead4adcc6ba0ab210748b4925451d4852f9468d3b
7
- data.tar.gz: d063673ffa118876f8e9ec1d5728ec4be95c6688539320868fd96f0f43b274dc51c12ca2edf97466404ebabeb3838fa2262bce4dd53b3ee711d2129140dbdfea
6
+ metadata.gz: 617440511f7ec5740acaedb65e45b3759d65c265514d529619ef2eb673e9f699163bde5226f0ca6b8b8d5d83a8df85cb137e39d09aeb95d6c665b956bfecd29b
7
+ data.tar.gz: 27f2c0d7ae508421b1f9ebbbf853057256fe20c2bc9a708395ea4cb97f504d2e839759ce55b89ffb66ad0871f27935785e8debc4bab308a6d21bb68c412e135e
@@ -1,3 +1,15 @@
1
+ ### 0.11.1
2
+
3
+ * New release to ship a properly-built gem file. Release 0.11.0 was missing the
4
+ binaries.
5
+
6
+ ### 0.11.0 (yanked)
7
+
8
+ * Add `--remove` option to `import` command for feed list synchronization
9
+ * Change and limit command-line confirmation responses from `yes`/`no` to
10
+ `y`/`n`
11
+ * Show number of enabled feeds in list command
12
+
1
13
  ### 0.10.0
2
14
 
3
15
  * Do not strip `nil` entry title to prevent exceptions
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2013, 2014, 2015 Aggelos Orfanakos
3
+ Copyright (c) 2013, 2014, 2015 Angelos Orfanakos
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -151,17 +151,17 @@ feeds in that page:
151
151
  ~~~ sh
152
152
  $ f2e add http://www.rubyinside.com/
153
153
  0: http://www.rubyinside.com/feed/ "Ruby Inside" (application/rss+xml)
154
- Please enter a feed to subscribe to: 0
154
+ Please enter a feed to subscribe to (or Ctrl-C to abort): [0] 0
155
155
  Added feed: 3 http://www.rubyinside.com/feed/
156
156
  $ f2e add http://thechangelog.com/137/
157
157
  0: http://thechangelog.com/137/feed/ "The Changelog » #137: Better GitHub Issues with HuBoard and Ryan Rauh Comments Feed" (application/rss+xml)
158
158
  1: http://thechangelog.com/feed/ "RSS 2.0 Feed" (application/rss+xml)
159
- Please enter a feed to subscribe to: 1
159
+ Please enter a feed to subscribe to (or Ctrl-C to abort): [0, 1] 1
160
160
  Added feed: 4 http://thechangelog.com/feed/
161
161
  $ # cancel autodiscovery by pressing Ctrl-C
162
162
  $ f2e add http://thechangelog.com/137/
163
163
  0: http://thechangelog.com/137/feed/ "The Changelog » #137: Better GitHub Issues with HuBoard and Ryan Rauh Comments Feed" (application/rss+xml)
164
- Please enter a feed to subscribe to: ^C
164
+ Please enter a feed to subscribe to (or Ctrl-C to abort): [0] ^C
165
165
  ~~~
166
166
 
167
167
  **Note:** When autodiscovering feeds, feed2email lists only those that don't
@@ -176,6 +176,8 @@ $ feed2email list
176
176
  2 https://github.com/agorf.atom
177
177
  3 http://www.rubyinside.com/feed/
178
178
  4 http://thechangelog.com/feed/
179
+
180
+ Subscribed to 4 feeds
179
181
  ~~~
180
182
 
181
183
  A feed can be disabled so that it is not processed when `feed2email process`
@@ -200,7 +202,9 @@ It can also be removed from feed subscriptions permanently:
200
202
  ~~~ sh
201
203
  $ # same as "f2e r 1"
202
204
  $ feed2email remove 1
203
- Removed feed: 1 https://github.com/agorf/feed2email/commits.atom
205
+ Remove feed: 1 https://github.com/agorf/feed2email/commits.atom
206
+ Are you sure? [y, n] y
207
+ Removed
204
208
  ~~~
205
209
 
206
210
  ### Migrating to/from feed2email
@@ -213,7 +217,7 @@ Export feed subscriptions to `feeds.xml`:
213
217
  ~~~ sh
214
218
  $ # same as "f2e e feeds.xml"
215
219
  $ feed2email export feeds.xml
216
- This may take a bit. Please wait...
220
+ This may take a while. Please wait...
217
221
  Exported 3 feed subscriptions to feeds.xml
218
222
  ~~~
219
223
 
@@ -233,11 +237,17 @@ then try again:
233
237
 
234
238
  ~~~ sh
235
239
  $ f2e r 2
236
- Removed feed: 2 https://github.com/agorf.atom
240
+ Remove feed: 2 https://github.com/agorf.atom
241
+ Are you sure? [y/n] y
242
+ Removed
237
243
  $ f2e r 3
238
- Removed feed: 3 http://www.rubyinside.com/feed/
244
+ Remove feed: 3 http://www.rubyinside.com/feed/
245
+ Are you sure? [y/n] y
246
+ Removed
239
247
  $ f2e r 4
240
- Removed feed: 4 http://thechangelog.com/feed/
248
+ Remove feed: 4 http://thechangelog.com/feed/
249
+ Are you sure? [y/n] y
250
+ Removed
241
251
  $ f2e l
242
252
  No feeds
243
253
  $ feed2email import feeds.xml
@@ -248,6 +258,28 @@ Imported feed: 3 http://thechangelog.com/feed/
248
258
  Imported 3 feed subscriptions from feeds.xml
249
259
  ~~~
250
260
 
261
+ Passing the `--remove` option to `import` will remove any feeds not contained in
262
+ the imported list, essentially synchronizing the feed subscriptions with it:
263
+
264
+ ~~~ sh
265
+ $ # subscribe to a feed that is not in feeds.xml
266
+ $ f2e a https://github.com/agorf/feed2email/commits.atom
267
+ Added feed: 4 https://github.com/agorf/feed2email/commits.atom
268
+ $ f2e l
269
+ 1 https://github.com/agorf.atom
270
+ 2 http://www.rubyinside.com/feed/
271
+ 3 http://thechangelog.com/feed/
272
+ 4 https://github.com/agorf/feed2email/commits.atom
273
+
274
+ Subscribed to 4 feeds
275
+ $ f2e import --remove feeds.xml
276
+ Importing...
277
+ Feed already exists: 1 https://github.com/agorf.atom
278
+ Feed already exists: 2 http://www.rubyinside.com/feed/
279
+ Feed already exists: 3 http://thechangelog.com/feed/
280
+ Removed feed: 4 https://github.com/agorf/feed2email/commits.atom
281
+ ~~~
282
+
251
283
  ### Running
252
284
 
253
285
  ~~~ sh
@@ -282,4 +314,4 @@ Licensed under the MIT license (see [LICENSE.txt][license]).
282
314
 
283
315
  ## Author
284
316
 
285
- Aggelos Orfanakos, <http://agorf.gr/>
317
+ Angelos Orfanakos, <http://agorf.gr/>
@@ -35,7 +35,7 @@ module Feed2Email
35
35
  if ENV['EDITOR']
36
36
  exec(ENV['EDITOR'], Feed2Email.config_path)
37
37
  else
38
- abort 'EDITOR not set'
38
+ abort 'EDITOR environmental variable not set'
39
39
  end
40
40
  end
41
41
 
@@ -46,7 +46,7 @@ module Feed2Email
46
46
  end
47
47
 
48
48
  unless File.exist?(path)
49
- puts 'This may take a bit. Please wait...'
49
+ puts 'This may take a while. Please wait...'
50
50
 
51
51
  if n = OPMLExporter.export(path)
52
52
  puts "Exported #{'feed subscription'.pluralize(n)} to #{path}"
@@ -59,11 +59,13 @@ module Feed2Email
59
59
  end
60
60
 
61
61
  desc 'import PATH', 'Import feed subscriptions as OPML from PATH'
62
+ option :remove, type: :boolean, default: false,
63
+ desc: "Unsubscribe from feeds not in imported list"
62
64
  def import(path)
63
65
  if File.exist?(path)
64
66
  puts 'Importing...'
65
67
 
66
- if n = OPMLImporter.import(path)
68
+ if n = OPMLImporter.import(path, options[:remove])
67
69
  if n > 0
68
70
  puts "Imported #{'feed subscription'.pluralize(n)} from #{path}"
69
71
  end
@@ -79,7 +81,13 @@ module Feed2Email
79
81
  def list
80
82
  if Feed.any?
81
83
  puts Feed.by_smallest_id.to_a
82
- puts "\nSubscribed to #{'feed'.pluralize(Feed.count)}"
84
+ print "\nSubscribed to #{'feed'.pluralize(Feed.count)}"
85
+
86
+ if Feed.where(enabled: false).count > 0
87
+ print " (#{Feed.enabled.count} enabled)"
88
+ end
89
+
90
+ puts
83
91
  else
84
92
  puts 'No feeds'
85
93
  end
@@ -97,7 +105,7 @@ module Feed2Email
97
105
  if feed
98
106
  puts "Remove feed: #{feed}"
99
107
 
100
- if ask('Are you sure? (yes/no)') == 'yes'
108
+ if ask('Are you sure?', limited_to: %w{y n}) == 'y'
101
109
  if feed.delete
102
110
  puts 'Removed'
103
111
  else
@@ -169,7 +177,10 @@ module Feed2Email
169
177
  end
170
178
 
171
179
  begin
172
- response = ask('Please enter a feed to subscribe to:')
180
+ response = ask(
181
+ 'Please enter a feed to subscribe to (or Ctrl-C to abort):',
182
+ limited_to: (0...discovered_feeds.size).to_a.map(&:to_s)
183
+ )
173
184
  rescue Interrupt # Ctrl-C
174
185
  puts
175
186
  exit
@@ -2,37 +2,49 @@ require 'nokogiri'
2
2
 
3
3
  module Feed2Email
4
4
  class OPMLImporter
5
- def self.import(path)
5
+ def self.import(path, remove = false)
6
6
  require 'feed2email/feed'
7
7
 
8
- n = 0
8
+ feeds = open(path) {|f| new(f).feeds }
9
9
 
10
- open(path) do |f|
11
- new(f).import do |uri|
12
- if feed = Feed[uri: uri]
13
- warn "Feed already exists: #{feed}"
10
+ imported = 0
11
+
12
+ feeds.each do |uri|
13
+ if feed = Feed[uri: uri]
14
+ warn "Feed already exists: #{feed}"
15
+ else
16
+ feed = Feed.new(uri: uri)
17
+
18
+ if feed.save(raise_on_failure: false)
19
+ puts "Imported feed: #{feed}"
20
+ imported += 1
21
+ else
22
+ warn "Failed to import feed: #{feed}"
23
+ end
24
+ end
25
+ end
26
+
27
+ if remove
28
+ Feed.exclude(uri: feeds).each do |feed|
29
+ if feed.delete
30
+ puts "Removed feed: #{feed}"
14
31
  else
15
- feed = Feed.new(uri: uri)
16
-
17
- if feed.save(raise_on_failure: false)
18
- puts "Imported feed: #{feed}"
19
- n += 1
20
- else
21
- warn "Failed to import feed: #{feed}"
22
- end
32
+ warn "Failed to remove feed: #{feed}"
23
33
  end
24
34
  end
25
35
  end
26
36
 
27
- n
37
+ imported
28
38
  end
29
39
 
30
40
  def initialize(io)
31
41
  @io = io
32
42
  end
33
43
 
34
- def import(&blk)
35
- uris.each(&blk)
44
+ def feeds
45
+ Nokogiri::XML(data).css('opml body outline').map {|outline|
46
+ outline['xmlUrl']
47
+ }.compact
36
48
  end
37
49
 
38
50
  private
@@ -42,11 +54,5 @@ module Feed2Email
42
54
  end
43
55
 
44
56
  def io; @io end
45
-
46
- def uris
47
- Nokogiri::XML(data).css('opml body outline').map {|outline|
48
- outline['xmlUrl']
49
- }.compact
50
- end
51
57
  end
52
58
  end
@@ -1,3 +1,3 @@
1
1
  module Feed2Email
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feed2email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
- - Aggelos Orfanakos
7
+ - Angelos Orfanakos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-04 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: feedzirra
@@ -209,9 +209,9 @@ dependencies:
209
209
  description:
210
210
  email: me@agorf.gr
211
211
  executables:
212
- - f2e
213
212
  - feed2email-migrate
214
213
  - feed2email
214
+ - f2e
215
215
  extensions: []
216
216
  extra_rdoc_files: []
217
217
  files: