featury 1.0.0.rc4 → 1.0.0.rc6

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: 61aef35ff4aede3e7c747a1b28be3d9ce598b068bc2d355093ac7a6ebb5b0829
4
- data.tar.gz: 40a570d5c32557cc9d7ab325633df8783676bfe48c58f1985bc943f1bb8c1d48
3
+ metadata.gz: e1dc31fdf0161091a1e477a352c5e06629fed341c488d78e0d6153c02805623e
4
+ data.tar.gz: 298efaed87cd51269f3bef4573a925924db8503865f54d2e0402a7c35ba4b283
5
5
  SHA512:
6
- metadata.gz: '097cbc783cb17e6648a514190be9bf075868113e089fb21725f9889b92e4293ebe5ea5c2ca49fdebc2ca06c318f37556ca69c56c4703c04a5693de6fbb1eb0de'
7
- data.tar.gz: 3c41249a7db0ead35e581e6f6e517157b46cec9ee03e4f005f0c6529bb0067ec7c14ed7b130d550ffb22e66a72589638cb259b359137aee3f393db9763896238
6
+ metadata.gz: ca3ed00e6e9e6f0559c2a1ddf8a962c2dc8857d135bcf5a1c4e85f95a81d6c6244c65f050523a67a3d1aec82490a69812dc1186467b0ab2eaaba3a3523467e79
7
+ data.tar.gz: be517027a237226225c42d03a5ba88f0d050c93bdd82fcaf90681fb764f8602214d3381e59bf7f5531e18fde19328220d1f4e5a2257cd1911c43dbc26185d360
data/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  <a href="https://github.com/servactory/featury/releases"><img src="https://img.shields.io/github/release-date/servactory/featury" alt="Release Date"></a>
4
4
  </p>
5
5
 
6
- ## For what?
6
+ ## Purpose
7
7
 
8
- Featury is designed for grouping and managing multiple features in projects.
9
- You can use any ready-made solution or your own.
10
- Feature is easily customizable to suit projects and their goals.
8
+ Featury is designed to group and manage multiple features within a project.
9
+ It provides the flexibility to utilize any pre-existing solution or create your own.
10
+ It's easily adjustable to align with the unique needs and objectives of your project.
11
11
 
12
12
  [//]: # (## Documentation)
13
13
 
@@ -25,8 +25,8 @@ gem "featury"
25
25
 
26
26
  #### Basic class for your features
27
27
 
28
- For example, you use Flipper for features.
29
- In this case, the base class might look like this:
28
+ For instance, assume that you are utilizing Flipper for managing features.
29
+ In such scenario, the base class could potentially be structured as follows:
30
30
 
31
31
  ```ruby
32
32
  class ApplicationFeature < Featury::Base
@@ -58,14 +58,10 @@ class UserFeature::Onboarding < ApplicationFeature
58
58
 
59
59
  prefix :user_onboarding
60
60
 
61
- features(
62
- :passage, # => :user_onboarding_passage
63
- )
61
+ features :passage # => :user_onboarding_passage
64
62
 
65
- groups(
66
- BillingFeature,
67
- PaymentSystemFeature
68
- )
63
+ groups BillingFeature,
64
+ PaymentSystemFeature
69
65
  end
70
66
  ```
71
67
 
@@ -73,9 +69,8 @@ end
73
69
  class BillingFeature < ApplicationFeature
74
70
  prefix :billing
75
71
 
76
- features(
77
- :work # => :billing_work
78
- )
72
+ features :api, # => :billing_api
73
+ :webhooks # => :billing_webhooks
79
74
  end
80
75
  ```
81
76
 
@@ -83,22 +78,21 @@ end
83
78
  class PaymentSystemFeature < ApplicationFeature
84
79
  prefix :payment_system
85
80
 
86
- features(
87
- :work # => :payment_system_work
88
- )
81
+ features :api, # => :payment_system_api
82
+ :webhooks # => :payment_system_webhooks
89
83
  end
90
84
  ```
91
85
 
92
- The `resource` method can indicate how the transmitted information should be processed.
93
- In addition to the options that Servactory brings, there are options for specifying the processing mode of the transmitted data.
86
+ The `resource` method provides an indication of how the transmitted information ought to be processed.
87
+ Besides the options provided by [Servactory](https://github.com/servactory/servactory), additional ones are available for stipulating the processing mode of the transmitted data.
94
88
 
95
- If it is necessary for a resource to be transferred as an option for a feature flag, then use the `option` option:
89
+ If a resource needs to be conveyed as a feature flag option, utilize the `option` parameter:
96
90
 
97
- ```ruby
91
+ ```ruby
98
92
  resource :user, type: User, option: true
99
93
  ```
100
94
 
101
- If it is necessary for a resource to be transferred to a nested group, then use the `nested` option:
95
+ To transfer a resource to a nested group, utilize the `nested` option:
102
96
 
103
97
  ```ruby
104
98
  resource :user, type: User, nested: true
@@ -106,22 +100,34 @@ resource :user, type: User, nested: true
106
100
 
107
101
  #### Working with the features of your project
108
102
 
109
- Each of these actions will be applied to all feature flags.
110
- And the result of these calls will be based on the result of all feature flags.
103
+ Each of these actions will be applied to every feature flag.
104
+ Subsequently, the outcome of these actions will be contingent upon the combined results of all feature flags.
111
105
 
112
106
  ```ruby
113
107
  UserFeature::Onboarding.enabled?(user:) # => true
114
108
  UserFeature::Onboarding.disabled?(user:) # => false
115
109
  UserFeature::Onboarding.enable(user:) # => true
116
- UserFeature::Onboarding.disable(user:) # => false
110
+ UserFeature::Onboarding.disable(user:) # => true
111
+ ```
112
+
113
+ You can also utilize the `with` method to pass necessary arguments.
114
+
115
+ ```ruby
116
+ feature = UserFeature::Onboarding.with(user:)
117
+
118
+ feature.enabled? # => true
119
+ feature.disabled? # => false
120
+ feature.enable # => true
121
+ feature.disable # => true
117
122
  ```
118
123
 
119
- If one of the feature flags is turned off, for example,
120
- through your automation, then the main feature class will
121
- return `false` when asked "is it enabled?".
124
+ If a feature flag is deactivated, possibly via automation processes,
125
+ the primary feature class subsequently responds with `false` when
126
+ queried about its enablement status.
122
127
 
123
- In the example above, this could be the payment system and its shutdown due to technical work.
124
- In this case, all onboarding of new users will be suspended.
128
+ In the preceding example, there might be a scenario where the payment system is
129
+ undergoing technical maintenance and therefore is temporarily shut down.
130
+ Consequently, the onboarding process for new users will be halted until further notice.
125
131
 
126
132
  ## Contributing
127
133
 
@@ -21,7 +21,7 @@ module Featury
21
21
  @model_class.const_set(Builder::SERVICE_CLASS_NAME, class_sample)
22
22
  end
23
23
 
24
- def create_service_class # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
24
+ def create_service_class # rubocop:disable Metrics/MethodLength, Metrics/AbcSize,Metrics/CyclomaticComplexity
25
25
  collection_of_resources = @collection_of_resources
26
26
 
27
27
  Class.new(Featury::Service::Builder) do
@@ -56,7 +56,7 @@ module Featury
56
56
  end
57
57
  end
58
58
 
59
- def check_features
59
+ def check_features # rubocop:disable Metrics/AbcSize
60
60
  options = inputs.collection_of_resources.only_option.to_h do |resource|
61
61
  [resource.name, inputs.public_send(resource.name)]
62
62
  end
@@ -65,7 +65,7 @@ module Featury
65
65
  inputs.action.block.call(features: inputs.collection_of_features.list, **options)
66
66
  end
67
67
 
68
- def check_groups
68
+ def check_groups # rubocop:disable Metrics/AbcSize
69
69
  arguments = inputs.collection_of_resources.only_nested.to_h do |resource|
70
70
  [resource.name, inputs.public_send(resource.name)]
71
71
  end
@@ -10,6 +10,8 @@ module Featury
10
10
 
11
11
  context = send(:new)
12
12
 
13
+ arguments.merge!(@with_arguments) if @with_arguments.is_a?(Hash)
14
+
13
15
  _call!(context, action, **arguments)
14
16
  end
15
17
 
@@ -17,6 +19,12 @@ module Featury
17
19
  collection_of_actions.names.include?(method_name) || super
18
20
  end
19
21
 
22
+ def with(arguments = {})
23
+ @with_arguments = arguments
24
+
25
+ self
26
+ end
27
+
20
28
  private
21
29
 
22
30
  def _call!(context, action, **arguments)
@@ -5,7 +5,7 @@ module Featury
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc4"
8
+ PRE = "rc6"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featury
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc4
4
+ version: 1.0.0.rc6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-22 00:00:00.000000000 Z
11
+ date: 2024-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.2'
22
+ version: '8.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.2'
32
+ version: '8.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: i18n
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 2.6.0
53
+ version: 2.8.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 2.6.0
60
+ version: 2.8.0
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: zeitwerk
63
63
  requirement: !ruby/object:Gem::Requirement