pheme 4.0.0 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +34 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +24 -17
- data/CHANGELOG.md +22 -0
- data/Gemfile.lock +138 -0
- data/README.md +10 -1
- data/catalog-info.yaml +12 -0
- data/lib/pheme/configuration.rb +1 -2
- data/lib/pheme/queue_poller.rb +22 -27
- data/lib/pheme/version.rb +1 -1
- data/pheme.gemspec +1 -2
- data/sonar-project.properties +4 -0
- data/spec/queue_poller_spec.rb +7 -8
- data/spec/spec_helper.rb +0 -5
- data/spec/version_spec.rb +7 -6
- metadata +8 -20
- data/.circleci/config.yml +0 -149
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 831f5d211fa45a5725eab09b256b39bfac28d25b6271f045466fe0c9f98d0cb6
|
4
|
+
data.tar.gz: 5e8a0b292396d2403af4da4cc6e71b883a8c4623683dd74a8c34fadc287ea0e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e130b3a280ae8302d6946a57cd3d9592eb57ab1d53da9e1408aa265640e7197f0aeab67f31510bb6ed02641641cee0155a5ab872f6aae2523d7b0d7b0bc80b
|
7
|
+
data.tar.gz: 74ea895fc3daf7d577d100950a21f559450c3d2e6fa3da2e26974c5e534d8ba62364c47a6ebaa7e24667c8705b184681715eacc1e115db2861b99f0047de5db5
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
name: Pipeline
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
name: Build
|
8
|
+
runs-on: ubuntu-20.04
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
with:
|
12
|
+
fetch-depth: 0
|
13
|
+
- uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
bundler-cache: true
|
16
|
+
- name: Lint
|
17
|
+
run: bundle exec rubocop
|
18
|
+
- name: Test
|
19
|
+
run: bundle exec rspec
|
20
|
+
- name: Release the gem
|
21
|
+
if: ${{ github.ref == 'refs/heads/main' }}
|
22
|
+
run: |
|
23
|
+
mkdir -p ~/.gem
|
24
|
+
cat << EOF > ~/.gem/credentials
|
25
|
+
---
|
26
|
+
:github: Bearer ${GITHUB_TOKEN}
|
27
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
28
|
+
EOF
|
29
|
+
chmod 0600 ~/.gem/credentials
|
30
|
+
git config user.email "noreply@wealthsimple.com"
|
31
|
+
git config user.name "Wolfbot"
|
32
|
+
bundle exec rake release
|
33
|
+
env:
|
34
|
+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-01-07 16:23:09 UTC using RuboCop version 1.6.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 19
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
12
|
+
# URISchemes: http, https
|
13
|
+
Layout/LineLength:
|
14
|
+
Max: 147
|
15
|
+
|
9
16
|
# Offense count: 2
|
17
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
10
18
|
Metrics/AbcSize:
|
11
19
|
Max: 22
|
12
20
|
|
13
21
|
# Offense count: 1
|
14
|
-
# Configuration parameters:
|
15
|
-
Metrics/ClassLength:
|
16
|
-
Max: 164
|
17
|
-
|
18
|
-
# Offense count: 1
|
22
|
+
# Configuration parameters: IgnoredMethods.
|
19
23
|
Metrics/CyclomaticComplexity:
|
20
24
|
Max: 10
|
21
25
|
|
22
|
-
# Offense count: 17
|
23
|
-
# Cop supports --auto-correct.
|
24
|
-
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
25
|
-
# URISchemes: http, https
|
26
|
-
Metrics/LineLength:
|
27
|
-
Max: 147
|
28
|
-
|
29
26
|
# Offense count: 3
|
30
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
27
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
28
|
+
# IgnoredMethods: extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended, extended
|
31
29
|
Metrics/MethodLength:
|
32
30
|
Max: 28
|
33
31
|
|
34
32
|
# Offense count: 1
|
33
|
+
# Configuration parameters: IgnoredMethods.
|
35
34
|
Metrics/PerceivedComplexity:
|
36
35
|
Max: 11
|
37
36
|
|
38
|
-
# Offense count:
|
39
|
-
# Configuration parameters: CustomTransform, IgnoreMethods.
|
37
|
+
# Offense count: 9
|
38
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
39
|
+
# Include: **/*_spec*rb*, **/spec/**/*
|
40
40
|
RSpec/FilePath:
|
41
41
|
Exclude:
|
42
42
|
- 'spec/configuration_spec.rb'
|
@@ -45,8 +45,8 @@ RSpec/FilePath:
|
|
45
45
|
- 'spec/message_type/aws_event_spec.rb'
|
46
46
|
- 'spec/message_type/sns_message_spec.rb'
|
47
47
|
- 'spec/queue_poller_spec.rb'
|
48
|
-
- 'spec/topic_publisher_spec.rb'
|
49
48
|
- 'spec/rollbar_spec.rb'
|
49
|
+
- 'spec/topic_publisher_spec.rb'
|
50
50
|
- 'spec/version_spec.rb'
|
51
51
|
|
52
52
|
# Offense count: 14
|
@@ -70,3 +70,10 @@ RSpec/VerifiedDoubles:
|
|
70
70
|
Style/GuardClause:
|
71
71
|
Exclude:
|
72
72
|
- 'lib/pheme/queue_poller.rb'
|
73
|
+
|
74
|
+
# Offense count: 2
|
75
|
+
# Cop supports --auto-correct.
|
76
|
+
Style/IfUnlessModifier:
|
77
|
+
Exclude:
|
78
|
+
- 'lib/pheme/queue_poller.rb'
|
79
|
+
- 'pheme.gemspec'
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 4.0.6 - 2021-06-28
|
8
|
+
### Changed
|
9
|
+
- Update dependencies
|
10
|
+
|
11
|
+
## 4.0.5 - 2021-04-20
|
12
|
+
### Changed
|
13
|
+
- Update dependencies
|
14
|
+
|
15
|
+
## 4.0.4 - 2021-04-16
|
16
|
+
### Changed
|
17
|
+
- Migrate CI from CircleCI to GitHub Actions
|
18
|
+
|
19
|
+
## 4.0.3 - 2021-03-08
|
20
|
+
- Update documentation to include instructions on directly publishing to SQS
|
21
|
+
|
22
|
+
## 4.0.2 - 2020-12-17
|
23
|
+
- Bump local dev version, rubocop fixes, add backstage catalog file + sonarqube project settings
|
24
|
+
|
25
|
+
## 4.0.1 - 2020-03-23
|
26
|
+
### Fixes
|
27
|
+
- Fixes 4.0.0. Instead of expecting message attributes in the message from `poll`, retrieves them from the right place.
|
28
|
+
|
7
29
|
## 4.0.0 - 2020-03-18
|
8
30
|
### Breaking Changes
|
9
31
|
- Add the ability for SQS to receive message attributes
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pheme (4.0.6)
|
5
|
+
activesupport (>= 4)
|
6
|
+
aws-sdk-sns (~> 1.1)
|
7
|
+
aws-sdk-sqs (~> 1.3)
|
8
|
+
recursive-open-struct (~> 1)
|
9
|
+
smarter_csv (~> 1)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
activesupport (6.1.3.1)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
zeitwerk (~> 2.3)
|
20
|
+
ast (2.4.2)
|
21
|
+
aws-eventstream (1.1.1)
|
22
|
+
aws-partitions (1.449.0)
|
23
|
+
aws-sdk-core (3.114.0)
|
24
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
25
|
+
aws-partitions (~> 1, >= 1.239.0)
|
26
|
+
aws-sigv4 (~> 1.1)
|
27
|
+
jmespath (~> 1.0)
|
28
|
+
aws-sdk-sns (1.40.0)
|
29
|
+
aws-sdk-core (~> 3, >= 3.112.0)
|
30
|
+
aws-sigv4 (~> 1.1)
|
31
|
+
aws-sdk-sqs (1.38.0)
|
32
|
+
aws-sdk-core (~> 3, >= 3.112.0)
|
33
|
+
aws-sigv4 (~> 1.1)
|
34
|
+
aws-sigv4 (1.2.3)
|
35
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
36
|
+
bundler-audit (0.8.0)
|
37
|
+
bundler (>= 1.2.0, < 3)
|
38
|
+
thor (~> 1.0)
|
39
|
+
concurrent-ruby (1.1.8)
|
40
|
+
diff-lcs (1.4.4)
|
41
|
+
docile (1.3.5)
|
42
|
+
git (1.8.1)
|
43
|
+
rchardet (~> 1.8)
|
44
|
+
i18n (1.8.10)
|
45
|
+
concurrent-ruby (~> 1.0)
|
46
|
+
jmespath (1.4.0)
|
47
|
+
minitest (5.14.4)
|
48
|
+
parallel (1.20.1)
|
49
|
+
parser (3.0.1.1)
|
50
|
+
ast (~> 2.4.1)
|
51
|
+
rack (2.2.3)
|
52
|
+
rainbow (3.0.0)
|
53
|
+
rake (13.0.3)
|
54
|
+
rchardet (1.8.0)
|
55
|
+
recursive-open-struct (1.1.3)
|
56
|
+
regexp_parser (2.1.1)
|
57
|
+
rexml (3.2.5)
|
58
|
+
rspec (3.10.0)
|
59
|
+
rspec-core (~> 3.10.0)
|
60
|
+
rspec-expectations (~> 3.10.0)
|
61
|
+
rspec-mocks (~> 3.10.0)
|
62
|
+
rspec-collection_matchers (1.2.0)
|
63
|
+
rspec-expectations (>= 2.99.0.beta1)
|
64
|
+
rspec-core (3.10.1)
|
65
|
+
rspec-support (~> 3.10.0)
|
66
|
+
rspec-expectations (3.10.1)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.10.0)
|
69
|
+
rspec-its (1.3.0)
|
70
|
+
rspec-core (>= 3.0.0)
|
71
|
+
rspec-expectations (>= 3.0.0)
|
72
|
+
rspec-mocks (3.10.2)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.10.0)
|
75
|
+
rspec-support (3.10.2)
|
76
|
+
rspec_junit_formatter (0.4.1)
|
77
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
78
|
+
rubocop (1.13.0)
|
79
|
+
parallel (~> 1.10)
|
80
|
+
parser (>= 3.0.0.0)
|
81
|
+
rainbow (>= 2.2.2, < 4.0)
|
82
|
+
regexp_parser (>= 1.8, < 3.0)
|
83
|
+
rexml
|
84
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
85
|
+
ruby-progressbar (~> 1.7)
|
86
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
87
|
+
rubocop-ast (1.5.0)
|
88
|
+
parser (>= 3.0.1.1)
|
89
|
+
rubocop-performance (1.11.1)
|
90
|
+
rubocop (>= 1.7.0, < 2.0)
|
91
|
+
rubocop-ast (>= 0.4.0)
|
92
|
+
rubocop-rails (2.9.1)
|
93
|
+
activesupport (>= 4.2.0)
|
94
|
+
rack (>= 1.1)
|
95
|
+
rubocop (>= 0.90.0, < 2.0)
|
96
|
+
rubocop-rspec (2.3.0)
|
97
|
+
rubocop (~> 1.0)
|
98
|
+
rubocop-ast (>= 1.1.0)
|
99
|
+
rubocop-vendor (0.6.0)
|
100
|
+
rubocop (>= 0.53.0)
|
101
|
+
ruby-progressbar (1.11.0)
|
102
|
+
simplecov (0.21.2)
|
103
|
+
docile (~> 1.1)
|
104
|
+
simplecov-html (~> 0.11)
|
105
|
+
simplecov_json_formatter (~> 0.1)
|
106
|
+
simplecov-html (0.12.3)
|
107
|
+
simplecov_json_formatter (0.1.3)
|
108
|
+
smarter_csv (1.2.8)
|
109
|
+
thor (1.1.0)
|
110
|
+
tzinfo (2.0.4)
|
111
|
+
concurrent-ruby (~> 1.0)
|
112
|
+
unicode-display_width (2.0.0)
|
113
|
+
ws-style (6.9.0)
|
114
|
+
rubocop (>= 1.12.1)
|
115
|
+
rubocop-performance (>= 1.10.2)
|
116
|
+
rubocop-rails (>= 2.9.1)
|
117
|
+
rubocop-rspec (>= 2.2.0)
|
118
|
+
rubocop-vendor (>= 0.6.0)
|
119
|
+
zeitwerk (2.4.2)
|
120
|
+
|
121
|
+
PLATFORMS
|
122
|
+
ruby
|
123
|
+
|
124
|
+
DEPENDENCIES
|
125
|
+
bundler
|
126
|
+
bundler-audit
|
127
|
+
git
|
128
|
+
pheme!
|
129
|
+
rake
|
130
|
+
rspec
|
131
|
+
rspec-collection_matchers
|
132
|
+
rspec-its
|
133
|
+
rspec_junit_formatter (~> 0.2)
|
134
|
+
simplecov
|
135
|
+
ws-style
|
136
|
+
|
137
|
+
BUNDLED WITH
|
138
|
+
2.2.16
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
# pheme
|
1
|
+
# pheme
|
2
|
+
[](https://github.com/wealthsimple/pheme/actions)
|
3
|
+
|
4
|
+
[](https://github.com/wealthsimple/pheme/actions)
|
2
5
|
|
3
6
|
Ruby SNS publisher + SQS poller & message handler
|
4
7
|
|
@@ -39,3 +42,9 @@ end
|
|
39
42
|
See https://github.com/wealthsimple/pheme/tree/master/spec/support for example implementations of each class.
|
40
43
|
|
41
44
|
TODO: write better usage instructions.
|
45
|
+
|
46
|
+
### Handling SQS messages
|
47
|
+
|
48
|
+
Pheme expects that the SQS messages it is handling will have first been published to an SNS topic
|
49
|
+
before being sent to the SQS queue. This means if the service publishing messages is publishing them
|
50
|
+
**directly** to the SQS queue, that service must nest the message payload underneath a `Message` property.
|
data/catalog-info.yaml
ADDED
data/lib/pheme/configuration.rb
CHANGED
@@ -19,8 +19,7 @@ module Pheme
|
|
19
19
|
ATTRIBUTES = %i[sns_client sqs_client logger].freeze
|
20
20
|
OPTIONAL_ATTRIBUTES = %i[rollbar].freeze
|
21
21
|
|
22
|
-
attr_accessor(*ATTRIBUTES)
|
23
|
-
attr_accessor(*OPTIONAL_ATTRIBUTES)
|
22
|
+
attr_accessor(*ATTRIBUTES, *OPTIONAL_ATTRIBUTES)
|
24
23
|
|
25
24
|
def initialize
|
26
25
|
@logger ||= Logger.new(STDOUT) # rubocop:disable Lint/DisjunctiveAssignmentInConstructor
|
data/lib/pheme/queue_poller.rb
CHANGED
@@ -58,20 +58,18 @@ module Pheme
|
|
58
58
|
queue_poller.poll(poller_configuration) do |queue_message|
|
59
59
|
@messages_received += 1
|
60
60
|
Pheme.logger.tagged(queue_message.message_id) do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
Pheme.rollbar(e, "#{self.class} failed to process message", { message: content })
|
74
|
-
end
|
61
|
+
content = parse_body(queue_message)
|
62
|
+
metadata = parse_metadata(queue_message)
|
63
|
+
message_attributes = parse_message_attributes(queue_message)
|
64
|
+
with_optional_connection_pool_block { handle(content, metadata, message_attributes) }
|
65
|
+
queue_poller.delete_message(queue_message)
|
66
|
+
log_delete(queue_message)
|
67
|
+
@messages_processed += 1
|
68
|
+
rescue SignalException
|
69
|
+
throw :stop_polling
|
70
|
+
rescue StandardError => e
|
71
|
+
Pheme.logger.error(e)
|
72
|
+
Pheme.rollbar(e, "#{self.class} failed to process message", { message: content })
|
75
73
|
end
|
76
74
|
end
|
77
75
|
log_polling_end(time_start)
|
@@ -110,8 +108,9 @@ module Pheme
|
|
110
108
|
end
|
111
109
|
|
112
110
|
def parse_message_attributes(queue_message)
|
111
|
+
message_body = JSON.parse(queue_message.body)
|
113
112
|
message_attributes = {}
|
114
|
-
|
113
|
+
message_body['MessageAttributes']&.each do |key, value|
|
115
114
|
message_attributes[key.to_sym] = coerce_message_attribute(value)
|
116
115
|
end
|
117
116
|
|
@@ -149,24 +148,20 @@ module Pheme
|
|
149
148
|
private
|
150
149
|
|
151
150
|
def coerce_message_attribute(value)
|
152
|
-
case value['
|
153
|
-
when 'String'
|
154
|
-
value['
|
155
|
-
when 'Number'
|
156
|
-
JSON.parse(value['
|
157
|
-
when 'String.Array'
|
158
|
-
JSON.parse(value['string_value'])
|
159
|
-
when 'Binary'
|
160
|
-
value['binary_value']
|
151
|
+
case value['Type']
|
152
|
+
when 'Binary', 'String'
|
153
|
+
value['Value']
|
154
|
+
when 'Number', 'String.Array'
|
155
|
+
JSON.parse(value['Value'])
|
161
156
|
else
|
162
157
|
Pheme.logger.info("Unsupported custom data type")
|
163
|
-
value["
|
158
|
+
value["Value"]
|
164
159
|
end
|
165
160
|
end
|
166
161
|
|
167
|
-
def with_optional_connection_pool_block
|
162
|
+
def with_optional_connection_pool_block(&block)
|
168
163
|
if connection_pool_block
|
169
|
-
ActiveRecord::Base.connection_pool.with_connection
|
164
|
+
ActiveRecord::Base.connection_pool.with_connection(&block)
|
170
165
|
else
|
171
166
|
yield
|
172
167
|
end
|
data/lib/pheme/version.rb
CHANGED
data/pheme.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
s.license = "MIT"
|
22
22
|
|
23
|
-
s.required_ruby_version = '>= 2.
|
23
|
+
s.required_ruby_version = '>= 2.7.3'
|
24
24
|
|
25
25
|
s.add_dependency "activesupport", ">= 4"
|
26
26
|
s.add_dependency "aws-sdk-sns", "~> 1.1"
|
@@ -29,7 +29,6 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_dependency "smarter_csv", "~> 1"
|
30
30
|
|
31
31
|
s.add_development_dependency 'bundler'
|
32
|
-
s.add_development_dependency 'coveralls', "~> 0.8"
|
33
32
|
s.add_development_dependency 'git'
|
34
33
|
s.add_development_dependency 'rake'
|
35
34
|
s.add_development_dependency 'rspec'
|
data/spec/queue_poller_spec.rb
CHANGED
@@ -146,14 +146,13 @@ describe Pheme::QueuePoller do
|
|
146
146
|
context 'when message attributes' do
|
147
147
|
let(:queue_message) do
|
148
148
|
OpenStruct.new(
|
149
|
-
body: {
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
"data_type" => data_type,
|
154
|
-
"string_value" => string_value,
|
149
|
+
body: {
|
150
|
+
Message: message,
|
151
|
+
MessageAttributes: {
|
152
|
+
key: { Type: data_type, Value: string_value },
|
155
153
|
},
|
156
|
-
},
|
154
|
+
}.to_json,
|
155
|
+
message_id: message_id,
|
157
156
|
)
|
158
157
|
end
|
159
158
|
|
@@ -419,7 +418,7 @@ describe Pheme::QueuePoller do
|
|
419
418
|
|
420
419
|
let(:queue_message) { OpenStruct.new(body: { 'Records' => records }.to_json) }
|
421
420
|
let(:records) do
|
422
|
-
[{ 'eventVersion' => '2.0',
|
421
|
+
[{ 'eventVersion' => '2.0', eventSource: 'aws:s3' }]
|
423
422
|
end
|
424
423
|
|
425
424
|
before do
|
data/spec/spec_helper.rb
CHANGED
data/spec/version_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Pheme do
|
|
4
4
|
def get_version(git, branch = 'HEAD')
|
5
5
|
git.grep('VERSION = ', 'lib/*/version.rb', { object: branch }).
|
6
6
|
map { |_sha, matches| matches.first[1] }.
|
7
|
-
map(
|
7
|
+
map { |version_string| parse_version(version_string) }.
|
8
8
|
reject(&:nil?).
|
9
9
|
first
|
10
10
|
end
|
@@ -21,14 +21,15 @@ describe Pheme do
|
|
21
21
|
|
22
22
|
it 'has a bumped version' do
|
23
23
|
git = Git.open('.')
|
24
|
-
|
24
|
+
main_version = get_version(git, 'origin/main')
|
25
|
+
skip('first time publishing, no need to compare versions') if main_version.nil?
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
is_main_branch = git.current_branch == 'main'
|
28
|
+
skip('already on main branch, no need to compare versions') if is_main_branch
|
28
29
|
|
30
|
+
head_version = get_version(git, 'HEAD')
|
29
31
|
raise 'no version.rb file found on the current branch' if head_version.nil?
|
30
|
-
raise 'no version.rb file found on the master branch' if master_version.nil?
|
31
32
|
|
32
|
-
expect(Gem::Version.new(head_version)).to be > Gem::Version.new(
|
33
|
+
expect(Gem::Version.new(head_version)).to be > Gem::Version.new(main_version)
|
33
34
|
end
|
34
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pheme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Graham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: coveralls
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.8'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.8'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: git
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,9 +213,9 @@ executables: []
|
|
227
213
|
extensions: []
|
228
214
|
extra_rdoc_files: []
|
229
215
|
files:
|
230
|
-
- ".circleci/config.yml"
|
231
216
|
- ".github/CODEOWNERS"
|
232
217
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
218
|
+
- ".github/workflows/main.yml"
|
233
219
|
- ".gitignore"
|
234
220
|
- ".rspec"
|
235
221
|
- ".rubocop.yml"
|
@@ -237,9 +223,11 @@ files:
|
|
237
223
|
- ".ruby-version"
|
238
224
|
- CHANGELOG.md
|
239
225
|
- Gemfile
|
226
|
+
- Gemfile.lock
|
240
227
|
- LICENSE
|
241
228
|
- README.md
|
242
229
|
- Rakefile
|
230
|
+
- catalog-info.yaml
|
243
231
|
- lib/pheme.rb
|
244
232
|
- lib/pheme/compression.rb
|
245
233
|
- lib/pheme/configuration.rb
|
@@ -252,6 +240,7 @@ files:
|
|
252
240
|
- lib/pheme/topic_publisher.rb
|
253
241
|
- lib/pheme/version.rb
|
254
242
|
- pheme.gemspec
|
243
|
+
- sonar-project.properties
|
255
244
|
- spec/configuration_spec.rb
|
256
245
|
- spec/logger_spec.rb
|
257
246
|
- spec/message_handler_spec.rb
|
@@ -281,15 +270,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
281
270
|
requirements:
|
282
271
|
- - ">="
|
283
272
|
- !ruby/object:Gem::Version
|
284
|
-
version:
|
273
|
+
version: 2.7.3
|
285
274
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
286
275
|
requirements:
|
287
276
|
- - ">="
|
288
277
|
- !ruby/object:Gem::Version
|
289
278
|
version: '0'
|
290
279
|
requirements: []
|
291
|
-
|
292
|
-
rubygems_version: 2.7.6
|
280
|
+
rubygems_version: 3.1.6
|
293
281
|
signing_key:
|
294
282
|
specification_version: 4
|
295
283
|
summary: Ruby SNS publisher + SQS poller & message handler
|
data/.circleci/config.yml
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
|
3
|
-
references:
|
4
|
-
defaults:
|
5
|
-
2_4_5: &defaults_2_4_5
|
6
|
-
working_directory: ~/wealthsimple
|
7
|
-
docker:
|
8
|
-
- image: circleci/ruby:2.4.5
|
9
|
-
environment:
|
10
|
-
RAILS_ENV: test
|
11
|
-
|
12
|
-
2_5_3: &defaults
|
13
|
-
working_directory: ~/wealthsimple
|
14
|
-
docker:
|
15
|
-
- image: circleci/ruby:2.5.3
|
16
|
-
environment:
|
17
|
-
RAILS_ENV: test
|
18
|
-
|
19
|
-
which_bundler: &which_bundler
|
20
|
-
run:
|
21
|
-
name: Which bundler?
|
22
|
-
command: bundle -v
|
23
|
-
|
24
|
-
bundle_install: &bundle_install
|
25
|
-
run:
|
26
|
-
name: Bundle Install
|
27
|
-
command: bundle install --jobs=4 --retry=3 --path vendor/bundle
|
28
|
-
|
29
|
-
attach_code_workspace: &attach_code_workspace
|
30
|
-
attach_workspace:
|
31
|
-
at: ~/wealthsimple
|
32
|
-
|
33
|
-
restore_bundle_dependencies: &restore_bundle_dependencies
|
34
|
-
run:
|
35
|
-
name: Restore bundle dependencies from workspace
|
36
|
-
command: bundle --path vendor/bundle
|
37
|
-
|
38
|
-
run_rspec: &run_rspec
|
39
|
-
run:
|
40
|
-
name: Run rspec
|
41
|
-
command: |
|
42
|
-
bundle exec rspec \
|
43
|
-
--require spec_helper \
|
44
|
-
--format RspecJunitFormatter \
|
45
|
-
--out test_results/rspec.xml \
|
46
|
-
--format documentation
|
47
|
-
|
48
|
-
jobs:
|
49
|
-
checkout_and_bundle_2_4_5:
|
50
|
-
<<: *defaults_2_4_5
|
51
|
-
environment:
|
52
|
-
COVERALLS_REPO_TOKEN: ''
|
53
|
-
steps:
|
54
|
-
- checkout
|
55
|
-
- *which_bundler
|
56
|
-
- *bundle_install
|
57
|
-
- *run_rspec
|
58
|
-
- store_test_results:
|
59
|
-
path: test_results
|
60
|
-
|
61
|
-
checkout_and_bundle:
|
62
|
-
<<: *defaults
|
63
|
-
steps:
|
64
|
-
- checkout
|
65
|
-
- *which_bundler
|
66
|
-
- *bundle_install
|
67
|
-
- persist_to_workspace:
|
68
|
-
root: .
|
69
|
-
paths: .
|
70
|
-
|
71
|
-
rspec:
|
72
|
-
<<: *defaults
|
73
|
-
steps:
|
74
|
-
- *attach_code_workspace
|
75
|
-
- *restore_bundle_dependencies
|
76
|
-
- *run_rspec
|
77
|
-
- store_test_results:
|
78
|
-
path: test_results
|
79
|
-
|
80
|
-
lint_check:
|
81
|
-
<<: *defaults
|
82
|
-
steps:
|
83
|
-
- *attach_code_workspace
|
84
|
-
- *restore_bundle_dependencies
|
85
|
-
- run: bundle exec rubocop
|
86
|
-
|
87
|
-
vulnerability_check:
|
88
|
-
<<: *defaults
|
89
|
-
steps:
|
90
|
-
- *attach_code_workspace
|
91
|
-
- *restore_bundle_dependencies
|
92
|
-
- run: bundle exec bundle-audit update && bundle exec bundle-audit check
|
93
|
-
|
94
|
-
release:
|
95
|
-
<<: *defaults
|
96
|
-
steps:
|
97
|
-
- checkout
|
98
|
-
- *attach_code_workspace
|
99
|
-
- *restore_bundle_dependencies
|
100
|
-
- run:
|
101
|
-
name: Release to rubygems.org
|
102
|
-
command: |
|
103
|
-
mkdir ~/.gem
|
104
|
-
echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" >> ~/.gem/credentials
|
105
|
-
chmod 600 ~/.gem/credentials
|
106
|
-
bundle exec rake release
|
107
|
-
|
108
|
-
workflows:
|
109
|
-
version: 2
|
110
|
-
build:
|
111
|
-
jobs:
|
112
|
-
- checkout_and_bundle_2_4_5:
|
113
|
-
context: wealthsimple
|
114
|
-
- checkout_and_bundle:
|
115
|
-
context: wealthsimple
|
116
|
-
- rspec:
|
117
|
-
requires:
|
118
|
-
- checkout_and_bundle
|
119
|
-
- lint_check:
|
120
|
-
requires:
|
121
|
-
- checkout_and_bundle
|
122
|
-
- vulnerability_check:
|
123
|
-
requires:
|
124
|
-
- checkout_and_bundle
|
125
|
-
- release:
|
126
|
-
context: wealthsimple
|
127
|
-
filters:
|
128
|
-
branches:
|
129
|
-
only: master
|
130
|
-
requires:
|
131
|
-
- checkout_and_bundle_2_4_5
|
132
|
-
- rspec
|
133
|
-
- lint_check
|
134
|
-
- vulnerability_check
|
135
|
-
|
136
|
-
security-audit:
|
137
|
-
triggers:
|
138
|
-
- schedule:
|
139
|
-
# 11:05 am UTC: 6:05 am EST / 7:05 am EDT
|
140
|
-
cron: "5 11 * * *"
|
141
|
-
filters:
|
142
|
-
branches:
|
143
|
-
only: master
|
144
|
-
jobs:
|
145
|
-
- checkout_and_bundle:
|
146
|
-
context: wealthsimple
|
147
|
-
- vulnerability_check:
|
148
|
-
requires:
|
149
|
-
- checkout_and_bundle
|