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 +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +9 -16
- data/lib/ownership/controller_methods.rb +2 -2
- data/lib/ownership/global_methods.rb +1 -6
- data/lib/ownership/job_methods.rb +2 -2
- data/lib/ownership/version.rb +1 -1
- data/lib/ownership.rb +4 -10
- metadata +4 -9
- data/lib/ownership/marginalia.rb +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0723f75e9bb391d89f88e06c4686efc39b9c6e052cab1c8787412cb084a77bb7
|
|
4
|
+
data.tar.gz: 2b495a405e852a695ffcc56ba30ce3910ebe4e039afb62aaa9872ca912c5f332
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67fc999361bffcb73ead84fa6fd39fe959a5069309f78060fdf81f2e36cb3b3ef7c1ca04e5a2731278b076eada4860a9c0f23ddc62caef8f8f91413d1978a6ed
|
|
7
|
+
data.tar.gz: af4ab99285ec7ff5b127dcb715eacade86fd7b78f3d4aae39c65da1cbacccfab1946b4584a4f3c796d13734f5524fd8c5c40048af9b88ef79414002f2197f9f1
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
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
|
|
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
|
|
|
@@ -2,12 +2,7 @@ module Ownership
|
|
|
2
2
|
module GlobalMethods
|
|
3
3
|
private
|
|
4
4
|
|
|
5
|
-
def owner(
|
|
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]
|
data/lib/ownership/version.rb
CHANGED
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
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:
|
|
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.
|
|
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.
|
|
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: []
|