flipper 0.7.0 → 0.7.1

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
  SHA1:
3
- metadata.gz: 03893918187a23f82ff77ec7c88587be111ffb7f
4
- data.tar.gz: 6c4ebaabd49273abaeeb9803266cc2d81aff58d5
3
+ metadata.gz: 843d4702915781ed5862b1e06ad68f1bbc70edab
4
+ data.tar.gz: b3709b9a9bddaee1e6847eca0401f4bbcfe09944
5
5
  SHA512:
6
- metadata.gz: d8d36b6752af084d8e3e087bedfe02d2074d8d1846b602a0a50b644deadf4bfd1f95b9299975c43b464e522a60137dc4513f9161597565496fd89e9984a36b02
7
- data.tar.gz: 5149b9bba88fd4f5cc3de1893517f22d3cf02f3427df4d67efde604891233f2a37200696f77ac801421c1082d77ae99cd8ca8ed51f4547281e2946448b3453e3
6
+ metadata.gz: 06713185ad986e260ab2e409f9b995267c938823c8f7a7193ce82e618a753849e813d3a34f5af3100aed44e79d5c2874b1acf9cef09fc588505ecc8f1cf59892
7
+ data.tar.gz: f1dab95196ab81477d3eb0e2c667fa36341763417582efc6181a40d5f64f60c24d118fd840a7bde4155b820301a6991e25975c8a88faa8ff4cb495e5946061e4
@@ -1,3 +1,7 @@
1
+ ## 0.7.1
2
+
3
+ * Fix bug where features with names that match static file routes were incorrectly routing to the file action (https://github.com/jnunemaker/flipper/issues/80)
4
+
1
5
  ## 0.7
2
6
 
3
7
  * Added Flipper.groups and Flipper.group_names
@@ -0,0 +1,94 @@
1
+ require File.expand_path('../example_setup', __FILE__)
2
+
3
+ require 'flipper'
4
+ require 'flipper/adapters/memory'
5
+
6
+ adapter = Flipper::Adapters::Memory.new
7
+ flipper = Flipper.new(adapter)
8
+ stats = flipper[:stats]
9
+
10
+ # Register group
11
+ Flipper.register(:team_actor) do |actor|
12
+ actor.is_a?(TeamActor) && actor.allowed?
13
+ end
14
+
15
+ # Some class that represents actor that will be trying to do something
16
+ class User
17
+ attr_reader :id
18
+
19
+ def initialize(id)
20
+ @id = id
21
+ end
22
+
23
+ # Must respond to flipper_id
24
+ alias_method :flipper_id, :id
25
+ end
26
+
27
+ class Team
28
+ attr_reader :name
29
+
30
+ def initialize(name, members)
31
+ @name = name
32
+ @members = members
33
+ end
34
+
35
+ def id
36
+ @name
37
+ end
38
+
39
+ def member?(actor)
40
+ @members.include?(actor)
41
+ end
42
+ end
43
+
44
+ class TeamActor
45
+ def initialize(team, actor)
46
+ @team = team
47
+ @actor = actor
48
+ end
49
+
50
+ def allowed?
51
+ @team.member?(@actor)
52
+ end
53
+
54
+ def flipper_id
55
+ "TeamActor:#{@team.id}:#{@actor.id}"
56
+ end
57
+ end
58
+
59
+ jnunemaker = User.new(1)
60
+ jbarnette = User.new(2)
61
+ aroben = User.new(3)
62
+
63
+ core_app = Team.new(:core_app, [jbarnette, jnunemaker])
64
+ feature_flags = Team.new(:feature_flags, [aroben, jnunemaker])
65
+
66
+ core_nunes = TeamActor.new(core_app, jnunemaker)
67
+ core_roben = TeamActor.new(core_app, aroben)
68
+
69
+ if stats.enabled?(core_nunes)
70
+ puts "stats are enabled for jnunemaker"
71
+ else
72
+ puts "stats are NOT enabled for jnunemaker"
73
+ end
74
+
75
+ if stats.enabled?(core_roben)
76
+ puts "stats are enabled for aroben"
77
+ else
78
+ puts "stats are NOT enabled for aroben"
79
+ end
80
+
81
+ puts "enabling team_actor group"
82
+ stats.enable_group :team_actor
83
+
84
+ if stats.enabled?(core_nunes)
85
+ puts "stats are enabled for jnunemaker"
86
+ else
87
+ puts "stats are NOT enabled for jnunemaker"
88
+ end
89
+
90
+ if stats.enabled?(core_roben)
91
+ puts "stats are enabled for aroben"
92
+ else
93
+ puts "stats are NOT enabled for aroben"
94
+ end
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-21 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Feature flipper is the act of enabling/disabling features in your application,
14
14
  ideally without re-deploying or changing anything in your code base. Flipper makes
@@ -33,6 +33,7 @@ files:
33
33
  - examples/dsl.rb
34
34
  - examples/example_setup.rb
35
35
  - examples/group.rb
36
+ - examples/group_with_members.rb
36
37
  - examples/individual_actor.rb
37
38
  - examples/instrumentation.rb
38
39
  - examples/percentage_of_actors.rb