ownership 0.4.0 → 0.5.0

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: 24115b22ad0814c98dbb02a7fe2fb84af7149d9b8d2e4a052b05bba5b650cf54
4
- data.tar.gz: 48b57d21ec9275b84aed0c4250a29ec1833688c737b2d5b2ec77c2969ea245cb
3
+ metadata.gz: 0723f75e9bb391d89f88e06c4686efc39b9c6e052cab1c8787412cb084a77bb7
4
+ data.tar.gz: 2b495a405e852a695ffcc56ba30ce3910ebe4e039afb62aaa9872ca912c5f332
5
5
  SHA512:
6
- metadata.gz: 7b9efc666b672de029ecc86f083207ef11af64ba62d7c6bc760b1228d8fb9ddc951281d20e91f328073d19306f907e0ac5b0c734b09a6b8a18f96a84dbf715f0
7
- data.tar.gz: 8469963791b7750afc38ecc662a5e0af1c4385836bd6af8deb9e6f0d6a31ecc2e0d1f00f01559b1dfcc2a8bf86ab39b6a930d2eb1f3db13bdae3000ebbc71b67
6
+ metadata.gz: 67fc999361bffcb73ead84fa6fd39fe959a5069309f78060fdf81f2e36cb3b3ef7c1ca04e5a2731278b076eada4860a9c0f23ddc62caef8f8f91413d1978a6ed
7
+ data.tar.gz: af4ab99285ec7ff5b127dcb715eacade86fd7b78f3d4aae39c65da1cbacccfab1946b4584a4f3c796d13734f5524fd8c5c40048af9b88ef79414002f2197f9f1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.5.0 (2025-10-26)
2
+
3
+ - Dropped support for Ruby < 3.2 and Rails < 7.2
4
+ - Dropped support for Marginalia
5
+
1
6
  ## 0.4.0 (2024-10-01)
2
7
 
3
8
  - Added support for Rails 8
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2023 Andrew Kane
1
+ Copyright (c) 2017-2025 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -68,15 +68,15 @@ Ownership.default_owner = :logistics
68
68
  There are a few built-in integrations with other gems.
69
69
 
70
70
  - [Active Record](#active-record)
71
+ - [AppSignal](#appsignal)
71
72
  - [Honeybadger](#honeybadger)
72
- - [Marginalia](#marginalia)
73
73
  - [Rollbar](#rollbar)
74
74
 
75
75
  You can also add [custom integrations](#custom-integrations).
76
76
 
77
77
  ### Active Record
78
78
 
79
- Active Record 7+ has the option to add comments to queries.
79
+ Active Record has the option to add comments to queries.
80
80
 
81
81
  ```sql
82
82
  SELECT ...
@@ -90,6 +90,12 @@ config.active_record.query_log_tags_enabled = true
90
90
  config.active_record.query_log_tags << :owner
91
91
  ```
92
92
 
93
+ ### AppSignal
94
+
95
+ The [AppSignal gem integrates with Ownership](https://docs.appsignal.com/ruby/integrations/ownership.html) automatically. Error and performance samples in AppSignal will be tagged with the specified owner.
96
+
97
+ You can set AppSignal's [`ownership_set_namespace` configuration option](https://docs.appsignal.com/ruby/configuration/options.html#option-ownership_set_namespace) to `true` in order to use the specified owner as an AppSignal namespace, which allows you to easily list performance actions and error incidents for each namespace.
98
+
93
99
  ### Honeybadger
94
100
 
95
101
  [Honeybadger](https://github.com/honeybadger-io/honeybadger-ruby) tracks exceptions. This integration makes it easy to send exceptions to different projects based on the owner. We recommend having a project for each team.
@@ -107,17 +113,6 @@ Also works with a proc
107
113
  Ownership::Honeybadger.api_keys = ->(owner) { ENV["#{owner.to_s.upcase}_HONEYBADGER_API_KEY"] }
108
114
  ```
109
115
 
110
- ### Marginalia
111
-
112
- [Marginalia](https://github.com/basecamp/marginalia) adds comments to Active Record queries. If installed, the owner is added.
113
-
114
- ```sql
115
- SELECT ...
116
- /*application:MyApp,controller:posts,action:index,owner:logistics*/
117
- ```
118
-
119
- This can be useful when looking at the most time-consuming queries on your database.
120
-
121
116
  ### Rollbar
122
117
 
123
118
  [Rollbar](https://github.com/rollbar/rollbar-gem) tracks exceptions. This integration makes it easy to send exceptions to different projects based on the owner. We recommend having a project for each team.
@@ -153,8 +148,6 @@ Ownership.around_change = proc do |owner, block|
153
148
  end
154
149
  ```
155
150
 
156
- Please don’t hesitate to [submit a pull request](https://github.com/ankane/ownership/pulls) if you create an integration that others can use.
157
-
158
151
  Exceptions that bubble up from an `owner` block have the owner, which your exception reporting library can use.
159
152
 
160
153
  ```ruby
@@ -177,7 +170,7 @@ Thanks to [Nick Elser](https://github.com/nickelser) for creating this pattern.
177
170
 
178
171
  ## History
179
172
 
180
- View the [changelog](https://github.com/ankane/ownership/blob/master/CHANGELOG.md).
173
+ View the [changelog](https://github.com/ankane/ownership/blob/master/CHANGELOG.md)
181
174
 
182
175
  ## Contributing
183
176
 
@@ -5,8 +5,8 @@ module Ownership
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  class_methods do
8
- def owner(owner, options = {})
9
- around_action options do |_, block|
8
+ def owner(owner, **options)
9
+ around_action(**options) do |_, block|
10
10
  owner(owner) { block.call }
11
11
  end
12
12
  end
@@ -2,12 +2,7 @@ module Ownership
2
2
  module GlobalMethods
3
3
  private
4
4
 
5
- def owner(*args, &block)
6
- return super if is_a?(Method) # hack for pry
7
-
8
- owner = args[0]
9
- # same error message as Ruby
10
- raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 1)" if args.size != 1
5
+ def owner(owner, &block)
11
6
  raise ArgumentError, "Missing block" unless block_given?
12
7
 
13
8
  previous_value = Thread.current[:ownership_owner]
@@ -5,9 +5,9 @@ module Ownership
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  class_methods do
8
- def owner(*args)
8
+ def owner(owner)
9
9
  around_perform do |_, block|
10
- owner(*args) { block.call }
10
+ owner(owner) { block.call }
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module Ownership
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/ownership.rb CHANGED
@@ -18,29 +18,23 @@ end
18
18
 
19
19
  Object.include Ownership::GlobalMethods
20
20
 
21
- if defined?(ActiveSupport)
21
+ if defined?(ActiveSupport.on_load)
22
22
  ActiveSupport.on_load(:action_controller) do
23
23
  require_relative "ownership/controller_methods"
24
24
  include Ownership::ControllerMethods
25
25
  end
26
26
 
27
27
  ActiveSupport.on_load(:active_record) do
28
- if ActiveRecord::VERSION::MAJOR >= 7
29
- # taggings is frozen in Active Record 8
30
- if !ActiveRecord::QueryLogs.taggings[:owner]
31
- ActiveRecord::QueryLogs.taggings = ActiveRecord::QueryLogs.taggings.merge({owner: -> { Ownership.owner }})
32
- end
28
+ # taggings is frozen in Active Record 8
29
+ if !ActiveRecord::QueryLogs.taggings[:owner]
30
+ ActiveRecord::QueryLogs.taggings = ActiveRecord::QueryLogs.taggings.merge({owner: -> { Ownership.owner }})
33
31
  end
34
-
35
- require_relative "ownership/marginalia" if defined?(Marginalia)
36
32
  end
37
33
 
38
34
  ActiveSupport.on_load(:active_job) do
39
35
  require_relative "ownership/job_methods"
40
36
  include Ownership::JobMethods
41
37
  end
42
- else
43
- require_relative "ownership/marginalia" if defined?(Marginalia)
44
38
  end
45
39
 
46
40
  class Exception
metadata CHANGED
@@ -1,16 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ownership
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
- description:
14
12
  email: andrew@ankane.org
15
13
  executables: []
16
14
  extensions: []
@@ -24,14 +22,12 @@ files:
24
22
  - lib/ownership/global_methods.rb
25
23
  - lib/ownership/honeybadger.rb
26
24
  - lib/ownership/job_methods.rb
27
- - lib/ownership/marginalia.rb
28
25
  - lib/ownership/rollbar.rb
29
26
  - lib/ownership/version.rb
30
27
  homepage: https://github.com/ankane/ownership
31
28
  licenses:
32
29
  - MIT
33
30
  metadata: {}
34
- post_install_message:
35
31
  rdoc_options: []
36
32
  require_paths:
37
33
  - lib
@@ -39,15 +35,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
39
35
  requirements:
40
36
  - - ">="
41
37
  - !ruby/object:Gem::Version
42
- version: '3.1'
38
+ version: '3.2'
43
39
  required_rubygems_version: !ruby/object:Gem::Requirement
44
40
  requirements:
45
41
  - - ">="
46
42
  - !ruby/object:Gem::Version
47
43
  version: '0'
48
44
  requirements: []
49
- rubygems_version: 3.5.16
50
- signing_key:
45
+ rubygems_version: 3.6.9
51
46
  specification_version: 4
52
47
  summary: Code ownership for Rails
53
48
  test_files: []
@@ -1,9 +0,0 @@
1
- module Marginalia
2
- module Comment
3
- def self.owner
4
- Ownership.owner
5
- end
6
- end
7
- end
8
-
9
- Marginalia::Comment.components << :owner