feedbook 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWM2NzUzZWNhOTIwZTE2MDhkZTQ5NTU3NGNhNTYwZmQ4ZDNiOThjOA==
4
+ MmZmNWQ3YWIwODUwN2RhNDI3MGI2ZDVjOWRkNDQ2ZWQzZGNjNjAyOQ==
5
5
  data.tar.gz: !binary |-
6
- ZmIzOTgxMmU5MWNmNzJiMjFjN2RlNzFlOGQ4MjY4NTg3Y2EzYzQ1Mw==
6
+ ODE5MTI4ZGZmNTUxODFmMmFhZGZkNzEwYmQxNjExZjVlODVjMjA0OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmM1NDJlYTY4MDUxYjM5YmFiY2RjNzNlZjhmNjRiN2Q5MTNiZTAxODEyOTUy
10
- NDY5MjI4ZTVkMmZkZWY5Y2RlNjJjM2Y3Yjg3MmFhOTUyYzk5YzFiYThmMjNi
11
- NWVlNGRmNzZlYTljMTM4YzhjNjIwNmNmMTcxMGI4Nzk0YjliOTU=
9
+ ZDgzZGI3NmEyYWY1YTFmM2I3YzlhNzgyYmExODQxNzlmNDA1M2E5YzcwNzQx
10
+ ZDYyYjY1MDI5ZDZjZDZlNTk5MDY4NjljYzBiNDM1MGEyZWYyOWE1ZTczNzE4
11
+ MDg4N2E3YmZmOWRjNWQyMTMxZjFhNzNlMGNhMWVhZjNmZDY5YWY=
12
12
  data.tar.gz: !binary |-
13
- MWI2YjRlODRkNTJmNzFmMDE4ZTBiYjdlYTdkZjBlZjE0MGVhMDcwODlmZmE1
14
- MjUxYTFmMWJjMzYyMWVjZjc5ZTYyZmRkOGU5ZGZmNjNiOTQ0OGU4N2VjZjhi
15
- NGU4ODNkMzU1ZTg3MjBlODc4YjdhYzRlMmVkNWFkZjNkMWZmMzM=
13
+ NzZlZDA4ZWUxMWYyZmJhOTE4YTMwMTFlYzgwMGFkM2I1YjU3MzJlMGI1ZWQ1
14
+ Mjc2Mzg3MGZjMGI2ODExYjFiMTdmOTI5OGJhMjA4Nzg5M2Q2ODViYzAyM2Rj
15
+ ZDhkZDM0OGE5NmI2Y2Q4ZDQ2NTA4NzY5ZmJlYmU2NTNlM2I1NmE=
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Feedbook [![Build Status](https://travis-ci.org/pinoss/feedbook.svg?branch=master)](https://travis-ci.org/pinoss/feedbook) [![Code Climate](https://codeclimate.com/github/pinoss/feedbook.png)](https://codeclimate.com/github/pinoss/feedbook) [![Coverage Status](https://coveralls.io/repos/pinoss/feedbook/badge.png)](https://coveralls.io/r/pinoss/feedbook)
1
+ # Feedbook [![Build Status](https://travis-ci.org/pinoss/feedbook.svg?branch=master)](https://travis-ci.org/pinoss/feedbook) [![Code Climate](https://codeclimate.com/github/pinoss/feedbook.png)](https://codeclimate.com/github/pinoss/feedbook) [![Coverage Status](https://coveralls.io/repos/pinoss/feedbook/badge.png)](https://coveralls.io/r/pinoss/feedbook) [![Gem Version](https://badge.fury.io/rb/feedbook.svg)](http://badge.fury.io/rb/feedbook)
2
2
 
3
3
  Feedbook is a simple console application that allows to notify on IRC, mail and social media (like Twitter and Facebook) about RSS/Atom updates.
4
4
 
@@ -37,9 +37,10 @@ After you create or modify your configuration file, you need to start listening
37
37
 
38
38
  $ feedbook start
39
39
  Loading configuration from file feedbook.yml... completed.
40
- Loading notifiers...
41
- Configuration loaded for TwitterNotifier
40
+ Loading plugins from ./plugins... Plugins directory could not be found in ./plugins.
41
+ Loading notifiers...
42
42
  Configuration loaded for FacebookNotifier
43
+ Configuration loaded for TwitterNotifier
43
44
  completed.
44
45
  Fetching feeds for the first use... completed.
45
46
  Listener started...
@@ -47,6 +48,32 @@ After you create or modify your configuration file, you need to start listening
47
48
 
48
49
  And Feedbook now will work and listen for changes.
49
50
 
51
+ You can specify path for the config file with -c/--config flag:
52
+
53
+ $ feedbook init -c my-feedbook-config.yml
54
+ $ feedbook start -c my-feedbook-config.yml
55
+ $ feedbook start offline -c my-feedbook-config.yml
56
+
57
+ ### Offline mode
58
+
59
+ Now you can run feedbook with 'offline mode', which means that you can run feedbook with cron or run it manually. There is nothing more to configure, simply run feedbook with command:
60
+
61
+ $ feedbook start offline
62
+ Loading configuration from file feedbook.yml... completed.
63
+ Loading plugins from ./plugins... Plugins directory could not be found in ./plugins.
64
+ Loading notifiers...
65
+ Configuration loaded for FacebookNotifier
66
+ Configuration loaded for TwitterNotifier
67
+ completed.
68
+ Reading feeds from file... canceled. File does not exist.
69
+ Fetching feeds for the first use... completed.
70
+ Fetching feeds...
71
+ No new posts found.
72
+ Saving feeds to file... completed.
73
+
74
+ You can specify path for the archive file (-a/--archive flag):
75
+ $ feedbook start offline --archive archive-feedbook.yml
76
+
50
77
  ## Configuration
51
78
 
52
79
 
@@ -66,8 +93,8 @@ configuration:
66
93
  facebook: # Facebook OAuth token
67
94
  token: SECRET_FACEBOOK_TOKEN
68
95
  twitter: # Twitter token collection
69
- consumer_key: SECRET_CONSUMER_KEY
70
- consumer_secret: SECRET_TWITTER_CONSUMER_SECRET
96
+ api_key: SECRET_API_KEY
97
+ api_secret: SECRET_API_CONSUMER_SECRET
71
98
  access_token: SECRET_TWITTER_ACCESS_TOKEN
72
99
  access_token_secret: SECRET_TWITTER_ACCESS_TOKEN_SECRET
73
100
  irc: # IRC configuration
@@ -107,16 +134,59 @@ IRC configuration is also very simple, I think it does not require any explanati
107
134
 
108
135
  Feedbook uses Liquid for generating output. If you know Mustache it will not be a problem for you to write your template, it uses same syntax, but provides more features (like tags and helpers) - you can read about Liquid on [Liquid for Designers](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers).
109
136
 
137
+ ## Plugins
138
+
139
+ Feedbook can use your custom plugins. You do not have to fork feedbook project and change source code if you want notify about RSS/Atom updates to custom Notifiers.
140
+ Currently you can have ability to use your own Notifiers and Liquid tags/filters.
141
+
142
+ By default plugins are being loaded from /plugins directory, you can set you own directory with -p/--plugins flag:
143
+
144
+ $ feedbook start --plugins ./my_custom_plugins
145
+
146
+ ### Notifiers
147
+
148
+ If you want to write your own Notifier you need to provide 2 methods: notify and load_configuration. Your Notifier should also include Singleton module.
149
+ In load_configuration method, given parameter opts gets hash with configuration from configuration file (under configuration node, you need to write name for your plugin as a node name and provide configuration under that node). Your Notifier class (in CamelCase) name should match name given in your configuration file (snake_case), ie. if you created MyCustomNotifier, notifier in configuration should be my_custom.
150
+
151
+ ```ruby
152
+ require 'singleton'
153
+
154
+ module Feedbook
155
+ module Notifiers
156
+ class YoutCustomNotifier
157
+ include Singleton
158
+
159
+ # Sends notification to Nil
160
+ # @param message [String] message to be displayed in console
161
+ #
162
+ # @return [NilClass] nil
163
+ def notify(message)
164
+ puts "New message has been notified: #{message}"
165
+ end
166
+
167
+ # Load configuration for NullNotifier
168
+ # @param configuration = {} [Hash] Configuration hash
169
+ #
170
+ # @return [NilClass] nil
171
+ def load_configuration(opts = {})
172
+ puts 'Configuration loaded for YourCustomNotifier'
173
+ end
174
+ end
175
+ end
176
+ end
177
+ ```
178
+
179
+ ### Liquid extensions
180
+
181
+ You can also write custom Liquid extensions for your templates. You can even use extensions written for Jekyll. You can read more about extending Liquid on [Liquid for Programmers](https://github.com/Shopify/liquid/wiki/Liquid-for-Programmers) page.
182
+
110
183
  ## Todo
111
184
 
112
185
  Because Feedbook is still in development there is many to do:
113
186
 
114
187
  * add Google+ Notifier
115
188
  * Unfortunately Google+ does not provides API with ability to push messages to streams. Because of that I need to find a tool that will provide that feature without use of Google+.
116
- * add more tests
117
- * I would like to add integration tests to make sure that all features work.
118
- * add offline mode
119
- * I would like to add ability to run Feedbook with cron (start Feedbook, look for changes, save list of already notified posts and turn off)
189
+ * UPDATE: It is possible (with some limitations) through Google+ API (see [moments/insert](https://developers.google.com/+/api/latest/moments/insert)), but unfortunately there are no gems that support that feature.
120
190
 
121
191
  ## Contributing
122
192
 
@@ -13,8 +13,8 @@ program_desc 'Feedbook is a simple gem and application that notifies about new p
13
13
  desc 'Parses feedbook.yml file for feeds and configuration and listen for changes in RSS/Atom feeds to notify about updates on social media sites'
14
14
  command :start do |c|
15
15
 
16
- c.flag [:c, :config], default_value: 'feedbook.yml', desc: 'Feedbook configuration file location'
17
- c.flag [:p, :plugins], default_value: './plugins', desc: 'Plugins directory'
16
+ c.flag [:c, :config], default_value: 'feedbook.yml', desc: 'Feedbook configuration file location'
17
+ c.flag [:p, :plugins], default_value: './plugins', desc: 'Plugins directory'
18
18
  c.flag [:a, :archive], default_value: 'feedbook_offline.yml', desc: 'Feedbook archive file'
19
19
 
20
20
  c.default_desc 'Parses feedbook.yml file for feeds and configuration and listen for changes in RSS/Atom feeds to notify about updates on social media sites'
@@ -0,0 +1,5 @@
1
+ class String
2
+ def camelize
3
+ split('_').map(&:capitalize).join
4
+ end
5
+ end
@@ -1,4 +1,5 @@
1
1
  require 'feedbook/notifiers'
2
+ require 'feedbook/core_ext/string'
2
3
  require 'feedbook/errors/unsupported_notifier_error'
3
4
 
4
5
  module Feedbook
@@ -22,10 +23,12 @@ module Feedbook
22
23
  when :mail, 'mail'
23
24
  Notifiers::MailNotifier.instance
24
25
  else
25
- if Notifiers.const_defined?("#{type.capitalize}Notifier")
26
- Notifiers.const_get("#{type.capitalize}Notifier").instance
26
+ if Notifiers.const_defined?("#{type.camelize}Notifier")
27
+ Notifiers.const_get("#{type.camelize}Notifier").instance
27
28
  elsif Notifiers.const_defined?("#{type.upcase}Notifier")
28
29
  Notifiers.const_get("#{type.upcase}Notifier").instance
30
+ elsif Notifiers.const_defined?("#{type.capitalize}Notifier")
31
+ Notifiers.const_get("#{type.capitalize}Notifier").instance
29
32
  else
30
33
  puts "notifier #{type} is not supported by Feedbook."
31
34
  end
@@ -33,4 +36,4 @@ module Feedbook
33
36
  end
34
37
  end
35
38
  end
36
- end
39
+ end
@@ -1,3 +1,3 @@
1
1
  module Feedbook
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe String do
4
+ describe '#camelize' do
5
+ it { expect(''.camelize).to eq('') }
6
+ it { expect('test'.camelize).to eq('Test') }
7
+ it { expect('test_tester_test'.camelize).to eq('TestTesterTest') }
8
+ it { expect('TeStEr_TTEESSTT'.camelize).to eq('TesterTteesstt') }
9
+ end
10
+ end
@@ -30,6 +30,17 @@ describe Feedbook::Factories::NotifiersFactory do
30
30
  end
31
31
 
32
32
  context 'Notifier is not defined in Factory' do
33
+ context 'and Notifier exists as TestNotifier' do
34
+ before :each do
35
+ expect(Feedbook::Notifiers).to receive(:const_defined?).with('SuperTestNotifier').and_return(true)
36
+ expect(Feedbook::Notifiers).to receive(:const_get).with('SuperTestNotifier').and_return(Feedbook::Notifiers::NullNotifier)
37
+ end
38
+
39
+ it 'returns instance of given Notifier' do
40
+ expect(Feedbook::Factories::NotifiersFactory.create('super_test')).to be(Feedbook::Notifiers::NullNotifier.instance)
41
+ end
42
+ end
43
+
33
44
  context 'and Notifier exists as TestNotifier' do
34
45
  before :each do
35
46
  expect(Feedbook::Notifiers).to receive(:const_defined?).with('TestNotifier').and_return(true)
@@ -55,7 +66,7 @@ describe Feedbook::Factories::NotifiersFactory do
55
66
 
56
67
  context 'and Notifier does not exist' do
57
68
  before :each do
58
- expect(Feedbook::Notifiers).to receive(:const_defined?).with('TestNotifier').and_return(false)
69
+ expect(Feedbook::Notifiers).to receive(:const_defined?).with('TestNotifier').and_return(false).twice
59
70
  expect(Feedbook::Notifiers).to receive(:const_defined?).with('TESTNotifier').and_return(false)
60
71
  end
61
72
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Paruszewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-31 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: feedjira
@@ -227,6 +227,7 @@ files:
227
227
  - lib/feedbook.rb
228
228
  - lib/feedbook/comparers/posts_comparer.rb
229
229
  - lib/feedbook/configuration.rb
230
+ - lib/feedbook/core_ext/string.rb
230
231
  - lib/feedbook/errors.rb
231
232
  - lib/feedbook/errors/invalid_feed_url_error.rb
232
233
  - lib/feedbook/errors/invalid_interval_format_error.rb
@@ -255,6 +256,7 @@ files:
255
256
  - spec/spec_helper.rb
256
257
  - spec/unit/lib/comparers/posts_comparer_spec.rb
257
258
  - spec/unit/lib/configuration_spec.rb
259
+ - spec/unit/lib/core_ext/string_spec.rb
258
260
  - spec/unit/lib/factories/notifiers_factory_spec.rb
259
261
  - spec/unit/lib/feed_spec.rb
260
262
  - spec/unit/lib/helpers/time_interval_parser_spec.rb
@@ -297,6 +299,7 @@ test_files:
297
299
  - spec/spec_helper.rb
298
300
  - spec/unit/lib/comparers/posts_comparer_spec.rb
299
301
  - spec/unit/lib/configuration_spec.rb
302
+ - spec/unit/lib/core_ext/string_spec.rb
300
303
  - spec/unit/lib/factories/notifiers_factory_spec.rb
301
304
  - spec/unit/lib/feed_spec.rb
302
305
  - spec/unit/lib/helpers/time_interval_parser_spec.rb