happn 1.1.0 → 1.1.6

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: 06b2f20b019373ac23f020f1b5c060f5f5185dddba551ace75ef4fc9a129d8ec
4
- data.tar.gz: b7b767f5e7abb62eb33661afaea52b7a2695674ddd2b18255002c18ad4923fed
3
+ metadata.gz: 63d6c46bb2d768801f6c5391d84122dea75f093686ca0435f707be5b06c04f77
4
+ data.tar.gz: 18df636fedb057452deed96f0e771290d78577b6035bc22352faf353ff1a4b71
5
5
  SHA512:
6
- metadata.gz: 94cf0746e1fac94dfde7da681c1abe4c4632411d79d46123d546b41bc84a87ece483e5a9e5b0094fba1e98518fc15d9aa202ea65cb8e05accce59176122059a0
7
- data.tar.gz: c63c774536d302c301b33ba1d37e828abddf2eae9e9783b8e60ae44ea45601a3f221df5ecc13265381c00ac3ae5b25078e54e1782855b604889a06f2d38515ca
6
+ metadata.gz: 68d34bb4d5788a9190949028f6b151f51c78a8d16e87ed0966c04e542689aa304a223f44607a8c3ee57c715e581ee147054ad1588449a2163f3330e8ec60659f
7
+ data.tar.gz: bf2478e793629583060b67e3a7a5398031346417e7a68e7734b9b61cb4dc83c0345d96ef64e59b1a970858b239d50ad8d5ac9d761a6f5306bfb7a5e30ffd8e6f
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ### [1.1.6] - 2026-07-31
9
+
10
+ * Suite of tests
11
+ * Gem metadata: source code, changelog, `required_ruby_version >= 3.0`, a real description, and a package restricted to the library itself
12
+ * `Happn::Event#has_change?` and `Happn::Event#delete_change` now accept an attribute name given as a `String`, like `change_before` and `change_after` already did. They used to silently match nothing in that case.
13
+ * A query attribute explicitly set to `nil` now means _"all"_, as documented, instead of producing an empty word in the routing key. `Happn::Query` normalizes it into `:all` at build time, so the binding declared on the exchange and the local dispatch of the event agree with each other.
14
+
8
15
  ### [1.1.0] - 2026-07-30
9
16
 
10
17
  * Remove the `activesupport` dependency: `Happn::Configuration` no longer relies on `ActiveSupport::Configurable`, and `Happn::Event` no longer relies on `String#to_datetime` / `Object#try`
data/MIT-LICENSE CHANGED
@@ -1,20 +1,21 @@
1
- Copyright 2018
1
+ MIT License
2
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:
3
+ Copyright (c) 2026 Commuty SA
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
13
11
 
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.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -7,7 +7,7 @@ This gem connects a single RabbitMQ queue and bind it automatically to its excha
7
7
 
8
8
  ## Requirements
9
9
 
10
- * Ruby 2.2
10
+ * Ruby >= 3.0
11
11
  * Tested with RabbitMQ 3.5.8
12
12
  * `happn-ruby` works with or without Rails (tested with Rails 4 and 5).
13
13
 
@@ -16,7 +16,7 @@ This gem connects a single RabbitMQ queue and bind it automatically to its excha
16
16
  Add the gem to your project's Gemfile:
17
17
 
18
18
  ```ruby
19
- gem "happn", git: "https://github.com/crepesourcing/happn-ruby.git"
19
+ gem "happn"
20
20
  ```
21
21
 
22
22
  Then, configure `Happn`. If you use Rails, you can create an initializer into your Rails app (`config/initializers/happn.rb`). This code can be called anywhere before starting `Happn.init`.
@@ -105,6 +105,15 @@ end
105
105
 
106
106
  When Zeitwerk is defined and when `Rails.application.eager_load!` returns `false`, you should call `Zeitwerk::Loader.eager_load_all`.
107
107
 
108
+ ## Running the tests
109
+
110
+ The test suite is written with [RSpec](https://rspec.info) and needs no running RabbitMQ: the broker is stubbed.
111
+
112
+ ```bash
113
+ bundle install
114
+ bundle exec rake # or: bundle exec rspec
115
+ ```
116
+
108
117
  ## Overall configuration options
109
118
 
110
119
  All options have a default value. However, all of them can be changed in your `Happn.configure` block.
@@ -127,3 +136,22 @@ All options have a default value. However, all of them can be changed in your `H
127
136
  | `bunny_options` | `{}` | Hash of symbols | Optional | Additional options to add when connecting the RabbitMQ broker. This overrides the existing options with the same name. | `{ verify_peer: true }` |
128
137
  | `management_options` | `{}` | Hash of symbols | Optional | Additional options to add when accessing the RabbitMQ Managmement. This overrides the existing options with the same name. The options are defined at https://github.com/ruby-amqp/rabbitmq_http_api_client | `{ verify: false }` |
129
138
  | `on_error` | `nil` | `block` with an argument `exception` | false | When the consumption of an event raises an Error, the consumption exits. However, this block can be called before exiting the consumption execution. | `lambda { |exception| Raven.capture_exception(exception) }` (see Sentry's [documentation](https://github.com/getsentry/raven-ruby) |
139
+
140
+ ## How to release a new version
141
+
142
+ Releases are published to [RubyGems](https://rubygems.org/gems/happn) by GitHub Actions
143
+ (`.github/workflows/release.yml`), through [Trusted Publishing](https://guides.rubygems.org/trusted-publishing/):
144
+ no API key is stored in this repository, the workflow exchanges a short-lived GitHub OIDC token for a
145
+ scoped RubyGems credential.
146
+
147
+ 1. Update `Happn::VERSION` in `lib/happn/version.rb` and the `CHANGELOG.md`
148
+ 2. Commit and push these changes to `master`
149
+ 3. Tag the commit and push the tag:
150
+
151
+ ```
152
+ $ git tag -a v1.1.6 -m "Version 1.1.6"
153
+ $ git push origin v1.1.6
154
+ ```
155
+
156
+ The workflow then checks that the tag matches `Happn::VERSION`, runs the tests, builds the gem
157
+ and pushes it. It only publishes tags starting with `v`.
data/happn.gemspec CHANGED
@@ -9,17 +9,30 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Commuty"]
10
10
  spec.email = ["support@commuty.net"]
11
11
  spec.summary = "Gem to connect a RabbitMQ exchange and listen for events."
12
- spec.description = "Gem to connect a RabbitMQ exchange and listen for events."
13
- spec.homepage = "https://gitlab.spin42.me/commuty/happn"
12
+ spec.description = "Happn connects a RabbitMQ topic exchange and consumes CREPE events sequentially. " \
13
+ "It lets developers declare \"projectors\" that match events on their emitter, kind, " \
14
+ "name and status, and binds its queue to the exchange according to those matchers."
15
+ spec.homepage = "https://github.com/crepesourcing/happn-ruby"
14
16
  spec.license = "MIT"
15
17
 
16
- spec.files = `git ls-files -z`.split("\x0")
18
+ spec.required_ruby_version = ">= 3.0"
19
+
20
+ spec.metadata = {
21
+ "source_code_uri" => spec.homepage,
22
+ "changelog_uri" => "#{spec.homepage}/blob/master/CHANGELOG.md",
23
+ "bug_tracker_uri" => "#{spec.homepage}/issues",
24
+ "rubygems_mfa_required" => "true"
25
+ }
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |file|
28
+ file.start_with?("spec/", ".github/", ".claude/") ||
29
+ [".gitignore", ".rspec", "Gemfile", "Rakefile"].include?(file)
30
+ end
17
31
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
32
  spec.require_paths = ["lib"]
20
33
 
21
34
  spec.add_development_dependency "bundler", ">=1.17"
22
- spec.add_development_dependency "rake", ">=12.0"
35
+ spec.add_development_dependency "rake", ">= 13.0"
23
36
  spec.add_development_dependency "rspec", "~>3.0"
24
37
  spec.add_dependency "bunny", ">=2.19.0"
25
38
  spec.add_dependency "rabbitmq_http_api_client", ">=2.0.0"
data/lib/happn/event.rb CHANGED
@@ -70,11 +70,11 @@ module Happn
70
70
  end
71
71
 
72
72
  def has_change?(attribute_name)
73
- !changes[attribute_name].nil?
73
+ !changes[attribute_name.to_sym].nil?
74
74
  end
75
75
 
76
76
  def delete_change(attribute_name)
77
- changes.delete(attribute_name)
77
+ changes.delete(attribute_name.to_sym)
78
78
  end
79
79
 
80
80
  private
data/lib/happn/query.rb CHANGED
@@ -8,10 +8,10 @@ module Happn
8
8
  raise "'Dot' is not a valid character"
9
9
  end
10
10
 
11
- @emitter = emitter
12
- @kind = kind
13
- @name = name
14
- @status = status
11
+ @emitter = normalize(emitter)
12
+ @kind = normalize(kind)
13
+ @name = normalize(name)
14
+ @status = normalize(status)
15
15
  end
16
16
 
17
17
  def to_routing_key
@@ -20,6 +20,10 @@ module Happn
20
20
 
21
21
  private
22
22
 
23
+ def normalize(query_expression)
24
+ query_expression.nil? ? :all : query_expression
25
+ end
26
+
23
27
  def to_expression(query_expression)
24
28
  query_expression == :all ? "*" : query_expression
25
29
  end
data/lib/happn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Happn
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: happn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Commuty
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '12.0'
32
+ version: '13.0'
33
33
  type: :development
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '12.0'
39
+ version: '13.0'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rspec
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,9 @@ dependencies:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: 2.0.0
82
- description: Gem to connect a RabbitMQ exchange and listen for events.
82
+ description: Happn connects a RabbitMQ topic exchange and consumes CREPE events sequentially.
83
+ It lets developers declare "projectors" that match events on their emitter, kind,
84
+ name and status, and binds its queue to the exchange according to those matchers.
83
85
  email:
84
86
  - support@commuty.net
85
87
  executables: []
@@ -87,7 +89,6 @@ extensions: []
87
89
  extra_rdoc_files: []
88
90
  files:
89
91
  - CHANGELOG.md
90
- - Gemfile
91
92
  - MIT-LICENSE
92
93
  - README.md
93
94
  - happn.gemspec
@@ -100,10 +101,14 @@ files:
100
101
  - lib/happn/subscription.rb
101
102
  - lib/happn/subscription_repository.rb
102
103
  - lib/happn/version.rb
103
- homepage: https://gitlab.spin42.me/commuty/happn
104
+ homepage: https://github.com/crepesourcing/happn-ruby
104
105
  licenses:
105
106
  - MIT
106
- metadata: {}
107
+ metadata:
108
+ source_code_uri: https://github.com/crepesourcing/happn-ruby
109
+ changelog_uri: https://github.com/crepesourcing/happn-ruby/blob/master/CHANGELOG.md
110
+ bug_tracker_uri: https://github.com/crepesourcing/happn-ruby/issues
111
+ rubygems_mfa_required: 'true'
107
112
  rdoc_options: []
108
113
  require_paths:
109
114
  - lib
@@ -111,14 +116,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
116
  requirements:
112
117
  - - ">="
113
118
  - !ruby/object:Gem::Version
114
- version: '0'
119
+ version: '3.0'
115
120
  required_rubygems_version: !ruby/object:Gem::Requirement
116
121
  requirements:
117
122
  - - ">="
118
123
  - !ruby/object:Gem::Version
119
124
  version: '0'
120
125
  requirements: []
121
- rubygems_version: 4.0.17
126
+ rubygems_version: 3.6.9
122
127
  specification_version: 4
123
128
  summary: Gem to connect a RabbitMQ exchange and listen for events.
124
129
  test_files: []
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec