featurehub-sdk 1.2.3 → 1.3.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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -2
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +5 -0
  5. data/Gemfile +3 -3
  6. data/Gemfile.lock +124 -63
  7. data/LICENSE +21 -0
  8. data/README.md +235 -0
  9. data/examples/rails_example/.env.example +13 -0
  10. data/examples/rails_example/.gitattributes +7 -0
  11. data/examples/rails_example/.gitignore +103 -0
  12. data/examples/rails_example/.ruby-version +1 -0
  13. data/examples/rails_example/Dockerfile +12 -0
  14. data/examples/rails_example/Gemfile +80 -0
  15. data/examples/rails_example/Gemfile.lock +283 -0
  16. data/examples/rails_example/README.md +36 -0
  17. data/examples/rails_example/Rakefile +8 -0
  18. data/examples/rails_example/app/assets/config/manifest.js +4 -0
  19. data/examples/rails_example/app/assets/images/.keep +0 -0
  20. data/examples/rails_example/app/assets/stylesheets/application.css +15 -0
  21. data/examples/rails_example/app/channels/application_cable/channel.rb +6 -0
  22. data/examples/rails_example/app/channels/application_cable/connection.rb +6 -0
  23. data/examples/rails_example/app/controllers/application_controller.rb +4 -0
  24. data/examples/rails_example/app/controllers/concerns/.keep +0 -0
  25. data/examples/rails_example/app/controllers/home_controller.rb +12 -0
  26. data/examples/rails_example/app/helpers/application_helper.rb +4 -0
  27. data/examples/rails_example/app/helpers/home_helper.rb +4 -0
  28. data/examples/rails_example/app/javascript/application.js +3 -0
  29. data/examples/rails_example/app/javascript/controllers/application.js +9 -0
  30. data/examples/rails_example/app/javascript/controllers/hello_controller.js +7 -0
  31. data/examples/rails_example/app/javascript/controllers/index.js +11 -0
  32. data/examples/rails_example/app/jobs/application_job.rb +9 -0
  33. data/examples/rails_example/app/mailers/application_mailer.rb +6 -0
  34. data/examples/rails_example/app/models/application_record.rb +5 -0
  35. data/examples/rails_example/app/models/concerns/.keep +0 -0
  36. data/examples/rails_example/app/views/home/index.html.erb +6 -0
  37. data/examples/rails_example/app/views/layouts/application.html.erb +16 -0
  38. data/examples/rails_example/app/views/layouts/mailer.html.erb +13 -0
  39. data/examples/rails_example/app/views/layouts/mailer.text.erb +1 -0
  40. data/examples/rails_example/bin/bundle +118 -0
  41. data/examples/rails_example/bin/importmap +5 -0
  42. data/examples/rails_example/bin/rails +6 -0
  43. data/examples/rails_example/bin/rake +6 -0
  44. data/examples/rails_example/bin/setup +35 -0
  45. data/examples/rails_example/config/application.rb +24 -0
  46. data/examples/rails_example/config/boot.rb +6 -0
  47. data/examples/rails_example/config/cable.yml +10 -0
  48. data/examples/rails_example/config/credentials.yml.enc +1 -0
  49. data/examples/rails_example/config/database.yml +25 -0
  50. data/examples/rails_example/config/environment.rb +7 -0
  51. data/examples/rails_example/config/environments/development.rb +72 -0
  52. data/examples/rails_example/config/environments/production.rb +95 -0
  53. data/examples/rails_example/config/environments/test.rb +62 -0
  54. data/examples/rails_example/config/importmap.rb +9 -0
  55. data/examples/rails_example/config/initializers/assets.rb +14 -0
  56. data/examples/rails_example/config/initializers/content_security_policy.rb +27 -0
  57. data/examples/rails_example/config/initializers/featurehub.rb +8 -0
  58. data/examples/rails_example/config/initializers/filter_parameter_logging.rb +10 -0
  59. data/examples/rails_example/config/initializers/inflections.rb +18 -0
  60. data/examples/rails_example/config/initializers/permissions_policy.rb +13 -0
  61. data/examples/rails_example/config/locales/en.yml +33 -0
  62. data/examples/rails_example/config/puma.rb +57 -0
  63. data/examples/rails_example/config/routes.rb +8 -0
  64. data/examples/rails_example/config/storage.yml +34 -0
  65. data/examples/rails_example/config.ru +8 -0
  66. data/examples/rails_example/db/seeds.rb +9 -0
  67. data/examples/rails_example/lib/assets/.keep +0 -0
  68. data/examples/rails_example/lib/tasks/.keep +0 -0
  69. data/examples/rails_example/log/.keep +0 -0
  70. data/examples/rails_example/public/404.html +67 -0
  71. data/examples/rails_example/public/422.html +67 -0
  72. data/examples/rails_example/public/500.html +66 -0
  73. data/examples/rails_example/public/apple-touch-icon-precomposed.png +0 -0
  74. data/examples/rails_example/public/apple-touch-icon.png +0 -0
  75. data/examples/rails_example/public/favicon.ico +0 -0
  76. data/examples/rails_example/public/robots.txt +1 -0
  77. data/examples/rails_example/storage/.keep +0 -0
  78. data/examples/rails_example/test/application_system_test_case.rb +7 -0
  79. data/examples/rails_example/test/channels/application_cable/connection_test.rb +15 -0
  80. data/examples/rails_example/test/controllers/.keep +0 -0
  81. data/examples/rails_example/test/controllers/home_controller_test.rb +9 -0
  82. data/examples/rails_example/test/fixtures/files/.keep +0 -0
  83. data/examples/rails_example/test/helpers/.keep +0 -0
  84. data/examples/rails_example/test/integration/.keep +0 -0
  85. data/examples/rails_example/test/mailers/.keep +0 -0
  86. data/examples/rails_example/test/models/.keep +0 -0
  87. data/examples/rails_example/test/system/.keep +0 -0
  88. data/examples/rails_example/test/test_helper.rb +17 -0
  89. data/examples/rails_example/tmp/.keep +0 -0
  90. data/examples/rails_example/tmp/pids/.keep +0 -0
  91. data/examples/rails_example/tmp/storage/.keep +0 -0
  92. data/examples/rails_example/vendor/.keep +0 -0
  93. data/examples/rails_example/vendor/javascript/.keep +0 -0
  94. data/examples/sinatra/.gitignore +3 -0
  95. data/examples/sinatra/.ruby-version +1 -0
  96. data/examples/sinatra/Dockerfile +42 -0
  97. data/examples/sinatra/Gemfile +16 -0
  98. data/examples/sinatra/Gemfile.lock +86 -0
  99. data/examples/sinatra/README.adoc +10 -0
  100. data/examples/sinatra/app/application.rb +141 -0
  101. data/examples/sinatra/build.sh +2 -0
  102. data/examples/sinatra/conf/nginx.conf +57 -0
  103. data/examples/sinatra/conf/nsswitch.conf +21 -0
  104. data/examples/sinatra/config.ru +17 -0
  105. data/examples/sinatra/docker_start.sh +3 -0
  106. data/examples/sinatra/sinatra.iml +22 -0
  107. data/examples/sinatra/start.sh +3 -0
  108. data/examples/sinatra/thin.ru +9 -0
  109. data/featurehub-ruby-sdk.iml +9 -0
  110. data/featurehub-sdk.gemspec +42 -0
  111. data/lib/feature_hub/sdk/feature_hub_config.rb +0 -2
  112. data/lib/feature_hub/sdk/impl/rollout_holders.rb +3 -3
  113. data/lib/feature_hub/sdk/streaming_edge_service.rb +1 -1
  114. data/lib/feature_hub/sdk/version.rb +1 -1
  115. metadata +114 -13
@@ -0,0 +1,103 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+ # Ignore uploaded files in development.
26
+ /storage/*
27
+ !/storage/.keep
28
+ /tmp/storage/*
29
+ !/tmp/storage/
30
+ !/tmp/storage/.keep
31
+
32
+ /public/assets
33
+
34
+ # Ignore master key for decrypting credentials and more.
35
+ /config/master.key
36
+
37
+ *.rbc
38
+ capybara-*.html
39
+ .rspec
40
+ /db/*.sqlite3
41
+ /db/*.sqlite3-journal
42
+ /db/*.sqlite3-[0-9]*
43
+ /public/system
44
+ /coverage/
45
+ /spec/tmp
46
+ *.orig
47
+ rerun.txt
48
+ pickle-email-*.html
49
+
50
+ # Ignore all logfiles and tempfiles.
51
+ /log/*
52
+ /tmp/*
53
+ !/log/.keep
54
+ !/tmp/.keep
55
+
56
+ # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
57
+ config/initializers/secret_token.rb
58
+ config/master.key
59
+
60
+ # Only include if you have production secrets in this file, which is no longer a Rails default
61
+ # config/secrets.yml
62
+
63
+ # dotenv, dotenv-rails
64
+ # TODO Comment out these rules if environment variables can be committed
65
+ .env
66
+ .env*.local
67
+ !.env.example
68
+
69
+ ## Environment normalization:
70
+ /.bundle
71
+ /vendor/bundle
72
+
73
+ # these should all be checked in to normalize the environment:
74
+ # Gemfile.lock, .ruby-version, .ruby-gemset
75
+
76
+ # if using bower-rails ignore default bower_components path bower.json files
77
+ /vendor/assets/bower_components
78
+ *.bowerrc
79
+ bower.json
80
+
81
+ # Ignore pow environment settings
82
+ .powenv
83
+
84
+ # Ignore Byebug command history file.
85
+ .byebug_history
86
+
87
+ # Ignore node_modules
88
+ node_modules/
89
+
90
+ # Ignore precompiled javascript packs
91
+ /public/packs
92
+ /public/packs-test
93
+ /public/assets
94
+
95
+ # Ignore yarn files
96
+ /yarn-error.log
97
+ yarn-debug.log*
98
+ .yarn-integrity
99
+
100
+ # Ignore uploaded files in development
101
+ /storage/*
102
+ !/storage/.keep
103
+ /public/uploads
@@ -0,0 +1 @@
1
+ 3.0.6
@@ -0,0 +1,12 @@
1
+ FROM ruby:3.1.2
2
+
3
+ LABEL Author="info@featurehub.io"
4
+
5
+ RUN apt-get update -qq
6
+ WORKDIR /rails_example
7
+ COPY . /rails_example/
8
+ RUN bundle install
9
+
10
+ EXPOSE 3000
11
+
12
+ CMD ["bin/rails", "server", "-b", "0.0.0.0"]
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
+
6
+ ruby "3.1.2"
7
+
8
+ # The most relevant gem for this particular app
9
+ gem "featurehub-sdk"
10
+
11
+ # Dotenv helps us manage environment variables
12
+ gem "dotenv-rails"
13
+
14
+ # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
15
+ gem "rails", "~> 7.0.3"
16
+
17
+ # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
18
+ gem "sprockets-rails"
19
+
20
+ # Use sqlite3 as the database for Active Record
21
+ gem "sqlite3", "~> 1.4"
22
+
23
+ # Use the Puma web server [https://github.com/puma/puma]
24
+ gem "puma", "~> 5.6"
25
+
26
+ # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
27
+ gem "importmap-rails"
28
+
29
+ # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
30
+ gem "turbo-rails"
31
+
32
+ # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
33
+ gem "stimulus-rails"
34
+
35
+ # Build JSON APIs with ease [https://github.com/rails/jbuilder]
36
+ gem "jbuilder"
37
+
38
+ # Use Redis adapter to run Action Cable in production
39
+ # gem "redis", "~> 4.0"
40
+
41
+ # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
42
+ # gem "kredis"
43
+
44
+ # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
45
+ # gem "bcrypt", "~> 3.1.7"
46
+
47
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
48
+ gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
49
+
50
+ # Reduces boot times through caching; required in config/boot.rb
51
+ gem "bootsnap", require: false
52
+
53
+ # Use Sass to process CSS
54
+ # gem "sassc-rails"
55
+
56
+ # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
57
+ # gem "image_processing", "~> 1.2"
58
+
59
+ group :development, :test do
60
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
61
+ gem "debug", platforms: %i[mri mingw x64_mingw]
62
+ end
63
+
64
+ group :development do
65
+ # Use console on exceptions pages [https://github.com/rails/web-console]
66
+ gem "web-console"
67
+
68
+ # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
69
+ # gem "rack-mini-profiler"
70
+
71
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
72
+ # gem "spring"
73
+ end
74
+
75
+ group :test do
76
+ # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
77
+ gem "capybara"
78
+ gem "selenium-webdriver"
79
+ gem "webdrivers"
80
+ end
@@ -0,0 +1,283 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actioncable (7.0.3)
5
+ actionpack (= 7.0.3)
6
+ activesupport (= 7.0.3)
7
+ nio4r (~> 2.0)
8
+ websocket-driver (>= 0.6.1)
9
+ actionmailbox (7.0.3)
10
+ actionpack (= 7.0.3)
11
+ activejob (= 7.0.3)
12
+ activerecord (= 7.0.3)
13
+ activestorage (= 7.0.3)
14
+ activesupport (= 7.0.3)
15
+ mail (>= 2.7.1)
16
+ net-imap
17
+ net-pop
18
+ net-smtp
19
+ actionmailer (7.0.3)
20
+ actionpack (= 7.0.3)
21
+ actionview (= 7.0.3)
22
+ activejob (= 7.0.3)
23
+ activesupport (= 7.0.3)
24
+ mail (~> 2.5, >= 2.5.4)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (7.0.3)
30
+ actionview (= 7.0.3)
31
+ activesupport (= 7.0.3)
32
+ rack (~> 2.0, >= 2.2.0)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (7.0.3)
37
+ actionpack (= 7.0.3)
38
+ activerecord (= 7.0.3)
39
+ activestorage (= 7.0.3)
40
+ activesupport (= 7.0.3)
41
+ globalid (>= 0.6.0)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (7.0.3)
44
+ activesupport (= 7.0.3)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (7.0.3)
50
+ activesupport (= 7.0.3)
51
+ globalid (>= 0.3.6)
52
+ activemodel (7.0.3)
53
+ activesupport (= 7.0.3)
54
+ activerecord (7.0.3)
55
+ activemodel (= 7.0.3)
56
+ activesupport (= 7.0.3)
57
+ activestorage (7.0.3)
58
+ actionpack (= 7.0.3)
59
+ activejob (= 7.0.3)
60
+ activerecord (= 7.0.3)
61
+ activesupport (= 7.0.3)
62
+ marcel (~> 1.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (7.0.3)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ addressable (2.8.0)
70
+ public_suffix (>= 2.0.2, < 5.0)
71
+ bindex (0.8.1)
72
+ bootsnap (1.12.0)
73
+ msgpack (~> 1.2)
74
+ builder (3.2.4)
75
+ capybara (3.37.1)
76
+ addressable
77
+ matrix
78
+ mini_mime (>= 0.1.3)
79
+ nokogiri (~> 1.8)
80
+ rack (>= 1.6.0)
81
+ rack-test (>= 0.6.3)
82
+ regexp_parser (>= 1.5, < 3.0)
83
+ xpath (~> 3.2)
84
+ childprocess (4.1.0)
85
+ concurrent-ruby (1.1.10)
86
+ crass (1.0.6)
87
+ debug (1.5.0)
88
+ irb (>= 1.3.6)
89
+ reline (>= 0.2.7)
90
+ digest (3.1.0)
91
+ domain_name (0.5.20190701)
92
+ unf (>= 0.0.5, < 1.0.0)
93
+ dotenv (2.7.6)
94
+ dotenv-rails (2.7.6)
95
+ dotenv (= 2.7.6)
96
+ railties (>= 3.2)
97
+ erubi (1.10.0)
98
+ faraday (2.3.0)
99
+ faraday-net_http (~> 2.0)
100
+ ruby2_keywords (>= 0.0.4)
101
+ faraday-net_http (2.0.3)
102
+ featurehub-sdk (1.0.0)
103
+ concurrent-ruby (~> 1.1.10)
104
+ faraday (~> 2.3)
105
+ ld-eventsource (~> 2.2.0)
106
+ murmurhash3 (~> 0.1.6)
107
+ sem_version (~> 2.0.0)
108
+ ffi (1.15.5)
109
+ ffi-compiler (1.0.1)
110
+ ffi (>= 1.0.0)
111
+ rake
112
+ globalid (1.0.1)
113
+ activesupport (>= 5.0)
114
+ http (5.1.0)
115
+ addressable (~> 2.8)
116
+ http-cookie (~> 1.0)
117
+ http-form_data (~> 2.2)
118
+ llhttp-ffi (~> 0.4.0)
119
+ http-cookie (1.0.5)
120
+ domain_name (~> 0.5)
121
+ http-form_data (2.3.0)
122
+ i18n (1.12.0)
123
+ concurrent-ruby (~> 1.0)
124
+ importmap-rails (1.1.2)
125
+ actionpack (>= 6.0.0)
126
+ railties (>= 6.0.0)
127
+ io-console (0.5.11)
128
+ irb (1.4.1)
129
+ reline (>= 0.3.0)
130
+ jbuilder (2.11.5)
131
+ actionview (>= 5.0.0)
132
+ activesupport (>= 5.0.0)
133
+ ld-eventsource (2.2.1)
134
+ concurrent-ruby (~> 1.0)
135
+ http (>= 4.4.1, < 6.0.0)
136
+ llhttp-ffi (0.4.0)
137
+ ffi-compiler (~> 1.0)
138
+ rake (~> 13.0)
139
+ loofah (2.19.1)
140
+ crass (~> 1.0.2)
141
+ nokogiri (>= 1.5.9)
142
+ mail (2.7.1)
143
+ mini_mime (>= 0.1.1)
144
+ marcel (1.0.2)
145
+ matrix (0.4.2)
146
+ method_source (1.0.0)
147
+ mini_mime (1.1.2)
148
+ minitest (5.17.0)
149
+ msgpack (1.5.3)
150
+ murmurhash3 (0.1.6)
151
+ net-imap (0.2.3)
152
+ digest
153
+ net-protocol
154
+ strscan
155
+ net-pop (0.1.1)
156
+ digest
157
+ net-protocol
158
+ timeout
159
+ net-protocol (0.1.3)
160
+ timeout
161
+ net-smtp (0.3.1)
162
+ digest
163
+ net-protocol
164
+ timeout
165
+ nio4r (2.7.0)
166
+ nokogiri (1.16.2-x86_64-darwin)
167
+ racc (~> 1.4)
168
+ nokogiri (1.16.2-x86_64-linux)
169
+ racc (~> 1.4)
170
+ public_suffix (4.0.7)
171
+ puma (5.6.8)
172
+ nio4r (~> 2.0)
173
+ racc (1.7.3)
174
+ rack (2.2.6.4)
175
+ rack-test (2.0.2)
176
+ rack (>= 1.3)
177
+ rails (7.0.3)
178
+ actioncable (= 7.0.3)
179
+ actionmailbox (= 7.0.3)
180
+ actionmailer (= 7.0.3)
181
+ actionpack (= 7.0.3)
182
+ actiontext (= 7.0.3)
183
+ actionview (= 7.0.3)
184
+ activejob (= 7.0.3)
185
+ activemodel (= 7.0.3)
186
+ activerecord (= 7.0.3)
187
+ activestorage (= 7.0.3)
188
+ activesupport (= 7.0.3)
189
+ bundler (>= 1.15.0)
190
+ railties (= 7.0.3)
191
+ rails-dom-testing (2.0.3)
192
+ activesupport (>= 4.2.0)
193
+ nokogiri (>= 1.6)
194
+ rails-html-sanitizer (1.5.0)
195
+ loofah (~> 2.19, >= 2.19.1)
196
+ railties (7.0.3)
197
+ actionpack (= 7.0.3)
198
+ activesupport (= 7.0.3)
199
+ method_source
200
+ rake (>= 12.2)
201
+ thor (~> 1.0)
202
+ zeitwerk (~> 2.5)
203
+ rake (13.0.6)
204
+ regexp_parser (2.5.0)
205
+ reline (0.3.1)
206
+ io-console (~> 0.5)
207
+ rexml (3.2.5)
208
+ ruby2_keywords (0.0.5)
209
+ rubyzip (2.3.2)
210
+ selenium-webdriver (4.3.0)
211
+ childprocess (>= 0.5, < 5.0)
212
+ rexml (~> 3.2, >= 3.2.5)
213
+ rubyzip (>= 1.2.2, < 3.0)
214
+ websocket (~> 1.0)
215
+ sem_version (2.0.1)
216
+ sprockets (4.1.1)
217
+ concurrent-ruby (~> 1.0)
218
+ rack (> 1, < 3)
219
+ sprockets-rails (3.4.2)
220
+ actionpack (>= 5.2)
221
+ activesupport (>= 5.2)
222
+ sprockets (>= 3.0.0)
223
+ sqlite3 (1.4.4)
224
+ stimulus-rails (1.0.4)
225
+ railties (>= 6.0.0)
226
+ strscan (3.0.3)
227
+ thor (1.2.1)
228
+ timeout (0.3.0)
229
+ turbo-rails (1.1.1)
230
+ actionpack (>= 6.0.0)
231
+ activejob (>= 6.0.0)
232
+ railties (>= 6.0.0)
233
+ tzinfo (2.0.5)
234
+ concurrent-ruby (~> 1.0)
235
+ unf (0.1.4)
236
+ unf_ext
237
+ unf_ext (0.0.8.2)
238
+ web-console (4.2.0)
239
+ actionview (>= 6.0.0)
240
+ activemodel (>= 6.0.0)
241
+ bindex (>= 0.4.0)
242
+ railties (>= 6.0.0)
243
+ webdrivers (5.0.0)
244
+ nokogiri (~> 1.6)
245
+ rubyzip (>= 1.3.0)
246
+ selenium-webdriver (~> 4.0)
247
+ websocket (1.2.9)
248
+ websocket-driver (0.7.5)
249
+ websocket-extensions (>= 0.1.0)
250
+ websocket-extensions (0.1.5)
251
+ xpath (3.2.0)
252
+ nokogiri (~> 1.8)
253
+ zeitwerk (2.6.0)
254
+
255
+ PLATFORMS
256
+ x86_64-darwin-20
257
+ x86_64-darwin-21
258
+ x86_64-linux
259
+
260
+ DEPENDENCIES
261
+ bootsnap
262
+ capybara
263
+ debug
264
+ dotenv-rails
265
+ featurehub-sdk
266
+ importmap-rails
267
+ jbuilder
268
+ puma (~> 5.6)
269
+ rails (~> 7.0.3)
270
+ selenium-webdriver
271
+ sprockets-rails
272
+ sqlite3 (~> 1.4)
273
+ stimulus-rails
274
+ turbo-rails
275
+ tzinfo-data
276
+ web-console
277
+ webdrivers
278
+
279
+ RUBY VERSION
280
+ ruby 3.1.2p20
281
+
282
+ BUNDLED WITH
283
+ 2.3.7
@@ -0,0 +1,36 @@
1
+ # Rails Example
2
+
3
+ This is an example Rails app that uses the FeatureHub (FH) Ruby SDK. Find below a (hopefully) comprehensive list of steps
4
+ that were use to generate this application as well as a walkthrough of the important bits of code to take a look at in
5
+ order to understand how to use the FeatureHub Ruby SDK in your Rails app(s)!
6
+
7
+ ## Requirements
8
+
9
+ This is a mostly standard Rails app. There are a couple of minor bells and whistles that shouldn't be uncomfortable for
10
+ most folks.
11
+
12
+ It's reasonably common to work with multiple versions of Ruby on a single machine, and you'll notice that this app has a
13
+ `.ruby-version` file. If you have [rbenv](https://github.com/rbenv/rbenv) installed then you can run `rbenv install`
14
+ from the base directory of this project to (1) install Ruby 3.1.2 on your machine and (2) use it as the ruby version for
15
+ this project.
16
+
17
+ After making sure the correct version of Ruby is installed, you can install all the dependencies for the project by
18
+ running `bundle install`.
19
+
20
+ ## FeatureHub Setup
21
+
22
+ In order for this app to work locally you'll need to have FeatureHub set up on your machine or have an instance running somewhere.
23
+ In order to get the simplest version of FeatureHub working, run the command from [Evaluating FeatureHub](https://docs.featurehub.io/featurehub/latest/index.html#_evaluating_featurehub).
24
+
25
+ Now that FH is running, head to the Admin Console (probably running at http://localhost:8085). You'll be taken through a workflow to create a user, and then there will be some instructions on the right side of your screen.
26
+
27
+ Complete all of those steps, and when you create a feature make sure that the feature key is `demo_feature`.
28
+
29
+ ## Important bits of code
30
+
31
+ To use the FeatureHub Ruby SDK in your Rails app, you need to install it first! Check out the [Gemfile](Gemfile#L7) to
32
+ see how you can install the gem in your Rails app.
33
+
34
+ Copy the [.env.example](examples/rails_example/.env.example) and rename the copy to `.env.local`. Change the API key to
35
+ the API key that you retrieved within your local FH instance to make sure that flag evaluations occur correctly! Similarly,
36
+ you may need to update the edge URL depending on how you intend to run this app and FeatureHub.
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
+
6
+ require_relative "config/application"
7
+
8
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link_tree ../../javascript .js
4
+ //= link_tree ../../../vendor/javascript .js
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Channel < ActionCable::Channel::Base
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Connection < ActionCable::Connection::Base
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class HomeController < ApplicationController
4
+ def index
5
+ @flag_globally_enabled = Rails.configuration.fh_config.new_context.build.feature(:demo_feature).flag
6
+ @flag_enabled_for_user_key = Rails.configuration.fh_config.new_context.user_key("some_key")
7
+ .build.feature(:demo_feature).flag
8
+ @flag_enabled_for_custom_splitting_rule = Rails.configuration.fh_config
9
+ .new_context.attribute_value("location_id", [5])
10
+ .build.feature(:demo_feature).flag
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HomeHelper
4
+ end
@@ -0,0 +1,3 @@
1
+ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2
+ import "@hotwired/turbo-rails"
3
+ import "controllers"
@@ -0,0 +1,9 @@
1
+ import { Application } from "@hotwired/stimulus"
2
+
3
+ const application = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ application.debug = false
7
+ window.Stimulus = application
8
+
9
+ export { application }
@@ -0,0 +1,7 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ this.element.textContent = "Hello World!"
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ // Import and register all your controllers from the importmap under controllers/*
2
+
3
+ import { application } from "controllers/application"
4
+
5
+ // Eager load all controllers defined in the import map under controllers/**/*_controller
6
+ import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7
+ eagerLoadControllersFrom("controllers", application)
8
+
9
+ // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10
+ // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11
+ // lazyLoadControllersFrom("controllers", application)
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ # Automatically retry jobs that encountered a deadlock
5
+ # retry_on ActiveRecord::Deadlocked
6
+
7
+ # Most jobs are safe to ignore if the underlying records are no longer available
8
+ # discard_on ActiveJob::DeserializationError
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: "from@example.com"
5
+ layout "mailer"
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ primary_abstract_class
5
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ <p>
2
+ See evaluations of the <code>demo_feature</code> feature flag based on different splitting rules below:<br/><br/>
3
+ <strong>Globally Enabled?</strong>:&nbsp;<%= @flag_globally_enabled %><br/>
4
+ <strong>Enabled For Current User?</strong>:&nbsp;<%= @flag_enabled_for_user_key %><br/>
5
+ <strong>Enabled for Custom Splitting Rule?</strong>:&nbsp;<%= @flag_enabled_for_custom_splitting_rule %><br/>
6
+ <p>