ownership 0.2.0 → 0.4.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: c82864cfbec98aec876ca43197e865d246e6dad17187844c4024fc46af6b81f2
4
- data.tar.gz: 04e54a16dfce05d2ff93a789edd861df94af852950439c7a3a8ba65506aa610d
3
+ metadata.gz: 24115b22ad0814c98dbb02a7fe2fb84af7149d9b8d2e4a052b05bba5b650cf54
4
+ data.tar.gz: 48b57d21ec9275b84aed0c4250a29ec1833688c737b2d5b2ec77c2969ea245cb
5
5
  SHA512:
6
- metadata.gz: 56da0f7adfacf7fc289ceddc5fb0061d7b138539158fc7769081755b8f9d7af2020853212b544554708f62a67547852c93297487dff9f0fe7adeee11c973d7b7
7
- data.tar.gz: 457826075fb853877bc3940bb0cc3364807983a42fe0ec29a0cd66e732186e03b7cb5534a643d785d87fb1e9a4341d926533b49e72babb2ccd1d34f88b7fc5d7
6
+ metadata.gz: 7b9efc666b672de029ecc86f083207ef11af64ba62d7c6bc760b1228d8fb9ddc951281d20e91f328073d19306f907e0ac5b0c734b09a6b8a18f96a84dbf715f0
7
+ data.tar.gz: 8469963791b7750afc38ecc662a5e0af1c4385836bd6af8deb9e6f0d6a31ecc2e0d1f00f01559b1dfcc2a8bf86ab39b6a930d2eb1f3db13bdae3000ebbc71b67
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.4.0 (2024-10-01)
2
+
3
+ - Added support for Rails 8
4
+ - Dropped support for Ruby < 3.1 and Rails < 7
5
+
6
+ ## 0.3.0 (2023-07-02)
7
+
8
+ - Dropped support for Ruby < 3 and Rails < 6.1
9
+
1
10
  ## 0.2.0 (2022-04-26)
2
11
 
3
12
  - Fixed issue with nested `owner` blocks
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2022 Andrew Kane
1
+ Copyright (c) 2017-2023 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -6,7 +6,7 @@ Check out [Scaling the Monolith](https://ankane.org/scaling-the-monolith) for ot
6
6
 
7
7
  :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
8
8
 
9
- [![Build Status](https://github.com/ankane/ownership/workflows/build/badge.svg?branch=master)](https://github.com/ankane/ownership/actions)
9
+ [![Build Status](https://github.com/ankane/ownership/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/ownership/actions)
10
10
 
11
11
  ## Installation
12
12
 
@@ -14,17 +14,15 @@ module Ownership
14
14
  begin
15
15
  Thread.current[:ownership_owner] = owner
16
16
 
17
- begin
18
- # callbacks
19
- if Ownership.around_change
20
- Ownership.around_change.call(owner, block)
21
- else
22
- block.call
23
- end
24
- rescue Exception => e
25
- e.owner ||= owner
26
- raise
17
+ # callbacks
18
+ if Ownership.around_change
19
+ Ownership.around_change.call(owner, block)
20
+ else
21
+ block.call
27
22
  end
23
+ rescue Exception => e
24
+ e.owner ||= owner
25
+ raise
28
26
  ensure
29
27
  Thread.current[:ownership_owner] = previous_value
30
28
  end
@@ -1,3 +1,3 @@
1
1
  module Ownership
2
- VERSION = "0.2.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/ownership.rb CHANGED
@@ -1,12 +1,14 @@
1
- require "ownership/global_methods"
2
- require "ownership/honeybadger"
3
- require "ownership/rollbar"
4
- require "ownership/version"
1
+ # modules
2
+ require_relative "ownership/global_methods"
3
+ require_relative "ownership/version"
4
+
5
+ # integrations
6
+ require_relative "ownership/honeybadger"
7
+ require_relative "ownership/rollbar"
5
8
 
6
9
  module Ownership
7
10
  class << self
8
- attr_accessor :default_owner
9
- attr_accessor :around_change
11
+ attr_accessor :around_change, :default_owner
10
12
 
11
13
  def owner
12
14
  Thread.current[:ownership_owner] || default_owner
@@ -18,24 +20,27 @@ Object.include Ownership::GlobalMethods
18
20
 
19
21
  if defined?(ActiveSupport)
20
22
  ActiveSupport.on_load(:action_controller) do
21
- require "ownership/controller_methods"
23
+ require_relative "ownership/controller_methods"
22
24
  include Ownership::ControllerMethods
23
25
  end
24
26
 
25
27
  ActiveSupport.on_load(:active_record) do
26
28
  if ActiveRecord::VERSION::MAJOR >= 7
27
- ActiveRecord::QueryLogs.taggings[:owner] ||= -> { Ownership.owner }
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
33
  end
29
34
 
30
- require "ownership/marginalia" if defined?(Marginalia)
35
+ require_relative "ownership/marginalia" if defined?(Marginalia)
31
36
  end
32
37
 
33
38
  ActiveSupport.on_load(:active_job) do
34
- require "ownership/job_methods"
39
+ require_relative "ownership/job_methods"
35
40
  include Ownership::JobMethods
36
41
  end
37
42
  else
38
- require "ownership/marginalia" if defined?(Marginalia)
43
+ require_relative "ownership/marginalia" if defined?(Marginalia)
39
44
  end
40
45
 
41
46
  class Exception
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ownership
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org
@@ -39,14 +39,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '2.6'
42
+ version: '3.1'
43
43
  required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
- rubygems_version: 3.3.7
49
+ rubygems_version: 3.5.16
50
50
  signing_key:
51
51
  specification_version: 4
52
52
  summary: Code ownership for Rails