ownership 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c4fe00bb65d52534a1f5483498c2e6ce1dfed27d335d013ed6bf50243e5aaed
4
- data.tar.gz: 60b13c25af7be0d4ca8bc8dc0020e2920dbda2ad29a1feb9c4149096024ba56e
3
+ metadata.gz: 63e2271e9e2c427002833dc85a287563db799eb6d3cc37b639231bc3f2bbc643
4
+ data.tar.gz: 37ea40f895ba8359e0627d5d9be3dce0566fe062ba888f23ce767b1886927b70
5
5
  SHA512:
6
- metadata.gz: 5cef2c500453b391e10bbda547343ff0dc6a5dfdbf6c2d28e83b1695182db9d6372bd26c820f364e483ef3a56d54183557dccb30097b1097131ebd2657bc83c7
7
- data.tar.gz: aec462d513f26d8adc0e04e44888aba368ab7d0f410e593869336766db83ad90a934c8816a8e38d6911f09a6c9db1d2f673a94859db224ac5a664cd75ee8a18a
6
+ metadata.gz: 1539dbd3c928612c87463c3c4666e1d8502ff09ff923f6a8f0ac12c37e2a59eb1b8ff9a72213b23a9e0e6f2a52dc9ce35b54db78822457455d2947ab8dbe93a8
7
+ data.tar.gz: 83555242d963297d64be5123895e74ba9c524bb7aa3b76c638850cbc47e10ba3b78e8116adbfb9113a9febdb84d09c9f5121c94624ea408cd905e214cdfdffee
data/CHANGELOG.md CHANGED
@@ -1,9 +1,13 @@
1
- ## 0.1.1
1
+ ## 0.1.2 (2022-03-11)
2
+
3
+ - Added Active Record query log tags integration
4
+
5
+ ## 0.1.1 (2019-10-27)
2
6
 
3
7
  - Added Honeybadger integration
4
8
  - Made `owner` method private to behave like `Kernel` methods
5
9
  - Fixed conflict with Pry
6
10
 
7
- ## 0.1.0
11
+ ## 0.1.0 (2017-11-05)
8
12
 
9
13
  - First release
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2019 Andrew Kane
1
+ Copyright (c) 2017-2022 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,14 +2,18 @@
2
2
 
3
3
  Code ownership for Rails
4
4
 
5
+ Check out [Scaling the Monolith](https://ankane.org/scaling-the-monolith) for other tips
6
+
5
7
  :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
6
8
 
9
+ [![Build Status](https://github.com/ankane/ownership/workflows/build/badge.svg?branch=master)](https://github.com/ankane/ownership/actions)
10
+
7
11
  ## Installation
8
12
 
9
13
  Add this line to your application’s Gemfile:
10
14
 
11
15
  ```ruby
12
- gem 'ownership'
16
+ gem "ownership"
13
17
  ```
14
18
 
15
19
  ## Getting Started
@@ -63,12 +67,29 @@ Ownership.default_owner = :logistics
63
67
 
64
68
  There are a few built-in integrations with other gems.
65
69
 
70
+ - [Active Record](#active-record)
66
71
  - [Honeybadger](#honeybadger)
67
72
  - [Marginalia](#marginalia)
68
73
  - [Rollbar](#rollbar)
69
74
 
70
75
  You can also add [custom integrations](#custom-integrations).
71
76
 
77
+ ### Active Record
78
+
79
+ Active Record 7+ has the option to add comments to queries.
80
+
81
+ ```sql
82
+ SELECT ...
83
+ /*application:MyApp,controller:posts,action:index,owner:logistics*/
84
+ ```
85
+
86
+ Add to `config/application.rb`:
87
+
88
+ ```ruby
89
+ config.active_record.query_log_tags_enabled = true
90
+ config.active_record.query_log_tags << :owner
91
+ ```
92
+
72
93
  ### Honeybadger
73
94
 
74
95
  [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.
@@ -83,12 +104,12 @@ Ownership::Honeybadger.api_keys = {
83
104
  Also works with a proc
84
105
 
85
106
  ```ruby
86
- Ownership::Honeybadger.api_keys = -> (owner) { ENV["#{owner.to_s.upcase}_HONEYBADGER_API_KEY"] }
107
+ Ownership::Honeybadger.api_keys = ->(owner) { ENV["#{owner.to_s.upcase}_HONEYBADGER_API_KEY"] }
87
108
  ```
88
109
 
89
110
  ### Marginalia
90
111
 
91
- [Marginalia](https://github.com/basecamp/marginalia) adds comments to ActiveRecord queries. If installed, the owner is added.
112
+ [Marginalia](https://github.com/basecamp/marginalia) adds comments to Active Record queries. If installed, the owner is added.
92
113
 
93
114
  ```sql
94
115
  SELECT ...
@@ -111,7 +132,13 @@ Ownership::Rollbar.access_token = {
111
132
  Also works with a proc
112
133
 
113
134
  ```ruby
114
- Ownership::Rollbar.access_token = -> (owner) { ENV["#{owner.to_s.upcase}_ROLLBAR_ACCESS_TOKEN"] }
135
+ Ownership::Rollbar.access_token = ->(owner) { ENV["#{owner.to_s.upcase}_ROLLBAR_ACCESS_TOKEN"] }
136
+ ```
137
+
138
+ For version 3.1+ of the `rollbar` gem, add to `config/initializers/rollbar.rb`:
139
+
140
+ ```ruby
141
+ config.use_payload_access_token = true
115
142
  ```
116
143
 
117
144
  ## Custom Integrations
@@ -160,3 +187,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
160
187
  - Fix bugs and [submit pull requests](https://github.com/ankane/ownership/pulls)
161
188
  - Write, clarify, or fix documentation
162
189
  - Suggest or add new features
190
+
191
+ To get started with development and testing:
192
+
193
+ ```sh
194
+ git clone https://github.com/ankane/ownership.git
195
+ cd ownership
196
+ bundle install
197
+ bundle exec rake test
198
+ ```
@@ -1,3 +1,3 @@
1
1
  module Ownership
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/ownership.rb CHANGED
@@ -23,6 +23,10 @@ if defined?(ActiveSupport)
23
23
  end
24
24
 
25
25
  ActiveSupport.on_load(:active_record) do
26
+ if ActiveRecord::VERSION::MAJOR >= 7
27
+ ActiveRecord::QueryLogs.taggings[:owner] ||= -> { Ownership.owner }
28
+ end
29
+
26
30
  require "ownership/marginalia" if defined?(Marginalia)
27
31
  end
28
32
 
metadata CHANGED
@@ -1,115 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ownership
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-27 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: activejob
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: marginalia
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: honeybadger
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: pry
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- description:
112
- email: andrew@chartkick.com
11
+ date: 2022-03-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: andrew@ankane.org
113
15
  executables: []
114
16
  extensions: []
115
17
  extra_rdoc_files: []
@@ -129,7 +31,7 @@ homepage: https://github.com/ankane/ownership
129
31
  licenses:
130
32
  - MIT
131
33
  metadata: {}
132
- post_install_message:
34
+ post_install_message:
133
35
  rdoc_options: []
134
36
  require_paths:
135
37
  - lib
@@ -144,8 +46,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
46
  - !ruby/object:Gem::Version
145
47
  version: '0'
146
48
  requirements: []
147
- rubygems_version: 3.0.3
148
- signing_key:
49
+ rubygems_version: 3.3.7
50
+ signing_key:
149
51
  specification_version: 4
150
52
  summary: Code ownership for Rails
151
53
  test_files: []