flagsmith 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -0
  3. data/.rubocop.yml +4 -1
  4. data/.rubocop_todo.yml +0 -1
  5. data/.ruby-version +1 -0
  6. data/Gemfile.lock +35 -6
  7. data/LICENCE +4 -5
  8. data/README.md +8 -64
  9. data/Rakefile +5 -1
  10. data/example/.env.development +5 -0
  11. data/example/.env.test +4 -0
  12. data/example/.gitignore +5 -0
  13. data/example/.hanamirc +3 -0
  14. data/example/.rspec +2 -0
  15. data/example/Gemfile +25 -0
  16. data/example/Gemfile.lock +269 -0
  17. data/example/README.md +29 -0
  18. data/example/Rakefile +9 -0
  19. data/example/apps/web/application.rb +162 -0
  20. data/example/apps/web/config/routes.rb +1 -0
  21. data/example/apps/web/controllers/.gitkeep +0 -0
  22. data/example/apps/web/controllers/home/index.rb +32 -0
  23. data/example/apps/web/templates/application.html.slim +7 -0
  24. data/example/apps/web/templates/home/index.html.slim +10 -0
  25. data/example/apps/web/views/application_layout.rb +7 -0
  26. data/example/apps/web/views/home/index.rb +29 -0
  27. data/example/config/boot.rb +2 -0
  28. data/example/config/environment.rb +17 -0
  29. data/example/config/initializers/.gitkeep +0 -0
  30. data/example/config/initializers/flagsmith.rb +9 -0
  31. data/example/config/puma.rb +15 -0
  32. data/example/config.ru +3 -0
  33. data/example/spec/example/entities/.gitkeep +0 -0
  34. data/example/spec/example/mailers/.gitkeep +0 -0
  35. data/example/spec/example/repositories/.gitkeep +0 -0
  36. data/example/spec/features_helper.rb +12 -0
  37. data/example/spec/spec_helper.rb +103 -0
  38. data/example/spec/support/.gitkeep +0 -0
  39. data/example/spec/support/capybara.rb +8 -0
  40. data/example/spec/web/controllers/.gitkeep +0 -0
  41. data/example/spec/web/controllers/home/index_spec.rb +9 -0
  42. data/example/spec/web/features/.gitkeep +0 -0
  43. data/example/spec/web/views/application_layout_spec.rb +10 -0
  44. data/example/spec/web/views/home/index_spec.rb +10 -0
  45. data/lib/flagsmith/engine/core.rb +88 -0
  46. data/lib/flagsmith/engine/environments/models.rb +61 -0
  47. data/lib/flagsmith/engine/features/models.rb +173 -0
  48. data/lib/flagsmith/engine/identities/models.rb +115 -0
  49. data/lib/flagsmith/engine/organisations/models.rb +28 -0
  50. data/lib/flagsmith/engine/projects/models.rb +31 -0
  51. data/lib/flagsmith/engine/segments/constants.rb +41 -0
  52. data/lib/flagsmith/engine/segments/evaluator.rb +68 -0
  53. data/lib/flagsmith/engine/segments/models.rb +121 -0
  54. data/lib/flagsmith/engine/utils/hash_func.rb +34 -0
  55. data/lib/flagsmith/hash_slice.rb +12 -0
  56. data/lib/flagsmith/sdk/analytics_processor.rb +39 -0
  57. data/lib/flagsmith/sdk/api_client.rb +47 -0
  58. data/lib/flagsmith/sdk/config.rb +91 -0
  59. data/lib/flagsmith/sdk/errors.rb +9 -0
  60. data/lib/flagsmith/sdk/instance_methods.rb +137 -0
  61. data/lib/flagsmith/sdk/intervals.rb +24 -0
  62. data/lib/flagsmith/sdk/models/flag.rb +62 -0
  63. data/lib/flagsmith/sdk/models/flags/collection.rb +105 -0
  64. data/lib/flagsmith/sdk/pooling_manager.rb +31 -0
  65. data/lib/flagsmith/version.rb +5 -0
  66. data/lib/flagsmith.rb +79 -101
  67. metadata +104 -6
  68. data/.gitignore +0 -57
  69. data/flagsmith.gemspec +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35fb5ceee9613cc9425904d67f7429b82d56fcb42d3bfff4f0adb7c4d7a61ea2
4
- data.tar.gz: a3d9a18ac02ad8a5f29f7f1ad116b8c47c563a7754f650320b693b349c3d03bf
3
+ metadata.gz: f75b8801ce9af235343975f0e7ded1e3d6fa79544ffccc94e9052a1293143cfb
4
+ data.tar.gz: 5fb178bb71c4fa72207e5843fcbc6d2778285e85be2f4138e19f9822038d68c8
5
5
  SHA512:
6
- metadata.gz: 8b3017bfcf9e4c81965b719e499a992954a3ffb3c4d7984eaeab61befb5074268e2507e7ce57291eeeff59f99ec6dc06ed539f5112be24a97fb0b4eed9dcda4c
7
- data.tar.gz: 42bb17bdcf66b4ff8bfdd70abd645c79eae85b60dec89163e4450b1920e8dbec6a6ce0e5136210e7bc22622a8613328676c1f8febf5d1ad1ba061042280d0ea4
6
+ metadata.gz: 17306e034862b4b66996edb1bed6f3744a15e74dcc283a10630b3c25dd6dde1a8ed80259d24169d167030af6e264f5da8df9141c5c8790668596e29441819ab1
7
+ data.tar.gz: d46975cd909e97f08c0f81f15b4d265fe11c9762a8f4558701af380874e338ee3d101d5a05be68264ca5f53861290250046ea8aa3e6ae3b374421b6c7c7d35a2
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml CHANGED
@@ -2,7 +2,10 @@ inherit_from: .rubocop_todo.yml
2
2
 
3
3
  Layout/HashAlignment:
4
4
  AllowMultipleStyles: true
5
- EnforcedColonStyle: separator
5
+ EnforcedColonStyle: key
6
6
  AllCops:
7
7
  NewCops: enable
8
8
  SuggestExtensions: false
9
+ Exclude:
10
+ - 'spec/**/*'
11
+ - 'example/**/*'
data/.rubocop_todo.yml CHANGED
@@ -12,7 +12,6 @@
12
12
  Metrics/BlockLength:
13
13
  Exclude:
14
14
  - '**/*.gemspec'
15
- - 'spec/flagsmith_spec.rb'
16
15
 
17
16
  # Offense count: 1
18
17
  # Configuration parameters: AllowedMethods.
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.0
data/Gemfile.lock CHANGED
@@ -1,25 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flagsmith (2.0.0)
4
+ flagsmith (3.0.0)
5
5
  faraday
6
+ faraday-retry
6
7
  faraday_middleware
8
+ semantic
7
9
 
8
10
  GEM
9
11
  remote: https://rubygems.org/
10
12
  specs:
11
13
  ast (2.4.1)
14
+ coderay (1.1.3)
12
15
  diff-lcs (1.4.4)
13
- faraday (1.2.0)
16
+ faraday (1.10.0)
17
+ faraday-em_http (~> 1.0)
18
+ faraday-em_synchrony (~> 1.0)
19
+ faraday-excon (~> 1.1)
20
+ faraday-httpclient (~> 1.0)
21
+ faraday-multipart (~> 1.0)
22
+ faraday-net_http (~> 1.0)
23
+ faraday-net_http_persistent (~> 1.0)
24
+ faraday-patron (~> 1.0)
25
+ faraday-rack (~> 1.0)
26
+ faraday-retry (~> 1.0)
27
+ ruby2_keywords (>= 0.0.4)
28
+ faraday-em_http (1.0.0)
29
+ faraday-em_synchrony (1.0.0)
30
+ faraday-excon (1.1.0)
31
+ faraday-httpclient (1.0.1)
32
+ faraday-multipart (1.0.3)
14
33
  multipart-post (>= 1.2, < 3)
15
- ruby2_keywords
16
- faraday_middleware (1.0.0)
34
+ faraday-net_http (1.0.1)
35
+ faraday-net_http_persistent (1.2.0)
36
+ faraday-patron (1.0.0)
37
+ faraday-rack (1.0.0)
38
+ faraday-retry (1.0.3)
39
+ faraday_middleware (1.2.0)
17
40
  faraday (~> 1.0)
18
41
  gem-release (2.2.0)
42
+ method_source (1.0.0)
19
43
  multipart-post (2.1.1)
20
44
  parallel (1.20.1)
21
45
  parser (3.0.0.0)
22
46
  ast (~> 2.4.1)
47
+ pry (0.14.1)
48
+ coderay (~> 1.1)
49
+ method_source (~> 1.0)
23
50
  rainbow (3.0.0)
24
51
  rake (13.0.3)
25
52
  regexp_parser (2.0.3)
@@ -49,7 +76,8 @@ GEM
49
76
  rubocop-ast (1.3.0)
50
77
  parser (>= 2.7.1.5)
51
78
  ruby-progressbar (1.10.1)
52
- ruby2_keywords (0.0.2)
79
+ ruby2_keywords (0.0.5)
80
+ semantic (1.6.1)
53
81
  unicode-display_width (1.7.0)
54
82
 
55
83
  PLATFORMS
@@ -59,9 +87,10 @@ DEPENDENCIES
59
87
  bundler
60
88
  flagsmith!
61
89
  gem-release
90
+ pry
62
91
  rake
63
92
  rspec
64
93
  rubocop
65
94
 
66
95
  BUNDLED WITH
67
- 1.17.2
96
+ 2.3.14
data/LICENCE CHANGED
@@ -1,12 +1,11 @@
1
- Copyright (c) 2018 Solid State Technology Ltd (https://www.solidstategroup.com/) and individual contributors.
2
- All rights reserved.
1
+ Copyright 2022 Bullet Train Ltd. A UK company.
3
2
 
4
3
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
4
 
6
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
6
 
8
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
8
 
10
- 3. Neither the name of the Sentry nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
10
 
12
11
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,70 +1,16 @@
1
- <img width="100%" src="https://raw.githubusercontent.com/Flagsmith/flagsmith-frontend/master/hero.png"/>
1
+ <img width="100%" src="https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png"/>
2
2
 
3
- # Flagsmith Client
3
+ # Flagsmith Ruby Client
4
4
 
5
- The SDK clients for Ruby [https://flagsmith.com/](https://www.flagsmith.com/). Flagsmith allows you to manage feature flags and remote config across multiple projects, environments and organizations.
5
+ The SDK clients for Ruby [https://www.flagsmith.com/](https://www.flagsmith.com/). Flagsmith allows you to manage feature flags and remote config across multiple projects, environments and organizations.
6
6
 
7
- ## Getting Started
7
+ ## Adding to your project
8
8
 
9
- These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See running in production for notes on how to deploy the project on a live system.
10
-
11
- ## Installing
12
-
13
- ### VIA gem
14
-
15
- `gem install flagsmith`
16
-
17
- ## Usage
18
-
19
- **Retrieving feature flags for your project**
20
-
21
- **For full documentation visit [https://docs.flagsmith.com/](https://docs.flagsmith.com/)**
22
-
23
- ```ruby
24
- require "flagsmith"
25
-
26
- flagsmith = Flagsmith.new("<<Your API KEY>>")
27
-
28
- if flagsmith.get_value("font_size")
29
- # Do something awesome with the font size
30
- end
31
-
32
- if flagsmith.feature_enabled?("does_not_exist")
33
- #do something
34
- else
35
- #do nothing, or something else
36
- end
37
-
38
- ```
39
-
40
- **Available Options**
41
-
42
- | Property | Description | Required | Default Value | Environment Key |
43
- | --------- | :-----------------------------------------------------------------------------------------------: | -------: | --------------------------------: | ----------------: |
44
- | `api_key` | Defines which project environment you wish to get flags for. _example ACME Project - Staging._ | **YES** | null | FLAGSMITH_API_KEY |
45
- | `url` | Use this property to define where you're getting feature flags from, e.g. if you're self hosting. | **NO** | https://api.flagsmith.com/api/v1/ | FLAGSMITH_URL |
46
-
47
- **Available Functions**
48
-
49
- | Property | Description |
50
- | ------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------: |
51
- | `init` | Initialize the sdk against a particular environment |
52
- | `feature_enabled?(key)` | Get the value of a particular feature e.g. `flagsmith.feature_enabled?("powerUserFeature") // true` |
53
- | `feature_enabled?(key, user_id, default = false)` | Get the value of a particular feature for a user e.g. `flagsmith.feature_enabled?("powerUserFeature", 1234) // true` |
54
- | `get_value(key)` | Get the value of a particular feature e.g. `flagsmith.get_value("font_size") // 10` |
55
- | `get_value(key, user_id, default = nil)` | Get the value of a particular feature for a specified user e.g. `flagsmith.get_value("font_size", 1234) // 15` |
56
- | `get_flags()` | Trigger a manual fetch of the environment features, if a user is identified it will fetch their features |
57
- | `get_flags(user_id)` | Trigger a manual fetch of the environment features with a given user id |
58
- | `set_trait(user_id, trait, value)` | Set the value of a trait for the given user id |
59
-
60
- **Identifying Users**
61
-
62
- Identifying users allows you to target specific users from the [Flagsmith dashboard](https://www.flagsmith.com/).
63
- You can include an optional user identifier as part of the `feature_enabled?` and `get_value` methods to retrieve unique user flags and variables.
9
+ For full documentation visit [https://docs.flagsmith.com/clients/ruby/](https://docs.flagsmith.com/clients/ruby/)
64
10
 
65
11
  ## Contributing
66
12
 
67
- Please read [CONTRIBUTING.md](https://gist.github.com/kyle-ssg/c36a03aebe492e45cbd3eefb21cb0486) for details on our code of conduct, and the process for submitting pull requests to us.
13
+ Please read [CONTRIBUTING.md](https://gist.github.com/kyle-ssg/c36a03aebe492e45cbd3eefb21cb0486) for details on our code of conduct, and the process for submitting pull requests
68
14
 
69
15
  ## Getting Help
70
16
 
@@ -72,12 +18,10 @@ If you encounter a bug or feature request we would like to hear about it. Before
72
18
 
73
19
  ## Get in touch
74
20
 
75
- If you have any questions about our projects you can email <a href="mailto:projects@solidstategroup.com">projects@solidstategroup.com</a>.
21
+ If you have any questions about our projects you can email <a href="mailto:support@flagsmith.com">support@flagsmith.com</a>.
76
22
 
77
23
  ## Useful links
78
24
 
79
- [Website](https://flagsmith.com)
25
+ [Website](https://www.flagsmith.com/)
80
26
 
81
27
  [Documentation](https://docs.flagsmith.com/)
82
-
83
- [YouTube Tutorials](https://www.youtube.com/channel/UCki7GZrOdZZcsV9rAIRchCw)
data/Rakefile CHANGED
@@ -5,4 +5,8 @@ require 'rspec/core/rake_task'
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task default: :spec
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,5 @@
1
+ # Define ENV variables for development environment
2
+ DATABASE_URL="sqlite://db/example_development.sqlite"
3
+ SERVE_STATIC_ASSETS="true"
4
+ WEB_SESSIONS_SECRET="4743628fa58981a0eaf99cc636146f49ceffd0ab6a8423c0e2493e67cd825f67"
5
+ FLAGSMITH_ENVIRONMENT_KEY="YOUR_FLAGSMITH_ENVIRONMENT_KEY"
data/example/.env.test ADDED
@@ -0,0 +1,4 @@
1
+ # Define ENV variables for test environment
2
+ DATABASE_URL="sqlite://db/example_test.sqlite"
3
+ SERVE_STATIC_ASSETS="true"
4
+ WEB_SESSIONS_SECRET="50f1a22a68ccc6d06b48387f4cd4aa63cbaabd2b525c288f0f7a7046b10cc6ac"
@@ -0,0 +1,5 @@
1
+ /db/*.sqlite
2
+ /public/assets*
3
+ /tmp
4
+ .env.local
5
+ .env.*.local
data/example/.hanamirc ADDED
@@ -0,0 +1,3 @@
1
+ project=example
2
+ test=rspec
3
+ template=slim
data/example/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/example/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'hanami', '~> 1.3'
4
+ gem 'hanami-model', '~> 1.3'
5
+ gem 'slim'
6
+ gem 'sqlite3'
7
+ gem "puma", "~> 5.6"
8
+
9
+ gemspec path: '../'
10
+
11
+ group :development do
12
+ # Code reloading
13
+ # See: https://guides.hanamirb.org/projects/code-reloading
14
+ gem 'hanami-webconsole'
15
+ gem 'shotgun', platforms: :ruby
16
+ end
17
+
18
+ group :test, :development do
19
+ gem 'dotenv', '~> 2.4'
20
+ end
21
+
22
+ group :test do
23
+ gem 'capybara'
24
+ gem 'rspec'
25
+ end
@@ -0,0 +1,269 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ flagsmith (3.0.0)
5
+ faraday
6
+ faraday-retry
7
+ faraday_middleware
8
+ semantic
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ addressable (2.8.0)
14
+ public_suffix (>= 2.0.2, < 5.0)
15
+ ast (2.4.2)
16
+ better_errors (2.9.1)
17
+ coderay (>= 1.0.0)
18
+ erubi (>= 1.0.0)
19
+ rack (>= 0.9.0)
20
+ bigdecimal (1.4.4)
21
+ binding_of_caller (0.8.0)
22
+ debug_inspector (>= 0.0.1)
23
+ capybara (3.32.2)
24
+ addressable
25
+ mini_mime (>= 0.1.3)
26
+ nokogiri (~> 1.8)
27
+ rack (>= 1.6.0)
28
+ rack-test (>= 0.6.3)
29
+ regexp_parser (~> 1.5)
30
+ xpath (~> 3.2)
31
+ coderay (1.1.3)
32
+ concurrent-ruby (1.1.10)
33
+ debug_inspector (1.1.0)
34
+ diff-lcs (1.5.0)
35
+ dotenv (2.7.6)
36
+ dry-cli (0.7.0)
37
+ dry-configurable (0.11.6)
38
+ concurrent-ruby (~> 1.0)
39
+ dry-core (~> 0.4, >= 0.4.7)
40
+ dry-equalizer (~> 0.2)
41
+ dry-container (0.7.2)
42
+ concurrent-ruby (~> 1.0)
43
+ dry-configurable (~> 0.1, >= 0.1.3)
44
+ dry-core (0.4.9)
45
+ concurrent-ruby (~> 1.0)
46
+ dry-equalizer (0.3.0)
47
+ dry-initializer (1.4.1)
48
+ dry-logic (0.4.2)
49
+ dry-container (~> 0.2, >= 0.2.6)
50
+ dry-core (~> 0.2)
51
+ dry-equalizer (~> 0.2)
52
+ dry-struct (0.3.1)
53
+ dry-configurable (~> 0.1)
54
+ dry-core (~> 0.3)
55
+ dry-equalizer (~> 0.2)
56
+ dry-types (~> 0.9, >= 0.9.0)
57
+ ice_nine (~> 0.11)
58
+ dry-types (0.11.1)
59
+ concurrent-ruby (~> 1.0)
60
+ dry-configurable (~> 0.1)
61
+ dry-container (~> 0.3)
62
+ dry-core (~> 0.2, >= 0.2.1)
63
+ dry-equalizer (~> 0.2)
64
+ dry-logic (~> 0.4, >= 0.4.0)
65
+ inflecto (~> 0.0.0, >= 0.0.2)
66
+ dry-validation (0.11.0)
67
+ concurrent-ruby (~> 1.0)
68
+ dry-configurable (~> 0.1, >= 0.1.3)
69
+ dry-core (~> 0.2, >= 0.2.1)
70
+ dry-equalizer (~> 0.2)
71
+ dry-logic (~> 0.4, >= 0.4.0)
72
+ dry-types (~> 0.11.0)
73
+ erubi (1.10.0)
74
+ faraday (1.10.0)
75
+ faraday-em_http (~> 1.0)
76
+ faraday-em_synchrony (~> 1.0)
77
+ faraday-excon (~> 1.1)
78
+ faraday-httpclient (~> 1.0)
79
+ faraday-multipart (~> 1.0)
80
+ faraday-net_http (~> 1.0)
81
+ faraday-net_http_persistent (~> 1.0)
82
+ faraday-patron (~> 1.0)
83
+ faraday-rack (~> 1.0)
84
+ faraday-retry (~> 1.0)
85
+ ruby2_keywords (>= 0.0.4)
86
+ faraday-em_http (1.0.0)
87
+ faraday-em_synchrony (1.0.0)
88
+ faraday-excon (1.1.0)
89
+ faraday-httpclient (1.0.1)
90
+ faraday-multipart (1.0.3)
91
+ multipart-post (>= 1.2, < 3)
92
+ faraday-net_http (1.0.1)
93
+ faraday-net_http_persistent (1.2.0)
94
+ faraday-patron (1.0.0)
95
+ faraday-rack (1.0.0)
96
+ faraday-retry (1.0.3)
97
+ faraday_middleware (1.2.0)
98
+ faraday (~> 1.0)
99
+ gem-release (2.2.2)
100
+ hanami (1.3.5)
101
+ bundler (>= 1.6, < 3)
102
+ concurrent-ruby (~> 1.0)
103
+ dry-cli (~> 0.5)
104
+ hanami-assets (~> 1.3)
105
+ hanami-controller (~> 1.3, >= 1.3.3)
106
+ hanami-helpers (~> 1.3)
107
+ hanami-mailer (~> 1.3)
108
+ hanami-router (~> 1.3)
109
+ hanami-utils (~> 1.3)
110
+ hanami-validations (>= 1.3, < 3)
111
+ hanami-view (~> 1.3)
112
+ hanami-assets (1.3.5)
113
+ hanami-helpers (~> 1.3)
114
+ hanami-utils (~> 1.3)
115
+ tilt (~> 2.0, >= 2.0.2)
116
+ hanami-controller (1.3.3)
117
+ hanami-utils (~> 1.3)
118
+ rack (~> 2.0)
119
+ hanami-helpers (1.3.3)
120
+ hanami-utils (~> 1.3)
121
+ hanami-mailer (1.3.3)
122
+ hanami-utils (~> 1.3)
123
+ mail (~> 2.6)
124
+ tilt (~> 2.0, >= 2.0.1)
125
+ hanami-model (1.3.3)
126
+ bigdecimal (~> 1.4)
127
+ concurrent-ruby (~> 1.0)
128
+ dry-logic (~> 0.4.2, < 0.5)
129
+ dry-types (~> 0.11.0)
130
+ hanami-utils (~> 1.3)
131
+ rom (~> 3.3, >= 3.3.3)
132
+ rom-repository (~> 1.4)
133
+ rom-sql (~> 1.3, >= 1.3.5)
134
+ hanami-router (1.3.2)
135
+ hanami-utils (~> 1.3)
136
+ http_router (= 0.11.2)
137
+ rack (~> 2.0)
138
+ hanami-utils (1.3.8)
139
+ concurrent-ruby (~> 1.0)
140
+ transproc (~> 1.0)
141
+ hanami-validations (1.3.8)
142
+ dry-configurable (<= 0.12)
143
+ dry-logic (~> 0.4.2, < 0.5)
144
+ dry-validation (~> 0.11, < 0.12)
145
+ hanami-utils (~> 1.3)
146
+ hanami-view (1.3.3)
147
+ hanami-utils (~> 1.3)
148
+ tilt (~> 2.0, >= 2.0.1)
149
+ hanami-webconsole (0.1.0)
150
+ better_errors (~> 2.4)
151
+ binding_of_caller (~> 0.8)
152
+ http_router (0.11.2)
153
+ rack (>= 1.0.0)
154
+ url_mount (~> 0.2.1)
155
+ ice_nine (0.11.2)
156
+ inflecto (0.0.2)
157
+ mail (2.7.1)
158
+ mini_mime (>= 0.1.1)
159
+ method_source (1.0.0)
160
+ mini_mime (1.1.2)
161
+ mini_portile2 (2.4.0)
162
+ multipart-post (2.1.1)
163
+ nio4r (2.5.8)
164
+ nokogiri (1.10.10)
165
+ mini_portile2 (~> 2.4.0)
166
+ parallel (1.20.1)
167
+ parser (3.1.2.0)
168
+ ast (~> 2.4.1)
169
+ pry (0.14.1)
170
+ coderay (~> 1.1)
171
+ method_source (~> 1.0)
172
+ public_suffix (4.0.7)
173
+ puma (5.6.4)
174
+ nio4r (~> 2.0)
175
+ rack (2.2.3)
176
+ rack-test (1.1.0)
177
+ rack (>= 1.0, < 3)
178
+ rainbow (3.1.1)
179
+ rake (13.0.6)
180
+ regexp_parser (1.8.2)
181
+ rexml (3.2.5)
182
+ rom (3.3.3)
183
+ concurrent-ruby (~> 1.0)
184
+ dry-core (~> 0.3)
185
+ dry-equalizer (~> 0.2)
186
+ dry-initializer (~> 1.3)
187
+ dry-types (~> 0.9, >= 0.9.4)
188
+ rom-mapper (~> 0.5, >= 0.5.1)
189
+ rom-mapper (0.5.1)
190
+ dry-core (~> 0.2, >= 0.2.3)
191
+ dry-equalizer (~> 0.2)
192
+ transproc (~> 1.0)
193
+ rom-repository (1.4.0)
194
+ dry-core (~> 0.3, >= 0.3.1)
195
+ dry-struct (~> 0.3)
196
+ rom (~> 3.3)
197
+ rom-mapper (~> 0.5)
198
+ rom-sql (1.3.5)
199
+ dry-core (~> 0.3)
200
+ dry-equalizer (~> 0.2)
201
+ dry-types (~> 0.11.0)
202
+ rom (~> 3.2, >= 3.2.2)
203
+ sequel (~> 4.43)
204
+ rspec (3.11.0)
205
+ rspec-core (~> 3.11.0)
206
+ rspec-expectations (~> 3.11.0)
207
+ rspec-mocks (~> 3.11.0)
208
+ rspec-core (3.11.0)
209
+ rspec-support (~> 3.11.0)
210
+ rspec-expectations (3.11.0)
211
+ diff-lcs (>= 1.2.0, < 2.0)
212
+ rspec-support (~> 3.11.0)
213
+ rspec-mocks (3.11.1)
214
+ diff-lcs (>= 1.2.0, < 2.0)
215
+ rspec-support (~> 3.11.0)
216
+ rspec-support (3.11.0)
217
+ rubocop (1.12.1)
218
+ parallel (~> 1.10)
219
+ parser (>= 3.0.0.0)
220
+ rainbow (>= 2.2.2, < 4.0)
221
+ regexp_parser (>= 1.8, < 3.0)
222
+ rexml
223
+ rubocop-ast (>= 1.2.0, < 2.0)
224
+ ruby-progressbar (~> 1.7)
225
+ unicode-display_width (>= 1.4.0, < 3.0)
226
+ rubocop-ast (1.4.1)
227
+ parser (>= 2.7.1.5)
228
+ ruby-progressbar (1.11.0)
229
+ ruby2_keywords (0.0.5)
230
+ semantic (1.6.1)
231
+ sequel (4.49.0)
232
+ shotgun (0.9.2)
233
+ rack (>= 1.0)
234
+ slim (4.1.0)
235
+ temple (>= 0.7.6, < 0.9)
236
+ tilt (>= 2.0.6, < 2.1)
237
+ sqlite3 (1.4.2)
238
+ temple (0.8.2)
239
+ tilt (2.0.10)
240
+ transproc (1.1.1)
241
+ unicode-display_width (2.1.0)
242
+ url_mount (0.2.1)
243
+ rack
244
+ xpath (3.2.0)
245
+ nokogiri (~> 1.8)
246
+
247
+ PLATFORMS
248
+ x86_64-linux
249
+
250
+ DEPENDENCIES
251
+ bundler
252
+ capybara
253
+ dotenv (~> 2.4)
254
+ flagsmith!
255
+ gem-release
256
+ hanami (~> 1.3)
257
+ hanami-model (~> 1.3)
258
+ hanami-webconsole
259
+ pry
260
+ puma (~> 5.6)
261
+ rake
262
+ rspec
263
+ rubocop
264
+ shotgun
265
+ slim
266
+ sqlite3
267
+
268
+ BUNDLED WITH
269
+ 2.3.14
data/example/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Flagsmith Basic Ruby Example
2
+
3
+ This directory contains a basic Flask application which utilises Flagsmith. To run the example application, you'll
4
+ need to go through the following steps:
5
+
6
+ 1. Create an account, organisation and project on [Flagsmith](https://flagsmith.com)
7
+ 2. Create a feature in the project called "secret_button"
8
+ 3. Give the feature a value using the json editor as follows:
9
+
10
+ ```json
11
+ {"colour": "#ababab"}
12
+ ```
13
+
14
+ 4. Create a .env.local file from the template located in this directory with the environment key of one of the environments
15
+ in flagsmith (This can be found on the 'settings' page accessed from the menu on the left under the chosen environment.)
16
+ 5. From a terminal window, export those environment variables (either manually or by using `export $(cat .env)`)
17
+ 6. Install dependencies:
18
+ ```bash
19
+ bundle install
20
+ ```
21
+ 7. Run the application:
22
+ ```
23
+ bundle exec hanami server
24
+ ```
25
+ 8. Browse to http://localhost:2300
26
+
27
+ Now you can play around with the 'secret_button' feature in flagsmith, turn it on to show it and edit the colour in the
28
+ json value to edit the colour of the button. You can also identify as a given user and then update the settings for the
29
+ secret button feature for that user in the flagsmith interface to see the affect that has too.
data/example/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'rake'
2
+ require 'hanami/rake_tasks'
3
+
4
+ begin
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ end