flipper-rails 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/LICENSE +21 -0
- data/README.md +49 -0
- data/flipper-rails.gemspec +26 -0
- data/lib/flipper-rails.rb +1 -0
- data/lib/flipper/rails.rb +17 -0
- data/lib/flipper/rails/options.rb +17 -0
- data/lib/flipper/rails/railtie.rb +9 -0
- data/lib/flipper/rails/version.rb +5 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 36206aee77d472935057c1ab50ed30214c55c549
|
4
|
+
data.tar.gz: 39e7fd9005cce208f1fcb0029789fbe8e98b65ef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dcd947f889f300d8da851bad2be1878b2ec409ff5f91cb794d7bf594ae3e0dd380ed1b08415c22449be8b75e6bff8911cae63be27de98b73383920102b18bf70
|
7
|
+
data.tar.gz: bb23bfb3ddc172cdc3b832b2a48aae2a707676278c9352749e317938bc609fed0be7668de68ca300f97b0a8fd4360143e9faf4910970ea1feb77f29b8454f4ed
|
data/.gitignore
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalization:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
# Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Brendan Mulholland
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# flipper-rails
|
2
|
+
|
3
|
+
Lightweight wrapper around Flipper to initialize nicely in rails apps
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
### Installation
|
8
|
+
|
9
|
+
Add flipper-rails to your Gemfile:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem 'flipper-rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
If you'd like to use the adapter for ActiveRecord, Mongo or Redis, include the relevant Gem too:
|
16
|
+
|
17
|
+
```
|
18
|
+
gem 'flipper-active_record` # or flipper-mongo, flipper-redis
|
19
|
+
```
|
20
|
+
|
21
|
+
### Configuration
|
22
|
+
|
23
|
+
Configure your application (`config/application.rb` or `config/environments/<env>.rb`) with the adapter and options to use:
|
24
|
+
|
25
|
+
```
|
26
|
+
config.flipper = {
|
27
|
+
adapter: Flipper::Adapters::ActiveRecord,
|
28
|
+
adapter_options: {}
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
or
|
33
|
+
|
34
|
+
```
|
35
|
+
config.flipper = {
|
36
|
+
adapter: Flipper::Adapters::Redis,
|
37
|
+
adapter_options: Redis::Namespace.new(:flipper_namespace, redis: Redis.new)
|
38
|
+
}
|
39
|
+
```
|
40
|
+
|
41
|
+
Unfortunately the adapters cannot be included by this gem, so you must do so manually.
|
42
|
+
|
43
|
+
### In-App
|
44
|
+
|
45
|
+
Now to access flipper in-app, you can access it with `Flipper::Rails.flipper` e.g. `Flipper::Rails.flipper[:search].enabled?`
|
46
|
+
|
47
|
+
## ActiveRecord
|
48
|
+
|
49
|
+
The Flipper gem has a migration built in to create the migration that creates the flipper tables: `rails g flipper:active_record`
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'flipper/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "flipper-rails"
|
8
|
+
spec.version = Flipper::Rails::VERSION
|
9
|
+
spec.authors = ["Brendan Mulholland"]
|
10
|
+
spec.email = ["flipper-rails@bmulholland.ca"]
|
11
|
+
spec.homepage = 'http://github.com/bmulholland/flipper-rails'
|
12
|
+
spec.summary = %q{Feature flipper for ANYTHING... As long as it's made in Rails}
|
13
|
+
spec.description = %q{Feature flipper is the act of enabling/disabling features in your application, ideally without re-deploying or changing anything in your code base. Flipper makes this extremely easy to do with any backend you would like to use.}
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.extra_rdoc_files = %w[README.md LICENSE]
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "flipper"
|
23
|
+
spec.add_dependency "railties"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'flipper/rails'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Flipper
|
2
|
+
module Rails
|
3
|
+
def self.flipper
|
4
|
+
@flipper ||= Flipper.new(
|
5
|
+
::Rails.application.config.flipper[:adapter].new(
|
6
|
+
::Rails.application.config.flipper[:adapter_options] || {}
|
7
|
+
)
|
8
|
+
)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'flipper'
|
14
|
+
|
15
|
+
require 'flipper/rails/version'
|
16
|
+
require 'flipper/rails/options'
|
17
|
+
require 'flipper/rails/railtie'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Flipper
|
2
|
+
module Rails
|
3
|
+
class Options
|
4
|
+
ATTRIBUTE_NAMES = [
|
5
|
+
:adapter,
|
6
|
+
:adapter_options
|
7
|
+
]
|
8
|
+
private_constant :ATTRIBUTE_NAMES
|
9
|
+
attr_accessor(*ATTRIBUTE_NAMES)
|
10
|
+
|
11
|
+
def initialize(options={})
|
12
|
+
self.adapter = options[:adapter]
|
13
|
+
self.adapter_options = options[:adapter_options]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flipper-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brendan Mulholland
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: flipper
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: railties
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Feature flipper is the act of enabling/disabling features in your application,
|
56
|
+
ideally without re-deploying or changing anything in your code base. Flipper makes
|
57
|
+
this extremely easy to do with any backend you would like to use.
|
58
|
+
email:
|
59
|
+
- flipper-rails@bmulholland.ca
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files:
|
63
|
+
- README.md
|
64
|
+
- LICENSE
|
65
|
+
files:
|
66
|
+
- ".gitignore"
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- flipper-rails.gemspec
|
70
|
+
- lib/flipper-rails.rb
|
71
|
+
- lib/flipper/rails.rb
|
72
|
+
- lib/flipper/rails/options.rb
|
73
|
+
- lib/flipper/rails/railtie.rb
|
74
|
+
- lib/flipper/rails/version.rb
|
75
|
+
homepage: http://github.com/bmulholland/flipper-rails
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.4.5.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Feature flipper for ANYTHING... As long as it's made in Rails
|
99
|
+
test_files: []
|