correole 0.0.6 → 0.0.7
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 +4 -4
- data/bin/correole +2 -2
- data/config/config.yml +40 -0
- data/config/configuration.rb +2 -2
- data/config/dependencies.rb +1 -1
- data/config/{production.html.erb → templates/production.html.erb} +0 -0
- data/config/{production.txt.erb → templates/production.txt.erb} +0 -0
- data/config/{test.html.erb → templates/test.html.erb} +0 -0
- data/config/{test.txt.erb → templates/test.txt.erb} +0 -0
- data/db/migrate/0001_create_database.rb +1 -1
- data/db/migrate/0002_create_items.rb +1 -1
- data/lib/correole/api.rb +4 -1
- data/lib/correole/feed.rb +0 -1
- data/lib/correole/{purge.rb → skip.rb} +2 -2
- data/lib/correole/version.rb +1 -1
- metadata +7 -8
- data/config/example.config.yml +0 -21
- data/config/test.config.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c383918b800ea3b2cbe74401782d07e462762a89659e917275c938234e4e3aa4
|
4
|
+
data.tar.gz: 50497adea72cd5b913eb02e748a8cf521c49d5540ef65ace4efba4da67409cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8873b9c5abb6dfe2806f1ee2509d6633fb3a07c771c5df39ff78e6839ee2454ac7037a49a8d58b4ff7ca8f94d1339bf68dd150f409b0b7636e6896fddb65c645
|
7
|
+
data.tar.gz: '07618872e9306c83cb78ae5a12452f18f8f623cb28b1340b0367b2c1fbaed46207bc9d29d6021c7c9dd7956ffdb25f8d329073bec28e38471288e5e45cb329fd'
|
data/bin/correole
CHANGED
data/config/config.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
test:
|
2
|
+
quiet: true
|
3
|
+
dry_run: false
|
4
|
+
dry_run_email: test@mail.com
|
5
|
+
base_uri: http://test.ruslanledesma.com
|
6
|
+
feed: http://ruslanledesma.com/feed.xml # reset by env for end-to-end test
|
7
|
+
unsubscribe_uri: 'http://newsletter.ruslanledesma.com/unsubscribe/?email=<%= recipient %>'
|
8
|
+
confirmation_uri: http://newsletter.ruslanledesma.com/unsubscribed/
|
9
|
+
subject: 'Test <%= title %> - <%= date %>'
|
10
|
+
from: '<%= title %> <no-reply@ruslanledesma.com>'
|
11
|
+
html_template: templates/test.html.erb
|
12
|
+
plain_template: templates/test.txt.erb
|
13
|
+
smtp_host: localhost # reset by env for end-to-end test
|
14
|
+
smtp_port: 25 # reset by env for end-to-end test
|
15
|
+
smtp_user:
|
16
|
+
smtp_pass:
|
17
|
+
smtp_auth:
|
18
|
+
smtp_ttls: false
|
19
|
+
|
20
|
+
development: &dev
|
21
|
+
quiet: false
|
22
|
+
dry_run: false
|
23
|
+
dry_run_email: your.email@mail.com
|
24
|
+
base_uri: http://newsletter.ruslanledesma.com
|
25
|
+
feed: http://ruslanledesma.com/feed.xml
|
26
|
+
unsubscribe_uri: 'http://ruslanledesma.com/unsubscribe/?email=<%= recipient %>'
|
27
|
+
confirmation_uri: http://ruslanledesma.com/unsubscribed/
|
28
|
+
subject: '<%= title %>: newsletter for <%= date %>'
|
29
|
+
from: '<%= title %> <no-reply@ruslanledesma.com>'
|
30
|
+
html_template: templates/production.html.erb
|
31
|
+
plain_template: templates/production.txt.erb
|
32
|
+
smtp_host:
|
33
|
+
smtp_port:
|
34
|
+
smtp_user:
|
35
|
+
smtp_pass:
|
36
|
+
smtp_auth:
|
37
|
+
smtp_ttls:
|
38
|
+
|
39
|
+
production:
|
40
|
+
<<: *dev
|
data/config/configuration.rb
CHANGED
@@ -46,8 +46,8 @@ class Configuration
|
|
46
46
|
# Cannot store boolean values in ENV, thus this.
|
47
47
|
self.send("#{k.downcase}=".to_sym, ENV[k] == 'true')
|
48
48
|
when 'HTML_TEMPLATE', 'PLAIN_TEMPLATE'
|
49
|
-
|
50
|
-
template = File.read
|
49
|
+
path = File.expand_path "../#{ENV[k]}", __FILE__
|
50
|
+
template = File.read path rescue abort "Cannot load template #{path}."
|
51
51
|
self.send("#{k.downcase}=".to_sym, template)
|
52
52
|
when 'SMTP_USER', 'SMTP_PASS'
|
53
53
|
# For user name and password, Mail interprets '' as an input.
|
data/config/dependencies.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/correole/api.rb
CHANGED
@@ -9,12 +9,15 @@ class Api < Sinatra::Base
|
|
9
9
|
set :server, :thin
|
10
10
|
enable :logging
|
11
11
|
disable :show_exceptions
|
12
|
-
# use ActiveRecord::ConnectionAdapters::ConnectionManagement
|
13
12
|
|
14
13
|
before do
|
15
14
|
content_type 'text/plain'
|
16
15
|
end
|
17
16
|
|
17
|
+
after do
|
18
|
+
ActiveRecord::Base.clear_active_connections!
|
19
|
+
end
|
20
|
+
|
18
21
|
def subscribe(params)
|
19
22
|
response.headers['Access-Control-Allow-Origin'] = SUBSCRIBERS_ALLOWED_ORIGIN
|
20
23
|
s = Subscriber.new(email: params[:email])
|
data/lib/correole/feed.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Skip
|
2
2
|
|
3
3
|
def self.run!
|
4
4
|
qputs "Fetch feed from #{Configuration.feed}."
|
@@ -10,7 +10,7 @@ class Purge
|
|
10
10
|
end
|
11
11
|
qputs "There are #{unsent_items.length} new items. The items are the following."
|
12
12
|
unsent_items.each_with_index { |i, j| qputs "[#{j+1}] #{i.link}" }
|
13
|
-
qputs '
|
13
|
+
qputs 'Skip the new items by remembering them.'
|
14
14
|
unsent_items.each { |i| i.save }
|
15
15
|
qputs 'Done.'
|
16
16
|
end
|
data/lib/correole/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: correole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Ledesma Garza
|
@@ -202,23 +202,22 @@ extensions: []
|
|
202
202
|
extra_rdoc_files: []
|
203
203
|
files:
|
204
204
|
- bin/correole
|
205
|
+
- config/config.yml
|
205
206
|
- config/configuration.rb
|
206
207
|
- config/database.yml
|
207
208
|
- config/dependencies.rb
|
208
|
-
- config/
|
209
|
-
- config/production.
|
210
|
-
- config/
|
211
|
-
- config/test.
|
212
|
-
- config/test.html.erb
|
213
|
-
- config/test.txt.erb
|
209
|
+
- config/templates/production.html.erb
|
210
|
+
- config/templates/production.txt.erb
|
211
|
+
- config/templates/test.html.erb
|
212
|
+
- config/templates/test.txt.erb
|
214
213
|
- db/migrate/0001_create_database.rb
|
215
214
|
- db/migrate/0002_create_items.rb
|
216
215
|
- lib/correole/api.rb
|
217
216
|
- lib/correole/feed.rb
|
218
217
|
- lib/correole/item.rb
|
219
|
-
- lib/correole/purge.rb
|
220
218
|
- lib/correole/qputs.rb
|
221
219
|
- lib/correole/send.rb
|
220
|
+
- lib/correole/skip.rb
|
222
221
|
- lib/correole/subscriber.rb
|
223
222
|
- lib/correole/version.rb
|
224
223
|
homepage: http://ruslanledesma.com/
|
data/config/example.config.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
production: &prod
|
2
|
-
quiet: false
|
3
|
-
dry_run: false
|
4
|
-
dry_run_email: your.email@mail.com
|
5
|
-
base_uri: http://newsletter.ruslanledesma.com
|
6
|
-
feed: http://ruslanledesma.com/feed.xml
|
7
|
-
unsubscribe_uri: 'http://ruslanledesma.com/unsubscribe/?email=<%= recipient %>'
|
8
|
-
confirmation_uri: http://ruslanledesma.com/unsubscribed/
|
9
|
-
subject: '<%= title %>: newsletter for <%= date %>'
|
10
|
-
from: '<%= title %> <no-reply@ruslanledesma.com>'
|
11
|
-
html_template: production.html.erb
|
12
|
-
plain_template: production.txt.erb
|
13
|
-
smtp_host:
|
14
|
-
smtp_port:
|
15
|
-
smtp_user:
|
16
|
-
smtp_pass:
|
17
|
-
smtp_auth:
|
18
|
-
smtp_ttls:
|
19
|
-
|
20
|
-
development:
|
21
|
-
<<: *prod
|
data/config/test.config.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
test:
|
2
|
-
quiet: true
|
3
|
-
dry_run: false
|
4
|
-
dry_run_email: test@mail.com
|
5
|
-
base_uri: http://test.ruslanledesma.com
|
6
|
-
feed: http://ruslanledesma.com/feed.xml # reset by env for end-to-end test
|
7
|
-
unsubscribe_uri: 'http://newsletter.ruslanledesma.com/unsubscribe/?email=<%= recipient %>'
|
8
|
-
confirmation_uri: http://newsletter.ruslanledesma.com/unsubscribed/
|
9
|
-
subject: 'Test <%= title %> - <%= date %>'
|
10
|
-
from: '<%= title %> <no-reply@ruslanledesma.com>'
|
11
|
-
html_template: test.html.erb
|
12
|
-
plain_template: test.txt.erb
|
13
|
-
smtp_host: localhost # reset by env for end-to-end test
|
14
|
-
smtp_port: 25 # reset by env for end-to-end test
|
15
|
-
smtp_user:
|
16
|
-
smtp_pass:
|
17
|
-
smtp_auth:
|
18
|
-
smtp_ttls: false
|