cloudenvoy 0.3.1 → 0.5.rc1
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/.github/workflows/lint_rubocop.yml +20 -0
- data/.github/workflows/{test.yml → test_ruby_2.5_2.6.yml} +8 -13
- data/.github/workflows/test_ruby_2.7.yml +36 -0
- data/.github/workflows/test_ruby_3.x.yml +35 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +5 -0
- data/Appraisals +24 -4
- data/CHANGELOG.md +33 -2
- data/README.md +4 -4
- data/app/controllers/cloudenvoy/subscriber_controller.rb +6 -5
- data/cloudenvoy.gemspec +0 -4
- data/examples/rails/.ruby-version +1 -1
- data/examples/rails/Gemfile +4 -1
- data/examples/rails/Gemfile.lock +132 -110
- data/examples/rails/README.md +1 -1
- data/examples/sinatra/Gemfile +18 -0
- data/examples/sinatra/Gemfile.lock +131 -0
- data/examples/sinatra/Procfile +1 -0
- data/examples/sinatra/README.md +41 -0
- data/examples/sinatra/app/publishers/hello_publisher.rb +34 -0
- data/examples/sinatra/app/subscribers/hello_subscriber.rb +16 -0
- data/examples/sinatra/app.rb +40 -0
- data/examples/sinatra/bin/console +8 -0
- data/examples/sinatra/config/initializers/cloudenvoy.rb +30 -0
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/rails_5.2.gemfile +1 -0
- data/gemfiles/rails_5.2.gemfile.lock +111 -88
- data/gemfiles/rails_6.0.gemfile +1 -0
- data/gemfiles/rails_6.0.gemfile.lock +112 -89
- data/gemfiles/rails_6.1.gemfile +8 -0
- data/gemfiles/rails_7.0.gemfile +8 -0
- data/gemfiles/semantic_logger_3.4.gemfile +1 -0
- data/gemfiles/semantic_logger_3.4.gemfile.lock +89 -187
- data/gemfiles/semantic_logger_4.6.gemfile +1 -0
- data/gemfiles/semantic_logger_4.6.gemfile.lock +89 -187
- data/gemfiles/semantic_logger_4.7.0.gemfile +1 -0
- data/gemfiles/semantic_logger_4.7.0.gemfile.lock +89 -187
- data/gemfiles/semantic_logger_4.7.2.gemfile +1 -0
- data/gemfiles/semantic_logger_4.7.2.gemfile.lock +89 -187
- data/lib/cloudenvoy/backend/google_pub_sub.rb +18 -3
- data/lib/cloudenvoy/message.rb +2 -2
- data/lib/cloudenvoy/publisher.rb +1 -0
- data/lib/cloudenvoy/subscriber.rb +3 -2
- data/lib/cloudenvoy/version.rb +1 -1
- data/lib/cloudenvoy.rb +1 -0
- data/lib/generators/cloudenvoy/publisher_generator.rb +46 -0
- data/lib/generators/cloudenvoy/subscriber_generator.rb +46 -0
- data/lib/generators/cloudenvoy/templates/publisher.rb.erb +11 -0
- data/lib/generators/cloudenvoy/templates/publisher_spec.rb.erb +6 -0
- data/lib/generators/cloudenvoy/templates/subscriber.rb.erb +11 -0
- data/lib/generators/cloudenvoy/templates/subscriber_spec.rb.erb +6 -0
- data/lib/tasks/cloudenvoy.rake +4 -4
- metadata +30 -53
- data/Gemfile.lock +0 -267
- data/app/controllers/cloudenvoy/application_controller.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4caf2ea67d821c6523a55d6a0d3049216977a51f7e7660be453e70bdf33a92a6
|
|
4
|
+
data.tar.gz: 194c131bb03da874172331f3787ff76edd874eb704e802f13ef24396ad7bab30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 57cb75713b8e617724e9424b0781e9e40853bdd1e6b2687b2361acca406740edb739f8552aa62581832983f0f5685de05d72e03d52991a902975f20cd43ff55d
|
|
7
|
+
data.tar.gz: 67034935f6b83ee47b8afaaf8bbf7199d2466b929eee885834bf7d5c9fe5f3021d5767b21632852dabdd27a7b86105c7d8617459732da7084c3ea46d41407568
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Rubocop
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v2
|
|
10
|
+
- uses: zhulik/redis-action@1.1.0
|
|
11
|
+
- name: Set up Ruby
|
|
12
|
+
uses: ruby/setup-ruby@v1
|
|
13
|
+
with:
|
|
14
|
+
ruby-version: '3.0.1'
|
|
15
|
+
bundler-cache: true
|
|
16
|
+
- name: Lint codebase
|
|
17
|
+
run: |
|
|
18
|
+
gem install bundler
|
|
19
|
+
bundle install --jobs 4 --retry 3
|
|
20
|
+
bundle exec rubocop
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Ruby 2.5/2.6
|
|
2
2
|
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ master ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ master ]
|
|
3
|
+
on: [push, pull_request]
|
|
8
4
|
|
|
9
5
|
jobs:
|
|
10
6
|
build:
|
|
@@ -12,30 +8,29 @@ jobs:
|
|
|
12
8
|
strategy:
|
|
13
9
|
matrix:
|
|
14
10
|
ruby:
|
|
15
|
-
- '2.5.
|
|
16
|
-
- '2.6.
|
|
11
|
+
- '2.5.9'
|
|
12
|
+
- '2.6.7'
|
|
17
13
|
appraisal:
|
|
18
14
|
- 'rails-5.2'
|
|
19
15
|
- 'rails-6.0'
|
|
16
|
+
- 'rails-6.1'
|
|
20
17
|
- 'semantic_logger-3.4'
|
|
21
18
|
- 'semantic_logger-4.6'
|
|
22
19
|
- 'semantic_logger-4.7.0'
|
|
23
20
|
- 'semantic_logger-4.7.2'
|
|
24
21
|
steps:
|
|
25
|
-
- name: Setup System
|
|
26
|
-
run: sudo apt-get install libsqlite3-dev
|
|
27
22
|
- uses: actions/checkout@v2
|
|
28
23
|
- uses: zhulik/redis-action@1.1.0
|
|
29
|
-
- name: Set up Ruby
|
|
30
|
-
uses:
|
|
24
|
+
- name: Set up Ruby
|
|
25
|
+
uses: ruby/setup-ruby@v1
|
|
31
26
|
with:
|
|
32
27
|
ruby-version: ${{ matrix.ruby }}
|
|
28
|
+
bundler-cache: true
|
|
33
29
|
- name: Build and test with Rake
|
|
34
30
|
env:
|
|
35
31
|
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
|
36
32
|
run: |
|
|
37
33
|
gem install bundler
|
|
38
34
|
bundle install --jobs 4 --retry 3
|
|
39
|
-
bundle exec rubocop
|
|
40
35
|
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
|
41
36
|
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Ruby 2.7
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
ruby:
|
|
11
|
+
- '2.7.5'
|
|
12
|
+
appraisal:
|
|
13
|
+
- 'rails-5.2'
|
|
14
|
+
- 'rails-6.0'
|
|
15
|
+
- 'rails-6.1'
|
|
16
|
+
- 'rails-7.0'
|
|
17
|
+
- 'semantic_logger-3.4'
|
|
18
|
+
- 'semantic_logger-4.6'
|
|
19
|
+
- 'semantic_logger-4.7.0'
|
|
20
|
+
- 'semantic_logger-4.7.2'
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v2
|
|
23
|
+
- uses: zhulik/redis-action@1.1.0
|
|
24
|
+
- name: Set up Ruby
|
|
25
|
+
uses: ruby/setup-ruby@v1
|
|
26
|
+
with:
|
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
|
28
|
+
bundler-cache: true
|
|
29
|
+
- name: Build and test with Rake
|
|
30
|
+
env:
|
|
31
|
+
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
|
32
|
+
run: |
|
|
33
|
+
gem install bundler
|
|
34
|
+
bundle install --jobs 4 --retry 3
|
|
35
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
|
36
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Ruby 3.x
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
ruby:
|
|
11
|
+
- '3.0.1'
|
|
12
|
+
# - '3.1.0'
|
|
13
|
+
appraisal:
|
|
14
|
+
- 'rails-6.1'
|
|
15
|
+
- 'rails-7.0'
|
|
16
|
+
- 'semantic_logger-3.4'
|
|
17
|
+
- 'semantic_logger-4.6'
|
|
18
|
+
- 'semantic_logger-4.7.0'
|
|
19
|
+
- 'semantic_logger-4.7.2'
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v2
|
|
22
|
+
- uses: zhulik/redis-action@1.1.0
|
|
23
|
+
- name: Set up Ruby
|
|
24
|
+
uses: ruby/setup-ruby@v1
|
|
25
|
+
with:
|
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
|
27
|
+
bundler-cache: true
|
|
28
|
+
- name: Build and test with Rake
|
|
29
|
+
env:
|
|
30
|
+
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
|
31
|
+
run: |
|
|
32
|
+
gem install bundler
|
|
33
|
+
bundle install --jobs 4 --retry 3
|
|
34
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
|
35
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -5,6 +5,11 @@ AllCops:
|
|
|
5
5
|
- 'gemfiles/**/*'
|
|
6
6
|
- 'vendor/**/*'
|
|
7
7
|
|
|
8
|
+
# Ruby 3.0: curly braces around last argument has meaning
|
|
9
|
+
# See: https://github.com/rubocop/rubocop/issues/7641
|
|
10
|
+
Style/BracesAroundHashParameters:
|
|
11
|
+
Enabled: false
|
|
12
|
+
|
|
8
13
|
Metrics/ClassLength:
|
|
9
14
|
Max: 150
|
|
10
15
|
|
data/Appraisals
CHANGED
|
@@ -1,25 +1,45 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
if RUBY_VERSION < '3'
|
|
4
|
+
appraise 'rails-5.2' do
|
|
5
|
+
gem 'rails', '5.2'
|
|
6
|
+
gem 'rspec-rails'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
appraise 'rails-6.0' do
|
|
10
|
+
gem 'rails', '6.0'
|
|
11
|
+
gem 'rspec-rails'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
appraise 'rails-6.1' do
|
|
16
|
+
gem 'rails', '6.1'
|
|
17
|
+
gem 'rspec-rails'
|
|
5
18
|
end
|
|
6
19
|
|
|
7
|
-
|
|
8
|
-
|
|
20
|
+
if RUBY_VERSION >= '2.7'
|
|
21
|
+
appraise 'rails-7.0' do
|
|
22
|
+
gem 'rails', '7.0'
|
|
23
|
+
gem 'rspec-rails'
|
|
24
|
+
end
|
|
9
25
|
end
|
|
10
26
|
|
|
11
27
|
appraise 'semantic_logger-3.4' do
|
|
28
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
12
29
|
gem 'semantic_logger', '3.4.1'
|
|
13
30
|
end
|
|
14
31
|
|
|
15
32
|
appraise 'semantic_logger-4.6' do
|
|
33
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
16
34
|
gem 'semantic_logger', '4.6.1'
|
|
17
35
|
end
|
|
18
36
|
|
|
19
37
|
appraise 'semantic_logger-4.7.0' do
|
|
38
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
20
39
|
gem 'semantic_logger', '4.7.0'
|
|
21
40
|
end
|
|
22
41
|
|
|
23
42
|
appraise 'semantic_logger-4.7.2' do
|
|
43
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
|
24
44
|
gem 'semantic_logger', '4.7.2'
|
|
25
45
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [v0.
|
|
3
|
+
## [v0.5.rc1](https://github.com/keypup-io/cloudenvoy/tree/v0.5.rc1) (2022-01-05)
|
|
4
4
|
|
|
5
|
-
[Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.
|
|
5
|
+
[Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.4.2...v0.5.rc1)
|
|
6
|
+
|
|
7
|
+
**Improvements:**
|
|
8
|
+
- Ruby 3: Rework method arguments to be compatible with Ruby 3
|
|
9
|
+
- Tests: Separate test environment for Ruby 2 and Ruby 3
|
|
10
|
+
- Tests: Do not load Rails by default and skip Rails-specific tests in non-Rails appraisals
|
|
11
|
+
|
|
12
|
+
## [v0.4.2](https://github.com/keypup-io/cloudenvoy/tree/v0.4.2) (2021-10-25)
|
|
13
|
+
|
|
14
|
+
[Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.4.1...v0.4.2)
|
|
15
|
+
|
|
16
|
+
**Bug fix:**
|
|
17
|
+
- Message processing: fix subscription parsing for topic names with dots.
|
|
18
|
+
|
|
19
|
+
## [v0.4.1](https://github.com/keypup-io/cloudenvoy/tree/v0.4.1) (2020-10-06)
|
|
20
|
+
|
|
21
|
+
[Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.4.0...v0.4.1)
|
|
22
|
+
|
|
23
|
+
**Bug fix:**
|
|
24
|
+
- Logging: log publisher and subscriber errors during execution
|
|
25
|
+
- Rake tasks: fix early return statement when publisher or subscriber list is empty
|
|
26
|
+
|
|
27
|
+
## [v0.4.0](https://github.com/keypup-io/cloudenvoy/tree/v0.4.0) (2020-10-05)
|
|
28
|
+
|
|
29
|
+
[Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.3.1...v0.4.0)
|
|
6
30
|
|
|
7
31
|
**Bug fix:**
|
|
8
32
|
- Logging: fix log processing with `semantic_logger` `v4.7.2`. Accept any args on block passed to the logger.
|
|
9
33
|
|
|
34
|
+
## [v0.3.1](https://github.com/keypup-io/cloudenvoy/tree/v0.3.1) (2020-10-05)
|
|
35
|
+
|
|
36
|
+
[Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.3.0...v0.3.1)
|
|
37
|
+
|
|
38
|
+
**Improvements:**
|
|
39
|
+
- Development: auto-create topics in development mode when registering subscriptions.
|
|
40
|
+
|
|
10
41
|
## [v0.3.0](https://github.com/keypup-io/cloudenvoy/tree/v0.3.0) (2020-09-26)
|
|
11
42
|
|
|
12
43
|
[Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.2.0...v0.3.0)
|
data/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
 [](https://badge.fury.io/rb/cloudenvoy)
|
|
2
2
|
|
|
3
|
-
**Note**: this gem is currently in alpha stage and has not been tested in production yet.
|
|
4
|
-
|
|
5
3
|
# Cloudenvoy
|
|
6
4
|
|
|
7
5
|
Cross-application messaging framework for GCP Pub/Sub.
|
|
@@ -12,6 +10,8 @@ Pub/Sub solves that event distribution problem by allowing developers to define
|
|
|
12
10
|
|
|
13
11
|
Cloudenvoy works with the local pub/sub emulator as well, meaning that you can work offline without access to GCP.
|
|
14
12
|
|
|
13
|
+
**Maturity**: The gem is relatively young but is production-friendly. We at Keypup have already processed hundreds of thousands of pub/sub messages through Cloudenvoy. If you spot any bug, feel free to report it! we're aiming at a `v1.0.0` around Q1 2022.
|
|
14
|
+
|
|
15
15
|
## Summary
|
|
16
16
|
|
|
17
17
|
1. [Installation](#installation)
|
|
@@ -80,7 +80,7 @@ Cloudenvoy.configure do |config|
|
|
|
80
80
|
end
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
Define a publisher:
|
|
83
|
+
Define a publisher or use generator: `rails generate cloudenvoy:publisher Dummy`
|
|
84
84
|
```ruby
|
|
85
85
|
# app/publishers/dummy_publisher.rb
|
|
86
86
|
|
|
@@ -100,7 +100,7 @@ class DummyPublisher
|
|
|
100
100
|
end
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
Define a subscriber:
|
|
103
|
+
Define a subscriber or use generator: `rails generate cloudenvoy:subscriber Dummy`
|
|
104
104
|
```ruby
|
|
105
105
|
# app/subscribers/dummy_subscriber.rb
|
|
106
106
|
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Cloudenvoy
|
|
4
4
|
# Handle execution of Cloudenvoy subscribers
|
|
5
|
-
class SubscriberController <
|
|
5
|
+
class SubscriberController < ActionController::Base
|
|
6
|
+
# No need for CSRF verification on API endpoints
|
|
7
|
+
skip_before_action :verify_authenticity_token
|
|
8
|
+
|
|
6
9
|
# Authenticate all requests.
|
|
7
10
|
before_action :authenticate!
|
|
8
11
|
|
|
@@ -22,10 +25,8 @@ module Cloudenvoy
|
|
|
22
25
|
rescue InvalidSubscriberError
|
|
23
26
|
# 404: Message delivery will be retried
|
|
24
27
|
head :not_found
|
|
25
|
-
rescue StandardError
|
|
28
|
+
rescue StandardError
|
|
26
29
|
# 422: Message delivery will be retried
|
|
27
|
-
Cloudenvoy.logger.error(e)
|
|
28
|
-
Cloudenvoy.logger.error(e.backtrace.join("\n"))
|
|
29
30
|
head :unprocessable_entity
|
|
30
31
|
end
|
|
31
32
|
|
|
@@ -42,7 +43,7 @@ module Cloudenvoy
|
|
|
42
43
|
# Get raw body
|
|
43
44
|
content = request.body.read
|
|
44
45
|
|
|
45
|
-
# Return content parsed as JSON
|
|
46
|
+
# Return content parsed as JSON
|
|
46
47
|
JSON.parse(content).except('token')
|
|
47
48
|
end
|
|
48
49
|
end
|
data/cloudenvoy.gemspec
CHANGED
|
@@ -40,8 +40,4 @@ Gem::Specification.new do |spec|
|
|
|
40
40
|
spec.add_development_dependency 'semantic_logger'
|
|
41
41
|
spec.add_development_dependency 'timecop'
|
|
42
42
|
spec.add_development_dependency 'webmock'
|
|
43
|
-
|
|
44
|
-
spec.add_development_dependency 'rails'
|
|
45
|
-
spec.add_development_dependency 'rspec-rails'
|
|
46
|
-
spec.add_development_dependency 'sqlite3'
|
|
47
43
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-
|
|
1
|
+
ruby-3.0.0
|
data/examples/rails/Gemfile
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
source 'https://rubygems.org'
|
|
4
4
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
5
5
|
|
|
6
|
-
ruby '
|
|
6
|
+
ruby '3.0.0'
|
|
7
7
|
|
|
8
8
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
9
9
|
gem 'rails', '~> 6.0.2'
|
|
10
10
|
|
|
11
|
+
# Server
|
|
12
|
+
gem 'puma', '~> 5.5.2'
|
|
13
|
+
|
|
11
14
|
# Messaging via GCP Pub/Sub
|
|
12
15
|
gem 'cloudenvoy', path: '../../'
|
|
13
16
|
|