flipper-ui 0.20.3 → 0.20.4

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: 02c1c4f1cd2496bbf2c3d7c0f2c07d9c284e94d1aad662484a4baf68b1c1f331
4
- data.tar.gz: 3f76ab34733b9c1e4d44ed0a955ac9373dbe7a90ab12861bedb9879c02fa0e22
3
+ metadata.gz: be8e990a613d1aedf2e856e7690189867bf51f3649c85b5e9a02eecaa2b8004d
4
+ data.tar.gz: 3a7778cb7097093911a9dfde08bfc0984ef1290122bcc7a3967ca4f63025c00f
5
5
  SHA512:
6
- metadata.gz: 996926448609e45c6bd2bc180cd1870606ffb9708ccc9dbc2e318f25b3a4dc7eb2db07d7130bc84caf2cc54f512216bdef44340ac0a163292ada259979bd2e52
7
- data.tar.gz: 66414f02d26662ab28adbebdf09edb26da6b474d45d658b79c41bd5a396179cf2d0d6be7990756be9538a5363b674fecf599d24a5a851eacd2f46cbb37e35f12
6
+ metadata.gz: 7964377fc793564b88887b4f25f8bceeeb6c0c7577f380ccf19a068ed420bf1d283a0d0970fa7d3d5e9ebb76936a3a82528fb549f26376ce7d6ff65ac2425227
7
+ data.tar.gz: f0e10a642325711a65e9a896ec2fdd7df332480e2254e11ebb5dfb40d3a3960f8f2fddeb45b526e5283f7e9b7f6def49103fdbf70ebd3bcf00a6210961dc8283
@@ -0,0 +1,89 @@
1
+ #
2
+ # Usage:
3
+ # bundle exec rackup examples/ui/authorization.ru -p 9999
4
+ # bundle exec shotgun examples/ui/authorization.ru -p 9999
5
+ # http://localhost:9999/
6
+ #
7
+ require "pp"
8
+ require "logger"
9
+ require "pathname"
10
+
11
+ root_path = Pathname(__FILE__).dirname.join("..").expand_path
12
+ lib_path = root_path.join("lib")
13
+ $:.unshift(lib_path)
14
+
15
+ require "flipper-ui"
16
+ require "flipper/adapters/pstore"
17
+ require "active_support/notifications"
18
+
19
+ Flipper.register(:admins) { |actor|
20
+ actor.respond_to?(:admin?) && actor.admin?
21
+ }
22
+
23
+ Flipper.register(:early_access) { |actor|
24
+ actor.respond_to?(:early?) && actor.early?
25
+ }
26
+
27
+ # Setup logging of flipper calls.
28
+ if ENV["LOG"] == "1"
29
+ $logger = Logger.new(STDOUT)
30
+ require "flipper/instrumentation/log_subscriber"
31
+ Flipper::Instrumentation::LogSubscriber.logger = $logger
32
+ end
33
+
34
+ adapter = Flipper::Adapters::PStore.new
35
+ flipper = Flipper.new(adapter, instrumenter: ActiveSupport::Notifications)
36
+
37
+ Flipper::UI.configure do |config|
38
+ # config.banner_text = 'Production Environment'
39
+ # config.banner_class = 'danger'
40
+ config.feature_creation_enabled = true
41
+ config.feature_removal_enabled = true
42
+ # config.show_feature_description_in_list = true
43
+ config.descriptions_source = lambda do |_keys|
44
+ {
45
+ "search_performance_another_long_thing" => "Just to test feature name length.",
46
+ "gauges_tracking" => "Should we track page views with gaug.es.",
47
+ "unused" => "Not used.",
48
+ "suits" => "Are suits necessary in business?",
49
+ "secrets" => "Secrets are lies.",
50
+ "logging" => "Log all the things.",
51
+ "new_cache" => "Like the old cache but newer.",
52
+ "a/b" => "Why would someone use a slash? I don't know but someone did. Let's make this really long so they regret using slashes. Please don't use slashes.",
53
+ }
54
+ end
55
+ end
56
+
57
+ # Example middleware to allow reading the Flipper UI but nothing else.
58
+ class FlipperReadOnlyMiddleware
59
+ def initialize(app)
60
+ @app = app
61
+ end
62
+
63
+ def call(env)
64
+ request = Rack::Request.new(env)
65
+
66
+ if request.get?
67
+ @app.call(env)
68
+ else
69
+ [401, {}, ["You can only look"]]
70
+ end
71
+ end
72
+ end
73
+
74
+ # You can uncomment these to get some default data:
75
+ # flipper[:search_performance_another_long_thing].enable
76
+ # flipper[:gauges_tracking].enable
77
+ # flipper[:unused].disable
78
+ # flipper[:suits].enable_actor Flipper::Actor.new('1')
79
+ # flipper[:suits].enable_actor Flipper::Actor.new('6')
80
+ # flipper[:secrets].enable_group :admins
81
+ # flipper[:secrets].enable_group :early_access
82
+ # flipper[:logging].enable_percentage_of_time 5
83
+ # flipper[:new_cache].enable_percentage_of_actors 15
84
+ # flipper["something/slashed"].add
85
+
86
+ run Flipper::UI.app(flipper) { |builder|
87
+ builder.use Rack::Session::Cookie, secret: "_super_secret"
88
+ builder.use FlipperReadOnlyMiddleware
89
+ }
Binary file
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.20.3'.freeze
2
+ VERSION = '0.20.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.3
4
+ version: 0.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-10 00:00:00.000000000 Z
11
+ date: 2021-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -56,14 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: 0.20.3
59
+ version: 0.20.4
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: 0.20.3
66
+ version: 0.20.4
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: erubi
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +96,7 @@ files:
96
96
  - docs/ui/images/description.png
97
97
  - docs/ui/images/feature.png
98
98
  - docs/ui/images/features.png
99
+ - examples/ui/authorization.ru
99
100
  - examples/ui/basic.ru
100
101
  - flipper-ui.gemspec
101
102
  - lib/flipper-ui.rb