flip_fork 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,3 +6,5 @@ pkg/*
6
6
  .ruby-gemset
7
7
 
8
8
  .ruby-verion
9
+
10
+ lib/.DS_Store
@@ -1,21 +1,25 @@
1
1
  module Flip
2
2
  module ControllerFilters
3
-
4
- extend ActiveSupport::Concern
5
-
3
+ # extend ActiveSupport::Concern # rails ~> 3
4
+
5
+ def self.included(base)
6
+ base.extend ClassMethods
7
+ base.class_eval do
8
+
9
+ end
10
+ end
11
+
6
12
  module ClassMethods
7
-
8
- def require_feature key, options = {}
13
+ def require_feature(key, options = {})
9
14
  before_filter options do
10
15
  flip_feature_disabled key unless Flip.on? key
11
16
  end
12
17
  end
13
-
14
18
  end
15
-
19
+
20
+
16
21
  def flip_feature_disabled key
17
22
  raise Flip::Forbidden.new(key)
18
23
  end
19
-
20
24
  end
21
25
  end
@@ -45,18 +45,27 @@ module Flip
45
45
  # Users before_filter and after_filter rather than around_filter to
46
46
  # avoid pointlessly adding to stack depth.
47
47
  module Loader
48
- extend ActiveSupport::Concern
49
- included do
50
- before_filter :flip_cookie_strategy_before
51
- after_filter :flip_cookie_strategy_after
48
+ # extend ActiveSupport::Concern # rails ~> 3
49
+
50
+ def self.included(base)
51
+ base.extend ClassMethods
52
+ base.before_filter :flip_cookie_strategy_before
53
+ base.after_filter :flip_cookie_strategy_after
54
+ base.class_eval do
55
+
56
+ end
52
57
  end
58
+
53
59
  def flip_cookie_strategy_before
54
60
  CookieStrategy.cookies = cookies
55
61
  end
56
62
  def flip_cookie_strategy_after
57
63
  CookieStrategy.cookies = nil
58
64
  end
59
- end
65
+
66
+ module ClassMethods
60
67
 
68
+ end
69
+ end
61
70
  end
62
71
  end
@@ -6,8 +6,7 @@ module Flip
6
6
 
7
7
  def initialize(key, options = {})
8
8
  @key = key
9
- @options = options.reverse_merge \
10
- description: key.to_s.humanize + "."
9
+ @options = {description: "#{key.to_s.humanize}."}.merge(options)
11
10
  end
12
11
 
13
12
  alias :name :key
data/lib/flip/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Flip
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/flip.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # ActiveSupport dependencies.
2
+ # concern
2
3
  %w{
3
- concern
4
4
  inflector
5
5
  core_ext/hash/reverse_merge
6
6
  core_ext/object/blank
@@ -1,4 +1,14 @@
1
- class Flip::InstallGenerator < Rails::Generators::Base
1
+ # class Flip::InstallGenerator < Rails::Generators::Base
2
+ #
3
+ # def invoke_generators
4
+ # %w{ model migration routes }.each do |name|
5
+ # generate "flip:#{name}"
6
+ # end
7
+ # end
8
+ #
9
+ # end
10
+
11
+ class Flip::InstallGenerator < Rails::Generator::NamedBase
2
12
 
3
13
  def invoke_generators
4
14
  %w{ model migration routes }.each do |name|
@@ -1,5 +1,5 @@
1
1
  class CreateFeatures < ActiveRecord::Migration
2
- def change
2
+ def self.up
3
3
  create_table :features do |t|
4
4
  t.string :key, null: false
5
5
  t.boolean :enabled, null: false, default: false
@@ -7,4 +7,8 @@ class CreateFeatures < ActiveRecord::Migration
7
7
  t.timestamps null: false
8
8
  end
9
9
  end
10
+
11
+ def self.down
12
+ drop_table :features
13
+ end
10
14
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flip_fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Paul Annesley
@@ -14,6 +15,7 @@ dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: activesupport
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - ~>
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ~>
26
29
  - !ruby/object:Gem::Version
@@ -28,6 +31,7 @@ dependencies:
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: i18n
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - ! '>='
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - ! '>='
40
45
  - !ruby/object:Gem::Version
@@ -42,6 +47,7 @@ dependencies:
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: rspec
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
52
  - - ~>
47
53
  - !ruby/object:Gem::Version
@@ -49,6 +55,7 @@ dependencies:
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
60
  - - ~>
54
61
  - !ruby/object:Gem::Version
@@ -56,6 +63,7 @@ dependencies:
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: rake
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
68
  - - ! '>='
61
69
  - !ruby/object:Gem::Version
@@ -63,6 +71,7 @@ dependencies:
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
76
  - - ! '>='
68
77
  - !ruby/object:Gem::Version
@@ -122,26 +131,27 @@ files:
122
131
  - spec/spec_helper.rb
123
132
  homepage: https://github.com/newdark/flip
124
133
  licenses: []
125
- metadata: {}
126
134
  post_install_message:
127
135
  rdoc_options: []
128
136
  require_paths:
129
137
  - lib
130
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
131
140
  requirements:
132
141
  - - ! '>='
133
142
  - !ruby/object:Gem::Version
134
143
  version: '0'
135
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
136
146
  requirements:
137
147
  - - ! '>='
138
148
  - !ruby/object:Gem::Version
139
149
  version: '0'
140
150
  requirements: []
141
151
  rubyforge_project:
142
- rubygems_version: 2.0.7
152
+ rubygems_version: 1.8.24
143
153
  signing_key:
144
- specification_version: 4
154
+ specification_version: 3
145
155
  summary: A feature flipper for Rails web applications.
146
156
  test_files:
147
157
  - spec/abstract_strategy_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: b5aa2bf1aed6166a01f1d1ba9ea1e39c2e696281
4
- data.tar.gz: 99aa42db56689357f02713c8f00bd08a05ee5f8a
5
- SHA512:
6
- metadata.gz: 9bf03f1c45dd514af01b2079176128c09837f8aaf75b9a0c27f55ad5538181ea4efed3522ec1fe23b28a341ee25edbe3e38fd4269dddde4589b0d81e7540d4f6
7
- data.tar.gz: e98be32ba894637bdf81f6ecf68d6ffe2ca78c3ec1d13541c0028c2d57dc2164c1acd1ee6079af06f8dfde6ca8c90dddcc910ee0c1863d42ef7760fd736d46d5