featury 1.0.0.rc16 → 1.0.0.rc18
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 +4 -4
- data/README.md +22 -7
- data/lib/featury/actions/action.rb +13 -2
- data/lib/featury/actions/collection.rb +9 -1
- data/lib/featury/actions/dsl.rb +2 -1
- data/lib/featury/info/dsl.rb +6 -0
- data/lib/featury/info/result.rb +26 -2
- data/lib/featury/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 746a97b6b6689e1ac4a1dd05217229576b5ee8151890f077390f9050a2d9dd39
|
4
|
+
data.tar.gz: 0bff11a8adb7f725b4832660e8f3b61d434869ee1df27e2d07c2e01967dc11c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9836aa3917bcafcf4648707baa4a71bdd1a99a73464b007ee9ee805ddacf4b08af6174350ef168131aac254b601b4ed7a6a7f0a1261ea67b3a6c1f8ee6bfd7ac
|
7
|
+
data.tar.gz: ba036730e1e6e51b1574d01591ade4941430308713e0e300ac0dc19e01951b7bc75222a0bb3536facfca3f9644394edf3f642c27c87fed1c6ab06399b52282af
|
data/README.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://servactory.com" target="_blank">
|
3
|
+
<picture>
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/servactory/featury/main/.github/logo-dark.svg">
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/servactory/featury/main/.github/logo-light.svg">
|
6
|
+
<img alt="Featury" src="https://raw.githubusercontent.com/servactory/featury/main/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
|
7
|
+
</picture>
|
8
|
+
</a>
|
9
|
+
</p>
|
10
|
+
|
1
11
|
<p align="center">
|
2
12
|
<a href="https://rubygems.org/gems/featury"><img src="https://img.shields.io/gem/v/featury?logo=rubygems&logoColor=fff" alt="Gem version"></a>
|
3
13
|
<a href="https://github.com/servactory/featury/releases"><img src="https://img.shields.io/github/release-date/servactory/featury" alt="Release Date"></a>
|
@@ -30,22 +40,26 @@ In such a scenario, the base class could potentially be structured as follows:
|
|
30
40
|
|
31
41
|
```ruby
|
32
42
|
class ApplicationFeature < Featury::Base
|
33
|
-
action :enabled
|
43
|
+
action :enabled?, web: :main do |features:, **options|
|
34
44
|
features.all? { |feature| Flipper.enabled?(feature, *options.values) }
|
35
45
|
end
|
36
46
|
|
37
|
-
action :disabled
|
47
|
+
action :disabled?, web: :use do |features:, **options|
|
38
48
|
features.any? { |feature| !Flipper.enabled?(feature, *options.values) }
|
39
49
|
end
|
40
50
|
|
41
|
-
action :enable do |features:, **options|
|
51
|
+
action :enable, web: :use do |features:, **options|
|
42
52
|
features.all? { |feature| Flipper.enable(feature, *options.values) }
|
43
53
|
end
|
44
54
|
|
45
|
-
action :disable do |features:, **options|
|
55
|
+
action :disable, web: :use do |features:, **options|
|
46
56
|
features.all? { |feature| Flipper.disable(feature, *options.values) }
|
47
57
|
end
|
48
58
|
|
59
|
+
action :add do |features:, **options|
|
60
|
+
features.all? { |feature| Flipper.add(feature, *options.values) }
|
61
|
+
end
|
62
|
+
|
49
63
|
before do |action:, features:|
|
50
64
|
Slack::API::Notify.call!(action:, features:)
|
51
65
|
end
|
@@ -144,9 +158,10 @@ info = User::OnboardingFeature.info
|
|
144
158
|
```
|
145
159
|
|
146
160
|
```ruby
|
147
|
-
info.
|
148
|
-
info.
|
149
|
-
info.
|
161
|
+
info.actions # Feature actions (all, web) of the current class.
|
162
|
+
info.features # Feature flags of the current class.
|
163
|
+
info.groups # Feature flag groups of the current class.
|
164
|
+
info.tree # Tree of feature flags from the current class.
|
150
165
|
```
|
151
166
|
|
152
167
|
## Contributing
|
@@ -3,12 +3,23 @@
|
|
3
3
|
module Featury
|
4
4
|
module Actions
|
5
5
|
class Action
|
6
|
-
attr_reader :name,
|
6
|
+
attr_reader :name,
|
7
|
+
:web,
|
8
|
+
:block
|
7
9
|
|
8
|
-
def initialize(name, block:)
|
10
|
+
def initialize(name, web:, block:)
|
9
11
|
@name = name
|
12
|
+
@web = web
|
10
13
|
@block = block
|
11
14
|
end
|
15
|
+
|
16
|
+
def main_web?
|
17
|
+
@web == :main
|
18
|
+
end
|
19
|
+
|
20
|
+
def regular_web?
|
21
|
+
@web == :use
|
22
|
+
end
|
12
23
|
end
|
13
24
|
end
|
14
25
|
end
|
@@ -4,16 +4,24 @@ module Featury
|
|
4
4
|
module Actions
|
5
5
|
class Collection
|
6
6
|
extend Forwardable
|
7
|
-
def_delegators :@collection, :<<, :each, :map, :merge, :find
|
7
|
+
def_delegators :@collection, :<<, :filter, :each, :map, :merge, :find
|
8
8
|
|
9
9
|
def initialize(collection = Set.new)
|
10
10
|
@collection = collection
|
11
11
|
end
|
12
12
|
|
13
|
+
def for_web
|
14
|
+
Collection.new(filter { |action| action.main_web? || action.regular_web? })
|
15
|
+
end
|
16
|
+
|
13
17
|
def names
|
14
18
|
map(&:name)
|
15
19
|
end
|
16
20
|
|
21
|
+
def main_web
|
22
|
+
find(&:main_web?)
|
23
|
+
end
|
24
|
+
|
17
25
|
def find_by(name:)
|
18
26
|
find { |action| action.name == name }
|
19
27
|
end
|
data/lib/featury/actions/dsl.rb
CHANGED
data/lib/featury/info/dsl.rb
CHANGED
@@ -10,6 +10,7 @@ module Featury
|
|
10
10
|
module ClassMethods
|
11
11
|
def info
|
12
12
|
Featury::Info::Result.new(
|
13
|
+
actions: Featury::Info::Result::Actions.new(collection_of_actions),
|
13
14
|
features: collection_of_features.full_names,
|
14
15
|
groups: collection_of_groups.map(&:group),
|
15
16
|
tree: collection_of_features.full_names.concat(
|
@@ -19,6 +20,11 @@ module Featury
|
|
19
20
|
)
|
20
21
|
)
|
21
22
|
end
|
23
|
+
|
24
|
+
# API: Featury Web
|
25
|
+
def featury?
|
26
|
+
true
|
27
|
+
end
|
22
28
|
end
|
23
29
|
end
|
24
30
|
end
|
data/lib/featury/info/result.rb
CHANGED
@@ -3,9 +3,33 @@
|
|
3
3
|
module Featury
|
4
4
|
module Info
|
5
5
|
class Result
|
6
|
-
|
6
|
+
class Actions
|
7
|
+
class Web
|
8
|
+
attr_reader :all,
|
9
|
+
:main
|
7
10
|
|
8
|
-
|
11
|
+
def initialize(collection_of_actions)
|
12
|
+
@all = collection_of_actions.names
|
13
|
+
@main = collection_of_actions.main_web.name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :all,
|
18
|
+
:web
|
19
|
+
|
20
|
+
def initialize(collection_of_actions)
|
21
|
+
@all = collection_of_actions.names
|
22
|
+
@web = Web.new(collection_of_actions.for_web)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader :actions,
|
27
|
+
:features,
|
28
|
+
:groups,
|
29
|
+
:tree
|
30
|
+
|
31
|
+
def initialize(actions:, features:, groups:, tree:)
|
32
|
+
@actions = actions
|
9
33
|
@features = features
|
10
34
|
@groups = groups
|
11
35
|
@tree = tree
|
data/lib/featury/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: featury
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
@@ -49,14 +49,14 @@ dependencies:
|
|
49
49
|
requirements:
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '2.
|
52
|
+
version: '2.15'
|
53
53
|
type: :runtime
|
54
54
|
prerelease: false
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '2.
|
59
|
+
version: '2.15'
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: zeitwerk
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
- !ruby/object:Gem::Version
|
213
213
|
version: '0'
|
214
214
|
requirements: []
|
215
|
-
rubygems_version: 3.6.
|
215
|
+
rubygems_version: 3.6.9
|
216
216
|
specification_version: 4
|
217
217
|
summary: A set of tools for building reliable services of any complexity
|
218
218
|
test_files: []
|