publisher_renote_dac 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7cda7fe26fff17bfe2dac78e59af632b1152288027a7c792d72b0a3a793476f0
4
+ data.tar.gz: 2a38a610f18810674f88daf2c830c5e278d5a80d59340f918d0f1a5a7c845b14
5
+ SHA512:
6
+ metadata.gz: f15051fc21df384f3653eb7bfdd54e233f26de3e7e5790d950479661c28354364f4f1fb9dfecd1ec60267bd4147d63737d12d8a6061282e8e819ff6da26d0be0
7
+ data.tar.gz: e96a9ddfd21739afeb10548796dc7125b3428cf4489eceac4a17a308cd49332ef352c83ded7eeaefa383518019f895f4fb8fce98f4ba5ab4c0214b4bd32d740a
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,34 @@
1
+ # PublisherRenoteDac
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'publisher_renote_dac'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install publisher_renote_dac
22
+ ```
23
+
24
+ ## Deployment
25
+
26
+ ```bash
27
+
28
+ ```
29
+
30
+ ## Contributing
31
+ Contribution directions go here.
32
+
33
+ ## License
34
+ 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 = 'PublisherRenoteDac'
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,5 @@
1
+ module PublisherRenoteDac
2
+ class ApplicationController < PublisherRenoteDac.configuration.base_controller.constantize
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module PublisherRenoteDac
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,29 @@
1
+ module PublisherRenoteDac
2
+
3
+ class Publisher
4
+ def self.publish(exchange, message = {})
5
+ x = channel.fanout("email.#{exchange}")
6
+ x.publish(message.to_json)
7
+ end
8
+
9
+ def self.channel
10
+ @channel ||= connection.create_channel
11
+ end
12
+
13
+ # We are using default settings here
14
+ # The `Bunny.new(...)` is a place to
15
+ # put any specific RabbitMQ settings
16
+ # like host or port
17
+ def self.connection
18
+ @connection ||= Bunny.new(
19
+ :vhost => PublisherRenoteDac.configuration.vhost,
20
+ :user => PublisherRenoteDac.configuration.username,
21
+ :password => PublisherRenoteDac.configuration.password
22
+ ).tap do |c|
23
+ c.start
24
+ end
25
+ end
26
+ end
27
+
28
+
29
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ PublisherRenoteDac::Engine.routes.draw do
2
+ end
@@ -0,0 +1,19 @@
1
+ module PublisherRenoteDac
2
+
3
+ class Configuration
4
+ attr_accessor :username, :password, :heartbeat, :exchange, :exchange_type, :vhost, :rabbitmq_queue, :base_controller, :prod_base_url, :dev_base_url
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
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ require 'bunny'
2
+
3
+ module PublisherRenoteDac
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace PublisherRenoteDac
6
+ Dir["../lib/generators/renote_dac/*.rb"].each {|file| require file }
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module PublisherRenoteDac
2
+ VERSION = '0.0.7'
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'publisher_renote_dac/version'
2
+ require 'publisher_renote_dac/engine'
3
+ require 'publisher_renote_dac/configuration'
4
+
5
+ module PublisherRenoteDac
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,40 @@
1
+ desc 'Publisher renote_dac Tasks'
2
+ namespace :publisher_renote_dac do
3
+ namespace :rabbitmq do
4
+ desc "Setup routing"
5
+ task :setup do
6
+ require "bunny"
7
+
8
+ conn = Bunny.new
9
+ conn.start
10
+
11
+ ch = conn.create_channel
12
+ # get or create exchange
13
+ x = ch.fanout(PublisherRenoteDac.configuration.exchange)
14
+ # get or create queue (note the durable setting)
15
+ queue = ch.queue(PublisherRenoteDac.configuration.rabbitmq_queue, durable: true)
16
+ # bind queue to exchange
17
+ queue.bind(PublisherRenoteDac.configuration.exchange)
18
+
19
+ conn.close
20
+ end
21
+ end
22
+
23
+ desc 'Deploy tasks'
24
+ task :deploy do
25
+ puts "Removing old .gem files"
26
+ FileUtils.rm_rf(Dir["#{PublisherRenoteDac::Engine.root}/*.gem"])
27
+
28
+ puts "Incrementing Minor Patch Version"
29
+ file = File.read(PublisherRenoteDac::Engine.root.join('lib','publisher_renote_dac','version.rb'))
30
+ version = file.match(/\d+\.\d+\.\d+/).to_s
31
+ new_version = "#{version.split(".")[(0..1)].join(".")}.#{version.split(".").last.to_i + 1}"
32
+ FileUtils.rm_rf(Dir["#{PublisherRenoteDac::Engine.root}/lib/publisher_renote_dac/version.rb"])
33
+ File.open(PublisherRenoteDac::Engine.root.join('lib', 'publisher_renote_dac', 'version.rb'), 'w') {|f| f.write("#{file.gsub(version, "#{new_version}")}") }
34
+
35
+ system "gem build publisher_renote_dac.gemspec"
36
+
37
+ system "bin/deploy 'rake app:publisher_renote_dac automatic deployment - #{version} to version #{new_version}'"
38
+ end
39
+
40
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: publisher_renote_dac
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
5
+ platform: ruby
6
+ authors:
7
+ - Sidney Leatherwood
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-02 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: bunny
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.11.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.11.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Publisher side libraries for RabbitMQ powered email publisher
56
+ email:
57
+ - leather.s.dev@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - MIT-LICENSE
63
+ - README.md
64
+ - Rakefile
65
+ - app/controllers/publisher_renote_dac/application_controller.rb
66
+ - app/models/publisher_renote_dac/application_record.rb
67
+ - app/services/publishe_renote_dac/publisher.rb
68
+ - config/routes.rb
69
+ - lib/publisher_renote_dac.rb
70
+ - lib/publisher_renote_dac/configuration.rb
71
+ - lib/publisher_renote_dac/engine.rb
72
+ - lib/publisher_renote_dac/version.rb
73
+ - lib/tasks/publisher_renote_dac_tasks.rake
74
+ homepage: https://sidneyleatherwood.com
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.7.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: renote_dac publisher service gem.
98
+ test_files: []