fflags 0.3.1 → 0.3.2

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: a5268321d568d3ff52cecb10111988e1d0574901
4
- data.tar.gz: b7f9586ecb6eafb4ba8492e1303dde0d6ec9803f
3
+ metadata.gz: 5d1389be1843e51448d44241e0ad68dca1cfa88c
4
+ data.tar.gz: 9bf7ce3976e7d2fb5604b3a36e23ed3b1cfe78f7
5
5
  SHA512:
6
- metadata.gz: 5482d73658767d5b23864b159bd44439c921510ba2c5d40931c5244297d4baadd93cf4a7dfd003f56217b73e80e22520da9cf93a182123f6bccd02470969a96b
7
- data.tar.gz: df7018b9489c7bd55e6d9c11a70d597f8bee8a35b16506f6923307b561fa944235e61420c40dc8d58dcdd54c454ca3a86648bec673a9ca71c254057ffb48531b
6
+ metadata.gz: 7a72393c11306763e0314b4007e90fb7108188efd380dd451ec8df36817addca0da376c8b8ba30551e4a84fc86f7e8c4cf9029f9d05d33cf76a4582e34ab6c9f
7
+ data.tar.gz: a80092d308cf47f2b3d364d62ebfaeafdc36872d097a518190b95f5c167791c3e580912043fce0f3873cd680225b448f46e2b8dc76d5b54c83f2e55873101143
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fflags (0.3.1)
4
+ fflags (0.3.2)
5
5
  redis (>= 3.0.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # FFlags
2
2
 
3
+ Feature flags that can be overwritten on the fly. It could be per instance or per environment. Depending on how you set your key, either dynamically per instance or constant per environment.
4
+
5
+ It uses Redis to store the information, and the size should be very small, depending on how many flags you need to track.
6
+
3
7
  ## Installation
4
8
 
5
9
  Add this line to your application's Gemfile:
@@ -15,28 +19,62 @@ And then execute:
15
19
  Or install it yourself as:
16
20
 
17
21
  $ gem install fflags
22
+
23
+
24
+ ## How to Configure FFlags
18
25
 
19
- ## Usage
26
+ To configure the FFlags,
20
27
 
21
28
  ```ruby
22
- require 'socket'
29
+ FFlags.config { |config .. }
30
+ ```
31
+
32
+ #### Supported Configs
33
+
34
+ | Config | Description | Default |
35
+ |-----------|-------------------|---------|
36
+ | key | Key to store the flags, in Redis, it would look something like, `{ key: <flags as a Hash> }` | code3.io |
37
+ | flags     | Flags to be tracked as a Hash, and value as a boolean) | {} |
38
+ | redis_url | Redis url, where the flags will be stored | redis://127.0.0.1:6379 |
39
+ | debug | For debugging, NOT BEING USED RIGHT NOW | false |
23
40
 
41
+ ## Example of Usage
42
+
43
+ - If you want the flags to be unique per instance, you can use hostname of the instance as such:
44
+
45
+ ```ruby
24
46
  FFlags.config do |config|
25
47
  config.key = Socket.gethostname
26
48
  config.flags = { new_view: true }
27
49
  end
28
50
  ```
29
51
 
52
+ - If you want the flags to be unique per environment, you can use the key as such:
53
+
54
+ ```ruby
55
+ FFlags.config do |config|
56
+ config.key = Rails.environment,
57
+ config.flags = { new_view: true }
58
+ end
59
+ ```
60
+
30
61
  Then in the code,
31
62
 
32
63
  ```ruby
33
64
  # Verify if the flag is enabled
34
- FFlags.enabled?(:new_view)
65
+ if FFlags.enabled?(:new_view)
66
+ # Do something
67
+ end
68
+ # or
69
+ if FFlags.new_view?
70
+ # Do something
71
+ end
72
+
35
73
 
36
74
  # Overwrite flag
37
75
  FFlags.toggle(:new_view)
38
76
  # or
39
- FFlags.set_flag(:new_view, false)
77
+ FFlags.set(:new_view, false)
40
78
 
41
79
  # To reset, and get back to the default settings.
42
80
  FFlags.reset
@@ -0,0 +1,3 @@
1
+ module FFlags
2
+ VERSION = '0.3.2'.freeze
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fflags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Faizal Zakaria
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-26 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -97,11 +97,11 @@ files:
97
97
  - README.md
98
98
  - Rakefile
99
99
  - fflags.gemspec
100
- - lib/FFlags/version.rb
101
100
  - lib/fflags.rb
102
101
  - lib/fflags/api.rb
103
102
  - lib/fflags/configuration.rb
104
103
  - lib/fflags/redis_client.rb
104
+ - lib/fflags/version.rb
105
105
  homepage: https://faizalzakaria.github.com
106
106
  licenses:
107
107
  - MIT
@@ -1,3 +0,0 @@
1
- module FFlags
2
- VERSION = '0.3.1'.freeze
3
- end