correole 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8f2fe3a7de80d7791152fd8a3763666393e9126af594aa3f67b4cba3e468342
4
- data.tar.gz: beb208a8c5f5798cd60f8ace8a62b7b949f1c363a2c85e8e2bc85267fb22de6d
3
+ metadata.gz: c383918b800ea3b2cbe74401782d07e462762a89659e917275c938234e4e3aa4
4
+ data.tar.gz: 50497adea72cd5b913eb02e748a8cf521c49d5540ef65ace4efba4da67409cde
5
5
  SHA512:
6
- metadata.gz: c3b3d63f74a0be04f81a0ccee3cb48d467f3920701e6cc3cd0bf8a1e516effc8a0c8cecb3c3725e8e0d410d987811a38267dd26702abf06d2d412311a6deddb2
7
- data.tar.gz: 32bdbf7124e7aed3474111af567c7cb8b1390d92807764285af43efe19be0c562c2dc8079667edaf07a7a3dd2857a1559ecbd5276dbb52a1d5b0086957604691
6
+ metadata.gz: 8873b9c5abb6dfe2806f1ee2509d6633fb3a07c771c5df39ff78e6839ee2454ac7037a49a8d58b4ff7ca8f94d1339bf68dd150f409b0b7636e6896fddb65c645
7
+ data.tar.gz: '07618872e9306c83cb78ae5a12452f18f8f623cb28b1340b0367b2c1fbaed46207bc9d29d6021c7c9dd7956ffdb25f8d329073bec28e38471288e5e45cb329fd'
@@ -15,8 +15,8 @@ when 'send'
15
15
  when 'test'
16
16
  Configuration.dry_run = true
17
17
  Send.run!
18
- when 'purge'
19
- Purge.run!
18
+ when 'skip'
19
+ Skip.run!
20
20
  else
21
21
  abort "Unknown parameters #{ARGV}."
22
22
  end
@@ -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
@@ -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
- file = File.expand_path "../#{ENV[k]}", __FILE__
50
- template = File.read file rescue abort "Cannot load template #{ENV[k]}."
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.
@@ -7,7 +7,7 @@ require 'correole/item'
7
7
  require 'correole/feed'
8
8
  require 'correole/api'
9
9
  require 'correole/send'
10
- require 'correole/purge'
10
+ require 'correole/skip'
11
11
  require 'net/http'
12
12
  require 'mail'
13
13
  require 'configuration'
@@ -1,4 +1,4 @@
1
- class CreateDatabase < ActiveRecord::Migration
1
+ class CreateDatabase < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :subscribers do |t|
4
4
  t.string :email, null: false
@@ -1,4 +1,4 @@
1
- class CreateItems < ActiveRecord::Migration
1
+ class CreateItems < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :items do |t|
4
4
  t.string :title, null: false
@@ -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])
@@ -33,5 +33,4 @@ class Feed
33
33
  return split_feed
34
34
  end
35
35
 
36
-
37
36
  end
@@ -1,4 +1,4 @@
1
- class Purge
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 'Purge the new items by remembering them.'
13
+ qputs 'Skip the new items by remembering them.'
14
14
  unsent_items.each { |i| i.save }
15
15
  qputs 'Done.'
16
16
  end
@@ -1,4 +1,4 @@
1
1
  module Correole
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  DATE = '2020-07-19'
4
4
  end
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.6
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/example.config.yml
209
- - config/production.html.erb
210
- - config/production.txt.erb
211
- - config/test.config.yml
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/
@@ -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
@@ -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