cloudenvoy 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint_rubocop.yml +20 -0
  3. data/.github/workflows/{test.yml → test_ruby_2.5_2.6.yml} +8 -13
  4. data/.github/workflows/test_ruby_2.7.yml +36 -0
  5. data/.github/workflows/test_ruby_3.x.yml +35 -0
  6. data/.gitignore +3 -0
  7. data/.rubocop.yml +5 -0
  8. data/Appraisals +24 -4
  9. data/CHANGELOG.md +16 -0
  10. data/README.md +7 -4
  11. data/app/controllers/cloudenvoy/subscriber_controller.rb +5 -2
  12. data/cloudenvoy.gemspec +0 -4
  13. data/examples/rails/.ruby-version +1 -1
  14. data/examples/rails/Gemfile +4 -1
  15. data/examples/rails/Gemfile.lock +139 -113
  16. data/examples/rails/README.md +1 -1
  17. data/examples/sinatra/Gemfile +18 -0
  18. data/examples/sinatra/Gemfile.lock +139 -0
  19. data/examples/sinatra/Procfile +1 -0
  20. data/examples/sinatra/README.md +41 -0
  21. data/examples/sinatra/app/publishers/hello_publisher.rb +34 -0
  22. data/examples/sinatra/app/subscribers/hello_subscriber.rb +16 -0
  23. data/examples/sinatra/app.rb +40 -0
  24. data/examples/sinatra/bin/console +8 -0
  25. data/examples/sinatra/config/initializers/cloudenvoy.rb +30 -0
  26. data/gemfiles/.bundle/config +2 -0
  27. data/gemfiles/rails_5.2.gemfile +1 -0
  28. data/gemfiles/rails_5.2.gemfile.lock +117 -92
  29. data/gemfiles/rails_6.0.gemfile +1 -0
  30. data/gemfiles/rails_6.0.gemfile.lock +118 -93
  31. data/gemfiles/rails_6.1.gemfile +8 -0
  32. data/gemfiles/rails_7.0.gemfile +8 -0
  33. data/gemfiles/semantic_logger_3.4.gemfile +1 -0
  34. data/gemfiles/semantic_logger_3.4.gemfile.lock +95 -189
  35. data/gemfiles/semantic_logger_4.6.gemfile +1 -0
  36. data/gemfiles/semantic_logger_4.6.gemfile.lock +95 -189
  37. data/gemfiles/semantic_logger_4.7.0.gemfile +1 -0
  38. data/gemfiles/semantic_logger_4.7.0.gemfile.lock +95 -189
  39. data/gemfiles/semantic_logger_4.7.2.gemfile +1 -0
  40. data/gemfiles/semantic_logger_4.7.2.gemfile.lock +95 -189
  41. data/lib/cloudenvoy/backend/google_pub_sub.rb +2 -2
  42. data/lib/cloudenvoy/message.rb +2 -2
  43. data/lib/cloudenvoy/subscriber.rb +1 -1
  44. data/lib/cloudenvoy/version.rb +1 -1
  45. data/lib/cloudenvoy.rb +1 -0
  46. data/lib/generators/cloudenvoy/publisher_generator.rb +46 -0
  47. data/lib/generators/cloudenvoy/subscriber_generator.rb +46 -0
  48. data/lib/generators/cloudenvoy/templates/publisher.rb.erb +11 -0
  49. data/lib/generators/cloudenvoy/templates/publisher_spec.rb.erb +6 -0
  50. data/lib/generators/cloudenvoy/templates/subscriber.rb.erb +11 -0
  51. data/lib/generators/cloudenvoy/templates/subscriber_spec.rb.erb +6 -0
  52. metadata +28 -51
  53. data/Gemfile.lock +0 -267
  54. data/app/controllers/cloudenvoy/application_controller.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0d42680109f30e014cb88dff9c7dc4fad3479f4cfd47131eb934c23ae0e08b2
4
- data.tar.gz: af8a2e13e9f44dfc4af98e421084772a4961833a44faeb72b113aaa2e19ea825
3
+ metadata.gz: 797f52c1101a9e1727d691794494be30e2d8d40a196d64316563596fb071d91b
4
+ data.tar.gz: e4975868db644a18733020bd78b216aa3ad2a1fb6293c554dc88f39405c39483
5
5
  SHA512:
6
- metadata.gz: 6449a39dc1bb6e066e9020d824f9c204930e3c32e07c42a9464a2d48ef2b6dc4c179a302236dbaae56f525c7fca3bda33c5ce1fcdb7f03a2234e807a706baab1
7
- data.tar.gz: 1271d88b89fc101ad5dccf86236983ff8bfaea72cdcbee52ce6bd484eb79c8cbbc4c312d73e4a73133a1bc60fb88362f49e7a663ca251ba9c0f9b2849f343fe4
6
+ metadata.gz: 056d422ee16380228e6e7e8b774669f1935fec652cfd7fad840f776096fa566e5cc6a6eecb0d4cd9839323e9a65f9bb4866d38d927d86ac0475c58af98e868c0
7
+ data.tar.gz: 1e43db1aa3f40ea7727c2bd588133bac7187e7d98a04624c6c855c29ee0f48e6375594e5c791c8f1c62b0cd47775071383fb6183fb7a960afa3c638e3b1832a7
@@ -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: Test
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.x'
16
- - '2.6.x'
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 2.6
30
- uses: actions/setup-ruby@v1
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
@@ -10,5 +10,8 @@
10
10
  /tmp/
11
11
  /log/*.log
12
12
 
13
+ # Ignore lock files (e.g. Gemfile.lock)
14
+ *.lock
15
+
13
16
  # rspec failure tracking
14
17
  .rspec_status
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
- appraise 'rails-5.2' do
4
- gem 'rails', '5.2'
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
- appraise 'rails-6.0' do
8
- gem 'rails', '6.0'
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,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.5.0](https://github.com/keypup-io/cloudenvoy/tree/v0.5.0) (2022-03-11)
4
+
5
+ [Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.4.2...v0.5.0)
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
+
3
19
  ## [v0.4.1](https://github.com/keypup-io/cloudenvoy/tree/v0.4.1) (2020-10-06)
4
20
 
5
21
  [Full Changelog](https://github.com/keypup-io/cloudenvoy/compare/v0.4.0...v0.4.1)
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  ![Build Status](https://github.com/keypup-io/cloudenvoy/workflows/Test/badge.svg) [![Gem Version](https://badge.fury.io/rb/cloudenvoy.svg)](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)
@@ -35,6 +35,9 @@ Add this line to your application's Gemfile:
35
35
 
36
36
  ```ruby
37
37
  gem 'cloudenvoy'
38
+
39
+ # For Ruby 3 support, please use v0.5.rc1
40
+ gem 'cloudenvoy, '~> 0.5.rc1'
38
41
  ```
39
42
 
40
43
  And then execute:
@@ -80,7 +83,7 @@ Cloudenvoy.configure do |config|
80
83
  end
81
84
  ```
82
85
 
83
- Define a publisher:
86
+ Define a publisher or use generator: `rails generate cloudenvoy:publisher Dummy`
84
87
  ```ruby
85
88
  # app/publishers/dummy_publisher.rb
86
89
 
@@ -100,7 +103,7 @@ class DummyPublisher
100
103
  end
101
104
  ```
102
105
 
103
- Define a subscriber:
106
+ Define a subscriber or use generator: `rails generate cloudenvoy:subscriber Dummy`
104
107
  ```ruby
105
108
  # app/subscribers/dummy_subscriber.rb
106
109
 
@@ -2,7 +2,10 @@
2
2
 
3
3
  module Cloudenvoy
4
4
  # Handle execution of Cloudenvoy subscribers
5
- class SubscriberController < ApplicationController
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
 
@@ -40,7 +43,7 @@ module Cloudenvoy
40
43
  # Get raw body
41
44
  content = request.body.read
42
45
 
43
- # Return content parsed as JSON and add job retries count
46
+ # Return content parsed as JSON
44
47
  JSON.parse(content).except('token')
45
48
  end
46
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-2.5.5
1
+ ruby-3.0.0
@@ -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 '2.5.5'
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.6.2'
13
+
11
14
  # Messaging via GCP Pub/Sub
12
15
  gem 'cloudenvoy', path: '../../'
13
16