README.md in ownership-0.1.1 vs README.md in ownership-0.1.2
- old
+ new
@@ -1,17 +1,21 @@
# Ownership
Code ownership for Rails
+Check out [Scaling the Monolith](https://ankane.org/scaling-the-monolith) for other tips
+
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
+[![Build Status](https://github.com/ankane/ownership/workflows/build/badge.svg?branch=master)](https://github.com/ankane/ownership/actions)
+
## Installation
Add this line to your application’s Gemfile:
```ruby
-gem 'ownership'
+gem "ownership"
```
## Getting Started
Ownership provides the ability to specify owners for different parts of the codebase. **We highly recommend owners are teams rather than individuals.** You can then use this information however you’d like, like routing errors to the correct team.
@@ -61,16 +65,33 @@
## Integrations
There are a few built-in integrations with other gems.
+- [Active Record](#active-record)
- [Honeybadger](#honeybadger)
- [Marginalia](#marginalia)
- [Rollbar](#rollbar)
You can also add [custom integrations](#custom-integrations).
+### Active Record
+
+Active Record 7+ has the option to add comments to queries.
+
+```sql
+SELECT ...
+/*application:MyApp,controller:posts,action:index,owner:logistics*/
+```
+
+Add to `config/application.rb`:
+
+```ruby
+config.active_record.query_log_tags_enabled = true
+config.active_record.query_log_tags << :owner
+```
+
### Honeybadger
[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.
```ruby
@@ -81,16 +102,16 @@
```
Also works with a proc
```ruby
-Ownership::Honeybadger.api_keys = -> (owner) { ENV["#{owner.to_s.upcase}_HONEYBADGER_API_KEY"] }
+Ownership::Honeybadger.api_keys = ->(owner) { ENV["#{owner.to_s.upcase}_HONEYBADGER_API_KEY"] }
```
### Marginalia
-[Marginalia](https://github.com/basecamp/marginalia) adds comments to ActiveRecord queries. If installed, the owner is added.
+[Marginalia](https://github.com/basecamp/marginalia) adds comments to Active Record queries. If installed, the owner is added.
```sql
SELECT ...
/*application:MyApp,controller:posts,action:index,owner:logistics*/
```
@@ -109,13 +130,19 @@
```
Also works with a proc
```ruby
-Ownership::Rollbar.access_token = -> (owner) { ENV["#{owner.to_s.upcase}_ROLLBAR_ACCESS_TOKEN"] }
+Ownership::Rollbar.access_token = ->(owner) { ENV["#{owner.to_s.upcase}_ROLLBAR_ACCESS_TOKEN"] }
```
+For version 3.1+ of the `rollbar` gem, add to `config/initializers/rollbar.rb`:
+
+```ruby
+config.use_payload_access_token = true
+```
+
## Custom Integrations
You can define a custom block of code to run with:
```ruby
@@ -158,5 +185,14 @@
- [Report bugs](https://github.com/ankane/ownership/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/ownership/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features
+
+To get started with development and testing:
+
+```sh
+git clone https://github.com/ankane/ownership.git
+cd ownership
+bundle install
+bundle exec rake test
+```