arturo 3.0.1 → 4.1.1

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: 414a786d1d81cd18b31b5d54bc7df6b9c820d13106dcf471721d7383c28e75e8
4
- data.tar.gz: b42410fd7c9df45c1875958f335e5434a856e154c322b88819dfa20f4eb22877
3
+ metadata.gz: f3dd4873bb989ef7051937ac1b4ba16a49cc5691cc920d51b6714f330cd6b191
4
+ data.tar.gz: 0e8dfa652180dcba96d51779fa5734a128f1233b01467c4d77f79b80dadfcc23
5
5
  SHA512:
6
- metadata.gz: 3044307df2f849112c60bb859ab52b2151634ff891442b1e93328f270ad4adb1ddbb8e1da63e5317ad3b5d365d6c3de3761024e585216f5c7a8a20de5af0aa2a
7
- data.tar.gz: 592a564c1af2f63d80523f9a41c412bb882dabc14195dc3a1dd73d88220b2e74e1d17c5b4edc444d4a9f3f74b0650e6d5f3bb7e4244765fcbf073a1be2f6dfc3
6
+ metadata.gz: 1f8df1180d466898b1f0992e15fedf692769cee73a52efcd6d905d0ec9a09d2f69eb7a69a847e9a724ec8ab25ef01c8417f9854a0400ddc222efc5fa0583fe83
7
+ data.tar.gz: 719901f7640c53c7f767c6d0a7c5249029e40ea6b0903b4554f2030417b8374e400902eff2d22cf5afe24987a78eb20f51c5ae4dde93cd123204a71f49c61e59
data/CHANGELOG.md CHANGED
@@ -1,9 +1,35 @@
1
1
  ## Unreleased
2
2
 
3
+ ## v4.1.1
4
+
5
+ Fixes missing indifferent_access import
6
+
7
+ ## v4.1.0
8
+
9
+ Removes upper boundary on ActiveRecord.
10
+
11
+ Drops support for Ruby < 3.0.
12
+
13
+ Drops support for Rails < 6.0.
14
+
15
+ ## v4.0.1
16
+
17
+ Fixes loading issues for apps not using the Rails engine.
18
+
19
+ ## v4.0.0
20
+
21
+ Stops loading the Rails engine automatically. If you are using the engine, you need to require it explicitly by adding `require 'arturo/engine'` to `application.rb`.
22
+
23
+ Adds support for Ruby 3.3.
24
+
25
+ Returns false immediately for `feature_enabled_for?` calls with `nil` recipients.
26
+
3
27
  ## v3.0.0
4
28
 
5
29
  Converts the Feature model into a mixin that should be used by services via a model generator.
30
+
6
31
  Brings back the `warm_cache!` method.
32
+
7
33
  Adds support for Rails 7.1.
8
34
 
9
35
  ## v2.8.0
data/README.md CHANGED
@@ -43,7 +43,7 @@ $(function() {
43
43
  updatePostingsList();
44
44
  }
45
45
  });
46
- ````
46
+ ```
47
47
 
48
48
  Trish uses Arturo's Controller filters to control who has access to
49
49
  the feature:
@@ -70,7 +70,6 @@ feature and deploy it to all users.
70
70
 
71
71
  ## Installation
72
72
 
73
-
74
73
  ```Ruby
75
74
  gem 'arturo'
76
75
  ```
@@ -101,7 +100,7 @@ rake db:migrate
101
100
 
102
101
  #### Edit the Feature model
103
102
 
104
- By default, the generated model `Arturo::Feature` inherits from `ActiveRecord::Base`. However, if you’re using multiple databases your models should inherit from an abstract class that specifies a database connection, not directly from `ActiveRecord::Base`. Update the generated model in `app/models/arturo/feature.rb` to make it use a correct database.
103
+ By default, the generated model `Arturo::Feature` inherits from `ActiveRecord::Base`. However, if you’re using multiple databases your models should inherit from an abstract class that specifies a database connection, not directly from `ActiveRecord::Base`. Update the generated model in `app/models/arturo/feature.rb` to make it use a correct database.
105
104
 
106
105
  ##### Initializer
107
106
 
@@ -320,7 +319,7 @@ initializer:
320
319
  ```Ruby
321
320
  Arturo::Feature.extend(Arturo::FeatureCaching)
322
321
  Arturo::Feature.cache_ttl = 10.minutes
323
- ````
322
+ ```
324
323
 
325
324
  You can also warm the cache on startup:
326
325
 
@@ -16,13 +16,8 @@ module Arturo
16
16
 
17
17
  respond_to :html, :json, :xml
18
18
 
19
- if respond_to?(:before_action)
20
- before_action :require_permission
21
- before_action :load_feature, :only => [ :show, :edit, :update, :destroy ]
22
- else
23
- before_filter :require_permission
24
- before_filter :load_feature, :only => [ :show, :edit, :update, :destroy ]
25
- end
19
+ before_action :require_permission
20
+ before_action :load_feature, :only => [ :show, :edit, :update, :destroy ]
26
21
 
27
22
  def index
28
23
  @features = Arturo::Feature.all
@@ -20,8 +20,7 @@ module Arturo
20
20
  module ClassMethods
21
21
 
22
22
  def require_feature(name, options = {})
23
- method = respond_to?(:before_action) ? :before_action : :before_filter
24
- send(method, options) do |controller|
23
+ send(:before_action, options) do |controller|
25
24
  unless controller.feature_enabled?(name)
26
25
  controller.on_feature_disabled(name)
27
26
  end
data/lib/arturo/engine.rb CHANGED
@@ -1,19 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require 'arturo/controller_filters'
3
2
  require 'arturo/middleware'
4
3
  require 'rails/engine'
5
4
 
6
5
  module Arturo
7
6
  class Engine < ::Rails::Engine
8
- ActiveSupport.on_load(:action_controller) do
9
- include Arturo::FeatureAvailability
10
- include Arturo::ControllerFilters
11
- if respond_to?(:helper)
12
- helper Arturo::FeatureAvailability
13
- helper Arturo::FeatureManagement
14
- end
15
- end
16
-
17
7
  root = File.expand_path("../../..", __FILE__)
18
8
  config.autoload_paths = ["#{root}/app/helpers", "#{root}/app/controllers"]
19
9
  config.eager_load_paths = []
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'active_record'
4
4
  require 'active_support'
5
+ require 'active_support/core_ext/hash/indifferent_access'
5
6
 
6
7
  module Arturo
7
8
  module FeatureMethods
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Arturo
3
- VERSION = '3.0.1'
3
+ VERSION = '4.1.1'
4
4
  end
data/lib/arturo.rb CHANGED
@@ -6,7 +6,7 @@ require_relative 'arturo/feature_methods'
6
6
  require_relative 'arturo/feature_availability'
7
7
  require_relative 'arturo/feature_management'
8
8
  require_relative 'arturo/feature_caching'
9
- require_relative 'arturo/engine' if defined?(Rails)
9
+ require_relative 'arturo/controller_filters'
10
10
 
11
11
  module Arturo
12
12
  class << self
@@ -15,6 +15,8 @@ module Arturo
15
15
  # @param [#id] recipient
16
16
  # @return [true,false] whether the feature exists and is enabled for the recipient
17
17
  def feature_enabled_for?(feature_name, recipient)
18
+ return false if recipient.nil?
19
+
18
20
  f = self::Feature.to_feature(feature_name)
19
21
  f && f.enabled_for?(recipient)
20
22
  end
@@ -28,3 +30,12 @@ module Arturo
28
30
  end
29
31
  end
30
32
  end
33
+
34
+ ActiveSupport.on_load(:action_controller) do
35
+ include Arturo::FeatureAvailability
36
+ include Arturo::ControllerFilters
37
+ if respond_to?(:helper)
38
+ helper Arturo::FeatureAvailability
39
+ helper Arturo::FeatureManagement
40
+ end
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arturo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James A. Rosen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2024-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,110 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '7.2'
19
+ version: '6.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '5.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '7.2'
33
- - !ruby/object:Gem::Dependency
34
- name: rails
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '5.2'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '7.2'
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '5.2'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '7.2'
53
- - !ruby/object:Gem::Dependency
54
- name: sqlite3
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: '0'
60
- type: :development
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: '0'
67
- - !ruby/object:Gem::Dependency
68
- name: rspec-rails
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: '0'
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: '0'
81
- - !ruby/object:Gem::Dependency
82
- name: factory_bot
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: '0'
88
- type: :development
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: '0'
95
- - !ruby/object:Gem::Dependency
96
- name: timecop
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- version: '0'
109
- - !ruby/object:Gem::Dependency
110
- name: bump
111
- requirement: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- version: '0'
116
- type: :development
117
- prerelease: false
118
- version_requirements: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: '0'
26
+ version: '6.0'
123
27
  description: Deploy features incrementally to your users
124
28
  email: james.a.rosen@gmail.com
125
29
  executables: []
@@ -179,14 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
83
  requirements:
180
84
  - - ">="
181
85
  - !ruby/object:Gem::Version
182
- version: '2.7'
86
+ version: '3.0'
183
87
  required_rubygems_version: !ruby/object:Gem::Requirement
184
88
  requirements:
185
89
  - - ">="
186
90
  - !ruby/object:Gem::Version
187
91
  version: '0'
188
92
  requirements: []
189
- rubygems_version: 3.0.3.1
93
+ rubygems_version: 3.5.11
190
94
  signing_key:
191
95
  specification_version: 4
192
96
  summary: Feature sliders, wrapped up in an engine