pheme 5.3.3 → 5.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1682f45cc6381c623808a02e81ec990267fb4cae120cd201d7308d1cdd04ae58
4
- data.tar.gz: 3479b1a218f9210a0dbb79f03bbed0938f60610cc6586f44de4e521b4e4a054f
3
+ metadata.gz: 219b35c7c69ba33d474d1063586cc0d357a4ab129b84eb80a9d9229570680a15
4
+ data.tar.gz: 3dce2f5202292466c7f4653e2b68928121a7b9aa5ba0c51375d01d0575159510
5
5
  SHA512:
6
- metadata.gz: 9a70cdc3830479b6d971a7fa8610719d8da84cccbcd11c3f053250684051c6ce23239e5210fdfe1cb8225011a2c8820ffe7ac4f4f04fd46328840be8eb57cea8
7
- data.tar.gz: c7451b4b7f28b9d2f0046c7ba35867471a50369e2042b8b52f25c65cac4f19aeed82a0189f477be60b2a9c2de918e85ef5013324c7bff90628cf8e034edeec38
6
+ metadata.gz: e76e2a025181932da7cb730fa624e2ff101a5e48bf565bec1b1e75448ee59c3a92b16c79444014ca1ef202db0cfb944f03214afdffcb13b8bc62ca6e54d5764a
7
+ data.tar.gz: db2eced35f5b27bd0db443aaaa7825008c25dd06b2c3a4c4c2173435f92ace7dbf056e48604cdb0d2b0b2f76ab94a8ea26a733f939d338523253c0e3f4e9afd4
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: Default
3
+
4
+ on:
5
+ push:
6
+
7
+ concurrency:
8
+ group: ${{ github.workflow }}-${{ github.ref }}
9
+ cancel-in-progress: true
10
+
11
+ jobs:
12
+ build_and_publish:
13
+ name: Build and Publish
14
+ uses: wealthsimple/public-github-workflows/.github/workflows/ruby-gem-build.yaml@main
15
+ secrets: inherit
data/CHANGELOG.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
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
+ ## Unreleased
8
+
9
+ ## 5.3.4 - 2024-06-14
10
+ ### Changed
11
+ - Updated dependencies
12
+
7
13
  ## 5.3.3 - 2024-06-14
8
14
  ### Changed
9
15
  - Updated dependencies
@@ -169,7 +175,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
169
175
  ### Changed
170
176
  - Updated dependencies
171
177
 
172
- ### 5.0.4 - 2022-04-01
178
+ ## 5.0.4 - 2022-04-01
173
179
  ### Changed
174
180
  - Updated workflows
175
181
 
@@ -246,17 +252,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
246
252
  - Migrate CI from CircleCI to GitHub Actions
247
253
 
248
254
  ## 4.0.3 - 2021-03-08
255
+ ### Changed
249
256
  - Update documentation to include instructions on directly publishing to SQS
250
257
 
251
258
  ## 4.0.2 - 2020-12-17
259
+ ### Changed
252
260
  - Bump local dev version, rubocop fixes, add backstage catalog file + sonarqube project settings
253
261
 
254
262
  ## 4.0.1 - 2020-03-23
255
- ### Fixes
263
+ ### Fixed
256
264
  - Fixes 4.0.0. Instead of expecting message attributes in the message from `poll`, retrieves them from the right place.
257
265
 
258
266
  ## 4.0.0 - 2020-03-18
259
- ### Breaking Changes
267
+ ### Changed
260
268
  - Add the ability for SQS to receive message attributes
261
269
  - `handle` function of `QueuePoller` now takes a third parameter `message_attributes`
262
270
  - blocks or `MessageHandler`s passed to `QueuePoller` can use this `message_attributes`
@@ -302,6 +310,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
302
310
  ## 2.0.1 - 2019-01-03
303
311
  ### Changed
304
312
  - add internal gem spec to test standard gem behavior, reduces unnecessary copy and pasting
313
+
305
314
  ### Fixed
306
315
  - namespace for the VERSION constant was incorrectly set to Ws::Ws
307
316
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pheme (5.3.3)
4
+ pheme (5.3.4)
5
5
  activesupport (>= 4)
6
6
  aws-sdk-sns (~> 1.1)
7
7
  aws-sdk-sqs (~> 1.3)
@@ -63,9 +63,12 @@ GEM
63
63
  minitest (5.23.1)
64
64
  mutex_m (0.2.0)
65
65
  parallel (1.25.1)
66
+ parse_a_changelog (1.3.0)
67
+ treetop (~> 1.6)
66
68
  parser (3.3.3.0)
67
69
  ast (~> 2.4.1)
68
70
  racc
71
+ polyglot (0.3.5)
69
72
  process_executer (1.1.0)
70
73
  public_suffix (5.0.5)
71
74
  racc (1.8.0)
@@ -149,6 +152,8 @@ GEM
149
152
  rubocop-rails (~> 2.23.1)
150
153
  strscan (3.1.0)
151
154
  thor (1.3.1)
155
+ treetop (1.6.12)
156
+ polyglot (~> 0.3)
152
157
  tzinfo (2.0.6)
153
158
  concurrent-ruby (~> 1.0)
154
159
  unicode-display_width (2.5.0)
@@ -167,6 +172,7 @@ DEPENDENCIES
167
172
  bundler
168
173
  bundler-audit
169
174
  git
175
+ parse_a_changelog
170
176
  pheme!
171
177
  rake
172
178
  rspec
data/lib/pheme/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pheme
2
- VERSION = '5.3.3'.freeze
2
+ VERSION = '5.3.4'.freeze
3
3
  end
data/pheme.gemspec CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
 
31
31
  s.add_development_dependency 'bundler'
32
32
  s.add_development_dependency 'git'
33
+ s.add_development_dependency "parse_a_changelog"
33
34
  s.add_development_dependency 'rake'
34
35
  s.add_development_dependency 'rspec'
35
36
  s.add_development_dependency 'rspec-collection_matchers'
data/spec/version_spec.rb CHANGED
@@ -1,35 +1,87 @@
1
1
  require 'git'
2
+ require 'parse_a_changelog'
2
3
 
3
- describe Pheme do
4
+ RSpec.describe 'a published gem' do # rubocop:disable RSpec/DescribeClass
4
5
  def get_version(git, branch = 'HEAD')
5
6
  git.grep('VERSION = ', 'lib/*/version.rb', { object: branch }).
6
7
  map { |_sha, matches| matches.first[1] }.
7
- filter_map { |version_string| parse_version(version_string) }.
8
+ filter_map { |str| parse_version(str) }.
8
9
  first
10
+ rescue Git::GitExecuteError
11
+ # Catches failures for branch name being master
12
+ nil
9
13
  end
10
14
 
11
15
  def parse_version(string)
12
16
  string.match(/VERSION = ['"](.*)['"]/)[1]
13
17
  end
14
18
 
19
+ def main_branch
20
+ @main_branch ||=
21
+ if git.branches['origin/main']
22
+ 'origin/main'
23
+ elsif git.branches['origin/master']
24
+ 'origin/master'
25
+ else
26
+ raise StandardError,
27
+ <<~ERROR
28
+ Couldn't determine main branch.
29
+ Does 'origin/main' or 'origin/master' need to be fetched?
30
+ ERROR
31
+ end
32
+ end
33
+
34
+ def needs_version_bump?
35
+ base = git.merge_base(main_branch, 'HEAD').first&.sha
36
+ base ||= main_branch
37
+ git.diff(base, 'HEAD').any? { |diff|
38
+ not_gemfile?(diff) && not_dotfile?(diff) && not_docs?(diff) && not_spec?(diff)
39
+ }
40
+ end
41
+
42
+ def not_gemfile?(diff)
43
+ ['Gemfile', 'Gemfile.lock'].exclude?(diff.path)
44
+ end
45
+
46
+ def not_docs?(diff)
47
+ !diff.path.end_with?('.md')
48
+ end
49
+
50
+ def not_spec?(diff)
51
+ !diff.path.start_with?('spec/')
52
+ end
53
+
54
+ def not_dotfile?(diff)
55
+ # Ignore dotfiles, like .gitignore and CI files like .github/...
56
+ !diff.path.start_with?('.')
57
+ end
58
+
59
+ let(:git) { Git.open('.') }
60
+ let(:head_version) { get_version(git, 'HEAD') }
61
+
15
62
  it 'has a version number' do
16
- git = Git.open('.')
17
- head_version = get_version(git, 'HEAD')
18
63
  expect(head_version).not_to be_nil
19
64
  end
20
65
 
21
- it 'has a bumped version' do
22
- git = Git.open('.')
23
- main_version = get_version(git, 'origin/main')
66
+ it 'has a bumped version committed' do
67
+ main_version = get_version(git, main_branch)
24
68
  skip('first time publishing, no need to compare versions') if main_version.nil?
25
69
 
26
- is_main_branch = git.current_branch == 'main'
70
+ is_main_branch = git.current_branch == main_branch
27
71
  skip('already on main branch, no need to compare versions') if is_main_branch
28
72
 
29
- head_version = get_version(git, 'HEAD')
30
- puts "head_version " + head_version
31
- raise 'no version.rb file found on the current branch' if head_version.nil?
73
+ skip('Diff only contains non-code changes, no need to bump version') unless needs_version_bump?
32
74
 
33
75
  expect(Gem::Version.new(head_version)).to be > Gem::Version.new(main_version)
34
76
  end
77
+
78
+ it 'has a CHANGELOG.md file' do
79
+ expect(File).to exist('CHANGELOG.md')
80
+ end
81
+
82
+ it 'has changelog entry for current version' do
83
+ parser = ParseAChangelog.parse('CHANGELOG.md')
84
+ versions = parser.elements[2].elements.map { |element| element.elements[1].text_value }
85
+ expect(versions.first).to include(head_version)
86
+ end
35
87
  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: 5.3.3
4
+ version: 5.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Graham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-14 00:00:00.000000000 Z
11
+ date: 2024-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: parse_a_changelog
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rake
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -215,7 +229,7 @@ extra_rdoc_files: []
215
229
  files:
216
230
  - ".github/CODEOWNERS"
217
231
  - ".github/PULL_REQUEST_TEMPLATE.md"
218
- - ".github/workflows/main.yml"
232
+ - ".github/workflows/default.yaml"
219
233
  - ".github/workflows/stale.yml"
220
234
  - ".gitignore"
221
235
  - ".rspec"
@@ -1,58 +0,0 @@
1
- ---
2
- name: Pipeline
3
- on:
4
- push:
5
- concurrency:
6
- group: ${{ github.workflow }}-${{ github.ref }}
7
- cancel-in-progress: true
8
-
9
- jobs:
10
- build:
11
- name: Build
12
- runs-on: ubuntu-22.04
13
- strategy:
14
- matrix:
15
- ruby-version: [3.1.4, 3.2.3, 3.3.0]
16
- steps:
17
- - uses: actions/checkout@v3
18
- with:
19
- fetch-depth: 0
20
- - name: Set up Ruby ${{ matrix.ruby-version }}
21
- uses: ruby/setup-ruby@v1
22
- with:
23
- bundler-cache: true
24
- ruby-version: ${{ matrix.ruby-version }}
25
- - name: Lint
26
- run: bundle exec rubocop
27
- - name: Test
28
- run: bundle exec rspec
29
-
30
- # Separate `release` job from `build`, as we only want release to be run once
31
- # and not run for each ruby version in the matrix:
32
- release:
33
- name: Release
34
- if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
35
- needs: build
36
- runs-on: ubuntu-22.04
37
- steps:
38
- - uses: actions/checkout@v3
39
- with:
40
- fetch-depth: 0
41
- - name: Set up Ruby
42
- uses: ruby/setup-ruby@v1
43
- with:
44
- bundler-cache: true
45
- - name: Release the gem
46
- run: |
47
- mkdir -p ~/.gem
48
- cat << EOF > ~/.gem/credentials
49
- ---
50
- :github: Bearer ${GITHUB_TOKEN}
51
- :rubygems_api_key: ${RUBYGEMS_API_KEY}
52
- EOF
53
- chmod 0600 ~/.gem/credentials
54
- git config user.email "noreply@wealthsimple.com"
55
- git config user.name "Wolfbot"
56
- bundle exec rake release
57
- env:
58
- RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}