renote_dac 0.0.139
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +80 -0
- data/Rakefile +32 -0
- data/app/controllers/renote_dac/api/v1/emails_controller.rb +14 -0
- data/app/controllers/renote_dac/api/v1_controller.rb +4 -0
- data/app/controllers/renote_dac/api_controller.rb +13 -0
- data/app/controllers/renote_dac/application_controller.rb +4 -0
- data/app/helpers/renote_dac/application_helper.rb +4 -0
- data/app/jobs/renote_dac/application_job.rb +4 -0
- data/app/models/renote_dac/application_record.rb +5 -0
- data/app/models/renote_dac/email.rb +4 -0
- data/app/views/layouts/application.html.erb +16 -0
- data/app/views/layouts/renote_dac/api/v1/emails/_index.json.jbuilder +3 -0
- data/app/views/layouts/renote_dac/api/v1/emails/_show.json.jbuilder +0 -0
- data/app/workers/service_queue_worker.rb +20 -0
- data/config/initializers/sneakers.rb +2 -0
- data/config/routes.rb +9 -0
- data/config/settings.local.yml +0 -0
- data/db/migrate/20180625004758_create_renote_dac_emails.rb +17 -0
- data/lib/generators/renote_dac/install_generator.rb +72 -0
- data/lib/generators/renote_dac/templates/gemfile.rb +18 -0
- data/lib/generators/renote_dac/templates/initializer.rb +18 -0
- data/lib/generators/renote_dac/templates/routes.rb +3 -0
- data/lib/renote_dac/configuration.rb +21 -0
- data/lib/renote_dac/engine.rb +12 -0
- data/lib/renote_dac/mailer.rb +129 -0
- data/lib/renote_dac/version.rb +3 -0
- data/lib/renote_dac.rb +14 -0
- data/lib/tasks/renote_dac_tasks.rake +20 -0
- metadata +206 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9be6634d317e8b325985a8d6f87fdc998cbc848b9629cb23a8956a0f70f4b9eb
|
4
|
+
data.tar.gz: 15af8af8c42a5c5119b6f2a898b7bc0f5ac772c958ab9e69533ddeebf6784173
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4941f0a2ccb43b4e8c5f25ccda005fc5c323a2e2e412389fe0369d78d7d8bed9ea4badad915917a3d9d729568cfb3c20f619e352b818d31a323b28b65c8e3cbb
|
7
|
+
data.tar.gz: 9fcaef84e847697bffed96621296ee7792867d1c05feded653d51429d845569fe987371d5642199bb9c6b8e24c67b5cdeed8685dbc71e9494f2fd77dfd126d71
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Sidney
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# RenoteDac
|
2
|
+
This is a set of libraries and dependencies which allow you to quickly spin up a RabbitMQ powered Email/Notification Service as part of a (S)ervice (O)riented (A)rchitechture.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
To implement this gem it is necessary to implement the client-server RenoteDac configuration either manually or by installing the [renote_dac_client gem](https://github.com/leather-s/renote_dac)
|
6
|
+
|
7
|
+
RenoteDac is the subscriber end of a pub/sub notification service thats been extracted for use as a gem. The publisher app publish messages to a RabbitMQ exchange which then pushes the messages to a queue.
|
8
|
+
|
9
|
+
The remote Email/Notification service (consumer) uses a pool of workers to pull messages from the RabbitMQ queue and process them into the consumer service database. From there a worker will pull un-sent messages from the database and push them via the postmarks api in batches for delivery.
|
10
|
+
|
11
|
+
The postmark response is recorded on the email error column. Email records are left in database as a log.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'renote_dac'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
```bash
|
22
|
+
$ bundle
|
23
|
+
```
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
```bash
|
27
|
+
$ gem install renote_dac
|
28
|
+
```
|
29
|
+
|
30
|
+
to generate an initializer and database.yml file run:
|
31
|
+
```bash
|
32
|
+
$ rails g renote_dac:install
|
33
|
+
```
|
34
|
+
|
35
|
+
then bundle again because you have a clean newly generated Gemfile
|
36
|
+
```bash
|
37
|
+
bundle install
|
38
|
+
```
|
39
|
+
|
40
|
+
to copy migration into app run:
|
41
|
+
```bash
|
42
|
+
$ rake renote_dac:install:migrations
|
43
|
+
```
|
44
|
+
|
45
|
+
run migrations:
|
46
|
+
```bash
|
47
|
+
rake db:create
|
48
|
+
rake db:migrate
|
49
|
+
rake db:seed
|
50
|
+
```
|
51
|
+
|
52
|
+
## Starting Sneakers workers
|
53
|
+
|
54
|
+
first run:
|
55
|
+
```bash
|
56
|
+
export WORKERS=ServiceQueueWorker
|
57
|
+
```
|
58
|
+
|
59
|
+
then run:
|
60
|
+
```bash
|
61
|
+
rake sneakers:run
|
62
|
+
```
|
63
|
+
|
64
|
+
## Development
|
65
|
+
|
66
|
+
### Deploy
|
67
|
+
|
68
|
+
run the following rake task to
|
69
|
+
* increment version
|
70
|
+
* delete old '.gem' files
|
71
|
+
* build fresh gem
|
72
|
+
* commit & push with version message
|
73
|
+
|
74
|
+
`rake app:renote_dac:deploy`
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
Contribution directions go here.
|
78
|
+
|
79
|
+
## License
|
80
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'RenoteDac'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module RenoteDac
|
2
|
+
class Api::V1::EmailsController < Api::V1Controller
|
3
|
+
prepend_view_path "#{Rails.root.join('app', 'views').to_s}"
|
4
|
+
|
5
|
+
def show
|
6
|
+
render partial: 'layouts/renote_dac/api/v1/emails/show'
|
7
|
+
end
|
8
|
+
|
9
|
+
def index
|
10
|
+
@events = {id: 1}
|
11
|
+
render partial: 'layouts/renote_dac/api/v1/emails/index'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Renote dac</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag "renote_dac/application", media: "all" %>
|
9
|
+
<%= javascript_include_tag "renote_dac/application" %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
|
13
|
+
<%= yield %>
|
14
|
+
|
15
|
+
</body>
|
16
|
+
</html>
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'sneakers'
|
2
|
+
|
3
|
+
class ServiceQueueWorker
|
4
|
+
include Sneakers::Worker
|
5
|
+
# This worker will connect to "[named.queue]" queue
|
6
|
+
# env is set to nil since by default the actual queue name would be
|
7
|
+
# "named.queue_development"
|
8
|
+
from_queue "#{RenoteDac.configuration.rabbitmq_queue}", env: nil
|
9
|
+
|
10
|
+
# work method receives message payload in raw format
|
11
|
+
# in our case it is JSON encoded string
|
12
|
+
# which we can pass to RecentPosts service without
|
13
|
+
# changes
|
14
|
+
def work(message)
|
15
|
+
# invoke service object to save message to database
|
16
|
+
# RenoteDac.enqueue(template, email, {})
|
17
|
+
# let queue know message was received
|
18
|
+
ack!
|
19
|
+
end
|
20
|
+
end
|
data/config/routes.rb
ADDED
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateRenoteDacEmails < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :emails do |t|
|
4
|
+
t.integer :origin_app_id, null: false
|
5
|
+
t.integer :user_id
|
6
|
+
t.integer :campaign_id
|
7
|
+
t.integer :priority
|
8
|
+
t.string :template
|
9
|
+
t.string :email
|
10
|
+
t.text :params
|
11
|
+
t.string :error
|
12
|
+
t.datetime :sent_at
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module RenoteDac
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
# RenoteDac::Generators::InstallGenerator.source_root("lib/generators/renote_dac/templates")
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
|
+
|
7
|
+
desc "This generator creates a renote_dac.rb initializer file at config/initializers"
|
8
|
+
def create_initializer_file
|
9
|
+
template "initializer.rb", "config/initializers/renote_dac.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "This generator creates a routes.rb file at /config"
|
13
|
+
def create_routes_file
|
14
|
+
template "routes.rb", "config/routes.rb"
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "This generator creates a Gemfile at rails root"
|
18
|
+
def create_routes_file
|
19
|
+
FileUtils.remove_file(Rails.root.join('Gemfile').to_s)
|
20
|
+
template "gemfile.rb", "Gemfile"
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_database_yml
|
24
|
+
database_name = Rails.application.class.parent_name.underscore.gsub("_","-")
|
25
|
+
create_file('config/database.yml',
|
26
|
+
%{default: &default
|
27
|
+
adapter: 'postgresql'
|
28
|
+
encoding: unicode
|
29
|
+
pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %>
|
30
|
+
prepared_statements: false
|
31
|
+
|
32
|
+
development:
|
33
|
+
<<: *default
|
34
|
+
database: #{database_name}_dev
|
35
|
+
|
36
|
+
production:
|
37
|
+
<<: *default
|
38
|
+
}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
class MyClass
|
48
|
+
|
49
|
+
def initialize
|
50
|
+
@first_property = nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def im_a_public_method
|
54
|
+
puts 'Im public'
|
55
|
+
im_a_private_method
|
56
|
+
my_private_attribute
|
57
|
+
end
|
58
|
+
|
59
|
+
def first_property
|
60
|
+
self[:first_property]
|
61
|
+
end
|
62
|
+
|
63
|
+
def first_property=(val)
|
64
|
+
write_attribute :first_property, val
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def im_a_private_method
|
70
|
+
puts 'im private'
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
ruby '2.5.0'
|
5
|
+
|
6
|
+
gem 'rails', '~> 5.2.0'
|
7
|
+
gem 'renote_dac', git: 'git@github.com:leather-s/renote_dac.git'
|
8
|
+
|
9
|
+
gem 'bootsnap', '>= 1.1.0', require: false
|
10
|
+
|
11
|
+
group :development do
|
12
|
+
gem 'annotate'
|
13
|
+
gem 'listen', '>= 3.0.5', '< 3.2'
|
14
|
+
gem 'pry-rails'
|
15
|
+
gem 'annotate'
|
16
|
+
gem 'pragmater', require: false
|
17
|
+
gem 'rails-erd', require: false
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
RenoteDac.configure do |c|
|
2
|
+
c.username = '1234567890'
|
3
|
+
c.password = '3456789012'
|
4
|
+
c.heartbeat = 2
|
5
|
+
c.exchange = 'sneakers'
|
6
|
+
c.exchange_type = :direct
|
7
|
+
c.vhost = '/'
|
8
|
+
c.rabbitmq_queue = 'queue.name.here'
|
9
|
+
c.prod_base_url = 'http://localhost:3000'
|
10
|
+
c.dev_base_url = 'http://localhost:3000'
|
11
|
+
c.postmark_api_key = 'place key here'
|
12
|
+
c.from_address = 'Your App Name <app@name.com>'
|
13
|
+
|
14
|
+
# sets RenoteDac to inherit directly from parent app ApplicationController. use '::' to get to the root controller
|
15
|
+
# defaults to '::ApplicationController'
|
16
|
+
c.base_controller = '::ApplicationController'
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RenoteDac
|
2
|
+
|
3
|
+
class Configuration
|
4
|
+
attr_accessor :username,:password, :heartbeat, :exchange, :exchange_type, :vhost, :rabbitmq_queue, :base_controller, :prod_base_url, :dev_base_url, :postmark_api_key, :from_address
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@username = nil
|
8
|
+
@password = nil
|
9
|
+
@heartbeat = 2
|
10
|
+
@exchange = 'sneakers'
|
11
|
+
@exchange_type = :direct
|
12
|
+
@vhost = '/'
|
13
|
+
@rabbitmq_queue = nil
|
14
|
+
@base_controller = '::ApplicationController'
|
15
|
+
@prod_base_url = nil
|
16
|
+
@dev_base_url = nil
|
17
|
+
@postmark_api_key = nil
|
18
|
+
@from_address = 'Your App Name <app@name.com>'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
module RenoteDac
|
2
|
+
|
3
|
+
module Mailer
|
4
|
+
|
5
|
+
InvalidTemplate = Class.new(StandardError)
|
6
|
+
|
7
|
+
TEMPLATES = {
|
8
|
+
reset_password: { priority: 10, template_id: 5878221 }, # url, expiration
|
9
|
+
upcoming_class: { priority: 15, template_id: 5879081 }, # event_name, event_time, event_url
|
10
|
+
order_receipt: { priority: 30, template_id: 5878761 }, # reminder_time, order_id, order_date, items[{description, amount}], total
|
11
|
+
welcome: { priority: 40, template_id: 5720622 } # reminder_time
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
BATCH_ID = 0
|
15
|
+
BATCH_TEMPLATE = 1
|
16
|
+
BATCH_EMAIL = 2
|
17
|
+
BATCH_PARAMS = 3
|
18
|
+
|
19
|
+
def self.enqueue(template, email, params = {})
|
20
|
+
meta = Mailer.get_template_meta(template)
|
21
|
+
|
22
|
+
Email.create!(
|
23
|
+
priority: meta[:priority],
|
24
|
+
template: template,
|
25
|
+
email: email,
|
26
|
+
params: params
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_batch(size)
|
31
|
+
raise 'Max batch size is 500' if size > 500
|
32
|
+
|
33
|
+
Email
|
34
|
+
.where(error: nil)
|
35
|
+
.order(priority: :asc, id: :asc)
|
36
|
+
.limit(size)
|
37
|
+
.pluck(:id, :template, :email, :params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.get_template_meta(template)
|
41
|
+
meta = TEMPLATES[template.to_sym]
|
42
|
+
raise Mailer::InvalidTemplate unless meta
|
43
|
+
meta
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.base_url
|
47
|
+
if Rails.env.production?
|
48
|
+
RenoteDac.configuration.prod_base_url
|
49
|
+
else
|
50
|
+
RenoteDac.configuration.dev_base_url
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class Client
|
55
|
+
def initialize
|
56
|
+
@client = Postmark::ApiClient.new(
|
57
|
+
RenoteDac.configuration.postmark_api_key,
|
58
|
+
http_read_timeout: 20,
|
59
|
+
http_open_timeout: 10,
|
60
|
+
secure: true
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def process_batch(size = 100)
|
65
|
+
batch = Mailer.get_batch(size)
|
66
|
+
return 0 if batch.empty?
|
67
|
+
|
68
|
+
ids = []
|
69
|
+
messages = []
|
70
|
+
|
71
|
+
batch.each do |pending|
|
72
|
+
template = pending[BATCH_TEMPLATE]
|
73
|
+
params = pending[BATCH_PARAMS]
|
74
|
+
meta = Mailer.get_template_meta(template)
|
75
|
+
|
76
|
+
ids << pending[BATCH_ID]
|
77
|
+
|
78
|
+
messages << {
|
79
|
+
from: RenoteDac.configuration.from_address,
|
80
|
+
to: pending[BATCH_EMAIL],
|
81
|
+
template_id: meta[:template_id],
|
82
|
+
template_model: params,
|
83
|
+
tag: template
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
if Rails.env.production?
|
88
|
+
responses = @client.deliver_in_batches(messages)
|
89
|
+
handle_resp(ids, responses)
|
90
|
+
else
|
91
|
+
messages.each do |message|
|
92
|
+
puts "Sending message... #{message[:to]}"
|
93
|
+
end
|
94
|
+
# Dummy sending
|
95
|
+
Email.where(id: ids).update_all(error: 0)
|
96
|
+
|
97
|
+
# Live sending
|
98
|
+
#
|
99
|
+
# if you must send messages for real in development to make sure the
|
100
|
+
# templates look good, do it with care, because this uses the same
|
101
|
+
# server as in production. Don't send 5,000 emails on accident or
|
102
|
+
# Sidney will personally find you.
|
103
|
+
#
|
104
|
+
# responses = @client.deliver_in_batches(messages)
|
105
|
+
# puts responses.inspect
|
106
|
+
# handle_resp(ids, responses)
|
107
|
+
end
|
108
|
+
|
109
|
+
batch.size
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
def handle_resp(ids, responses)
|
115
|
+
raise 'Postmark response size mismatch' if ids.size != responses.size
|
116
|
+
|
117
|
+
# http://developer.postmarkapp.com/developer-api-overview.html#error-codes
|
118
|
+
#
|
119
|
+
# we originally were going to delete records with a '0' error code,
|
120
|
+
# but lets just keep an entire backlog of sent email
|
121
|
+
ActiveRecord::Base.transaction do
|
122
|
+
responses.each_with_index do |response, index|
|
123
|
+
Email.where(id: ids[index]).update_all(error: response[:error_code], sent_at: Time.now.utc)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
data/lib/renote_dac.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'renote_dac/version'
|
2
|
+
require 'renote_dac/engine'
|
3
|
+
require 'renote_dac/configuration'
|
4
|
+
|
5
|
+
module RenoteDac
|
6
|
+
class << self
|
7
|
+
attr_accessor :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configure
|
11
|
+
@configuration ||= Configuration.new
|
12
|
+
yield(configuration)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
desc 'Sneakers tasks'
|
2
|
+
namespace :renote_dac do
|
3
|
+
task :deploy do
|
4
|
+
puts "Removing old .gem files"
|
5
|
+
FileUtils.rm_rf(Dir["#{RenoteDac::Engine.root}/*.gem"])
|
6
|
+
|
7
|
+
puts "Incrementing Minor Patch Version"
|
8
|
+
file = File.read(RenoteDac::Engine.root.join('lib','renote_dac','version.rb'))
|
9
|
+
version = file.match(/\d+\.\d+\.\d+/).to_s
|
10
|
+
new_version = "#{version.split(".")[(0..1)].join(".")}.#{version.split(".").last.to_i + 1}"
|
11
|
+
FileUtils.rm_rf(Dir["#{RenoteDac::Engine.root}/lib/renote_dac/version.rb"])
|
12
|
+
File.open(RenoteDac::Engine.root.join('lib', 'renote_dac', 'version.rb'), 'w') {|f| f.write("#{file.gsub(version, "#{new_version}")}") }
|
13
|
+
|
14
|
+
system "gem build renote_dac.gemspec"
|
15
|
+
|
16
|
+
system "bin/deploy 'rake app:renote_dac automatic deployment - #{version} to version #{new_version}'"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'sneakers/tasks'
|
metadata
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: renote_dac
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.139
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sidney
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bootsnap
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pg
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.0'
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 1.0.0
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: puma
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.11'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.11'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: sqlite3
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: bcrypt
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 3.1.7
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 3.1.7
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: sneakers
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: postmark
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :runtime
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: jbuilder
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '2.7'
|
138
|
+
type: :runtime
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '2.7'
|
145
|
+
description: Rails engine for bundling all the configurations and depencies necessary
|
146
|
+
to run a remote mailing/notification service.
|
147
|
+
email:
|
148
|
+
- leather.s.dev@gmail.com
|
149
|
+
executables: []
|
150
|
+
extensions: []
|
151
|
+
extra_rdoc_files: []
|
152
|
+
files:
|
153
|
+
- MIT-LICENSE
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- app/controllers/renote_dac/api/v1/emails_controller.rb
|
157
|
+
- app/controllers/renote_dac/api/v1_controller.rb
|
158
|
+
- app/controllers/renote_dac/api_controller.rb
|
159
|
+
- app/controllers/renote_dac/application_controller.rb
|
160
|
+
- app/helpers/renote_dac/application_helper.rb
|
161
|
+
- app/jobs/renote_dac/application_job.rb
|
162
|
+
- app/models/renote_dac/application_record.rb
|
163
|
+
- app/models/renote_dac/email.rb
|
164
|
+
- app/views/layouts/application.html.erb
|
165
|
+
- app/views/layouts/renote_dac/api/v1/emails/_index.json.jbuilder
|
166
|
+
- app/views/layouts/renote_dac/api/v1/emails/_show.json.jbuilder
|
167
|
+
- app/workers/service_queue_worker.rb
|
168
|
+
- config/initializers/sneakers.rb
|
169
|
+
- config/routes.rb
|
170
|
+
- config/settings.local.yml
|
171
|
+
- db/migrate/20180625004758_create_renote_dac_emails.rb
|
172
|
+
- lib/generators/renote_dac/install_generator.rb
|
173
|
+
- lib/generators/renote_dac/templates/gemfile.rb
|
174
|
+
- lib/generators/renote_dac/templates/initializer.rb
|
175
|
+
- lib/generators/renote_dac/templates/routes.rb
|
176
|
+
- lib/renote_dac.rb
|
177
|
+
- lib/renote_dac/configuration.rb
|
178
|
+
- lib/renote_dac/engine.rb
|
179
|
+
- lib/renote_dac/mailer.rb
|
180
|
+
- lib/renote_dac/version.rb
|
181
|
+
- lib/tasks/renote_dac_tasks.rake
|
182
|
+
homepage: https://sidneyleatherwood.com
|
183
|
+
licenses:
|
184
|
+
- MIT
|
185
|
+
metadata: {}
|
186
|
+
post_install_message:
|
187
|
+
rdoc_options: []
|
188
|
+
require_paths:
|
189
|
+
- lib
|
190
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
requirements: []
|
201
|
+
rubyforge_project:
|
202
|
+
rubygems_version: 2.7.3
|
203
|
+
signing_key:
|
204
|
+
specification_version: 4
|
205
|
+
summary: Remote Notifier Dependencies and Configuration
|
206
|
+
test_files: []
|