feature_flag 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ # See http://help.github.com/ignore-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 gem files
11
+ pkg
12
+
13
+ # Ignore coverage files
14
+ /coverage
15
+
16
+ # Ignore the default SQLite database.
17
+ /db/*.sqlite3
18
+
19
+ # Ignore all logfiles and tempfiles.
20
+ /log/*.log
21
+ /tmp
22
+
23
+ # Ignore rails config
24
+ config/database.yml
25
+ config/email.yml
26
+
27
+ # Ignore generic files
28
+ *.DS_Store
29
+ *.tags*
30
+
31
+ # Ignore heroku files
32
+ /.anvil
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ - 2.0.0
5
+ before_install: gem install bundler
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
+ gem 'coveralls', require: false
@@ -1,13 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- feature_flag (0.0.1)
4
+ feature_flag (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ colorize (0.5.8)
10
+ coveralls (0.6.7)
11
+ colorize
12
+ multi_json (~> 1.3)
13
+ rest-client
14
+ simplecov (>= 0.7)
15
+ thor
9
16
  diff-lcs (1.2.4)
17
+ mime-types (1.23)
18
+ multi_json (1.7.3)
10
19
  rake (10.0.4)
20
+ rest-client (1.6.7)
21
+ mime-types (>= 1.16)
11
22
  rspec (2.13.0)
12
23
  rspec-core (~> 2.13.0)
13
24
  rspec-expectations (~> 2.13.0)
@@ -16,12 +27,18 @@ GEM
16
27
  rspec-expectations (2.13.0)
17
28
  diff-lcs (>= 1.1.3, < 2.0)
18
29
  rspec-mocks (2.13.1)
30
+ simplecov (0.7.1)
31
+ multi_json (~> 1.0)
32
+ simplecov-html (~> 0.7.1)
33
+ simplecov-html (0.7.1)
34
+ thor (0.18.1)
19
35
 
20
36
  PLATFORMS
21
37
  ruby
22
38
 
23
39
  DEPENDENCIES
24
40
  bundler (~> 1.3)
41
+ coveralls
25
42
  feature_flag!
26
43
  rake
27
44
  rspec
data/README.md CHANGED
@@ -2,8 +2,11 @@
2
2
 
3
3
  Ruby gem for tying feature flags to environment variables
4
4
 
5
- ## Build Status
5
+ ## Status
6
+ [![Gem Version](https://badge.fury.io/rb/feature_flag.png)](http://badge.fury.io/rb/feature_flag)
6
7
  [![Build Status](https://secure.travis-ci.org/tylermercier/feature_flag.png)](http://travis-ci.org/tylermercier/feature_flag)
8
+ [![Code Climate](https://codeclimate.com/github/tylermercier/feature_flag.png)](https://codeclimate.com/github/tylermercier/feature_flag)
9
+ [![Coverage Status](https://coveralls.io/repos/tylermercier/feature_flag/badge.png)](https://coveralls.io/r/tylermercier/feature_flag)
7
10
 
8
11
  ## Installation
9
12
 
@@ -19,9 +22,15 @@ Or install it yourself as:
19
22
 
20
23
  $ gem install feature_flag
21
24
 
22
- ## Usage
25
+ ## How to use
23
26
 
24
- Doing trunk based development? Want to continuously release to production? Try feature_flag
27
+ Add an environment variable for your feature (FEATURE=true)
28
+
29
+ [dotenv](https://github.com/bkeepers/dotenv) is a great gem for managing environment variables
30
+
31
+ Check if the feature is enabled
32
+
33
+ return 'feature enabled' if FeatureFlag::FEATURE
25
34
 
26
35
  ## Contributing
27
36
 
@@ -5,7 +5,6 @@ class Lookup
5
5
  end
6
6
 
7
7
  def self.enabled(value)
8
- return true if value =~ (/(true|t|yes|y|enabled|1)$/i)
9
- false
8
+ !!(value =~ /^(true|t|yes|y|enabled|1)$/i)
10
9
  end
11
10
  end
@@ -1,3 +1,3 @@
1
1
  module FeatureFlag
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -29,6 +29,12 @@ describe Lookup do
29
29
  end
30
30
  end
31
31
 
32
+ it 'should not have false positive matches to non-true values' do
33
+ %w(untrue not eyes silly unenabled 101).each do |value|
34
+ Lookup.enabled(value).should == false
35
+ end
36
+ end
37
+
32
38
  it 'should match false values' do
33
39
  %w(false f no n disabled 0).each do |value|
34
40
  Lookup.enabled(value).should == false
@@ -1,2 +1,5 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  SPEC_ROOT = Pathname(__FILE__).dirname.expand_path
2
5
  require SPEC_ROOT.parent + 'lib/feature_flag'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feature_flag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,6 +50,7 @@ executables: []
50
50
  extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
+ - .gitignore
53
54
  - .rspec
54
55
  - .rvmrc
55
56
  - .travis.yml
@@ -80,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
81
  version: '0'
81
82
  segments:
82
83
  - 0
83
- hash: 66192937362483026
84
+ hash: -2853581192479140521
84
85
  required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  none: false
86
87
  requirements:
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  version: '0'
90
91
  segments:
91
92
  - 0
92
- hash: 66192937362483026
93
+ hash: -2853581192479140521
93
94
  requirements: []
94
95
  rubyforge_project:
95
96
  rubygems_version: 1.8.25