simple_switch 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -1
  3. data/README.md +175 -58
  4. data/Rakefile +21 -1
  5. data/app/assets/javascripts/simple_switch/application.js +1 -0
  6. data/app/assets/stylesheets/simple_switch/application.css +4 -0
  7. data/app/controllers/simple_switch/application_controller.rb +4 -0
  8. data/app/helpers/simple_switch/application_helper.rb +4 -0
  9. data/app/models/simple_switch/environment.rb +8 -0
  10. data/app/models/simple_switch/feature.rb +8 -0
  11. data/app/models/simple_switch/state.rb +15 -0
  12. data/app/views/layouts/simple_switch/application.html.erb +14 -0
  13. data/config/routes.rb +2 -0
  14. data/db/migrate/20151216180633_create_simple_switch_tables.simple_switch.rb +24 -0
  15. data/lib/generators/simple_switch/initialize_generator.rb +17 -0
  16. data/lib/generators/simple_switch/install_generator.rb +13 -3
  17. data/lib/generators/templates/feature_config_sample.yml +16 -12
  18. data/lib/generators/templates/migration.rb +24 -0
  19. data/lib/generators/templates/simple_switch.rb +9 -2
  20. data/lib/simple_switch.rb +10 -6
  21. data/lib/simple_switch/engine.rb +10 -0
  22. data/lib/simple_switch/feature_manager.rb +15 -0
  23. data/lib/simple_switch/feature_manager_db.rb +88 -0
  24. data/lib/simple_switch/feature_manager_yaml.rb +68 -0
  25. data/lib/simple_switch/manager_shared_methods.rb +52 -0
  26. data/lib/simple_switch/railtie.rb +12 -0
  27. data/lib/simple_switch/shared_controller_methods.rb +2 -2
  28. data/lib/simple_switch/version.rb +1 -1
  29. data/lib/tasks/simple_switch.rake +106 -0
  30. data/spec/config/feature_config.yml +10 -6
  31. data/spec/dummy/README.rdoc +28 -0
  32. data/spec/dummy/Rakefile +6 -0
  33. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  34. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  35. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  36. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  37. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  38. data/spec/dummy/bin/bundle +3 -0
  39. data/spec/dummy/bin/rails +4 -0
  40. data/spec/dummy/bin/rake +4 -0
  41. data/spec/dummy/bin/setup +29 -0
  42. data/spec/dummy/config.ru +4 -0
  43. data/spec/dummy/config/application.rb +26 -0
  44. data/spec/dummy/config/boot.rb +5 -0
  45. data/spec/dummy/config/database.yml +25 -0
  46. data/spec/dummy/config/environment.rb +5 -0
  47. data/spec/dummy/config/environments/development.rb +41 -0
  48. data/spec/dummy/config/environments/production.rb +79 -0
  49. data/spec/dummy/config/environments/test.rb +42 -0
  50. data/spec/dummy/config/initializers/assets.rb +11 -0
  51. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  52. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  53. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  54. data/spec/dummy/config/initializers/inflections.rb +16 -0
  55. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  56. data/spec/dummy/config/initializers/session_store.rb +3 -0
  57. data/spec/dummy/config/initializers/simple_switch.rb +17 -0
  58. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  59. data/spec/dummy/config/locales/en.yml +23 -0
  60. data/spec/dummy/config/routes.rb +4 -0
  61. data/spec/dummy/config/secrets.yml +22 -0
  62. data/spec/dummy/db/development.sqlite3 +0 -0
  63. data/spec/dummy/db/schema.rb +44 -0
  64. data/spec/dummy/db/seeds.rb +17 -0
  65. data/spec/dummy/db/test.sqlite3 +0 -0
  66. data/spec/dummy/log/development.log +54 -0
  67. data/spec/dummy/log/test.log +7280 -0
  68. data/spec/dummy/public/favicon.ico +0 -0
  69. data/spec/factories/simple_switch_environments.rb +5 -0
  70. data/spec/factories/simple_switch_features.rb +5 -0
  71. data/spec/factories/simple_switch_states.rb +5 -0
  72. data/spec/models/simple_switch/environment_spec.rb +11 -0
  73. data/spec/models/simple_switch/feature_spec.rb +11 -0
  74. data/spec/models/simple_switch/state_spec.rb +11 -0
  75. data/spec/route_helper.rb +5 -0
  76. data/spec/simple_switch_feature_managers_spec.rb +282 -0
  77. data/spec/spec_helper.rb +22 -27
  78. metadata +203 -17
  79. data/.gitignore +0 -3
  80. data/.rspec +0 -2
  81. data/.travis.yml +0 -7
  82. data/Gemfile +0 -4
  83. data/LICENSE.txt +0 -22
  84. data/codeclimate.yml +0 -3
  85. data/lib/generators/simple_switch/install_yaml_generator.rb +0 -18
  86. data/lib/simple_switch/switch.rb +0 -77
  87. data/simple_switch.gemspec +0 -26
  88. data/spec/simple_switch_spec.rb +0 -91
File without changes
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :simple_switch_environment, class: 'SimpleSwitch::Environment' do
3
+ name 'development'
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :simple_switch_feature, class: 'SimpleSwitch::Feature' do
3
+ name 'Foo'
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :simple_switch_states, class: 'SimpleSwitch::State' do
3
+ status true
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe SimpleSwitch::Environment do
4
+ it { is_expected.to validate_presence_of :name }
5
+
6
+ it { is_expected.to validate_uniqueness_of :name }
7
+
8
+ it { is_expected.to have_many :states }
9
+
10
+ it { is_expected.to have_many :features }
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe SimpleSwitch::Feature do
4
+ it { is_expected.to validate_presence_of :name }
5
+
6
+ it { is_expected.to validate_uniqueness_of :name }
7
+
8
+ it { is_expected.to have_many :states }
9
+
10
+ it { is_expected.to have_many :environments }
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe SimpleSwitch::State do
4
+ it { is_expected.to validate_presence_of :feature_id }
5
+
6
+ it { is_expected.to validate_presence_of :environment_id }
7
+
8
+ it { is_expected.to belong_to :feature }
9
+
10
+ it { is_expected.to belong_to :environment }
11
+ end
@@ -0,0 +1,5 @@
1
+ module RouteHelper
2
+ def self.included(base)
3
+ base.routes { SimpleSwitch::Engine.routes }
4
+ end
5
+ end
@@ -0,0 +1,282 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'SimpleSwitchFeatureManagers' do
4
+ describe 'FeatureManagerDb' do
5
+ before(:each) { test_reset_db }
6
+
7
+ it 'feature_config returns the correct configuration' do
8
+ expected_config = HashWithIndifferentAccess.new({
9
+ foo: {
10
+ description: 'Foo Feature',
11
+ states: {
12
+ development: [true, 1],
13
+ test: [true, 2],
14
+ production: [false, 3]
15
+ }
16
+ },
17
+ bar: {
18
+ description: 'Bar Feature',
19
+ states: {
20
+ development: [true, 4],
21
+ test: [false, 5],
22
+ production: [true, 6]
23
+ }
24
+ }
25
+ })
26
+
27
+ assert_feature_config_works_fine(expected_config)
28
+ end
29
+
30
+ it 'on? works fine' do
31
+ assert_on_works_fine
32
+ end
33
+
34
+ it 'off? works fine' do
35
+ assert_off_works_fine
36
+ end
37
+
38
+ it 'turn_on works fine' do
39
+ err_msg_1 = "Cannot find feature 'foobar', check out your database."
40
+ err_msg_2 = "Cannot find environment 'qa' for feature 'foo', check out your database."
41
+ assert_turn_on_works_fine(err_msg_1, err_msg_2)
42
+ end
43
+
44
+ it 'turn_off works fine' do
45
+ err_msg_1 = "Cannot find feature 'foobar', check out your database."
46
+ err_msg_2 = "Cannot find environment 'qa' for feature 'foo', check out your database."
47
+ assert_turn_off_works_fine(err_msg_1, err_msg_2)
48
+ end
49
+
50
+ it 'update works fine' do
51
+ assert_update_works_fine
52
+ end
53
+
54
+ it 'delete works fine' do
55
+ assert_delete_works_fine
56
+ end
57
+
58
+ it 'raise errors correctly' do
59
+ error_msg_1 = "Cannot find feature 'foobar', check out your database."
60
+ error_msg_2 = "Cannot find environment 'dev' for feature 'foo', check out your database."
61
+
62
+ assert_raise_errors_correctly(error_msg_1, error_msg_2)
63
+ end
64
+ end
65
+
66
+ describe 'FeatureManagerYaml' do
67
+ before(:each) { test_reset_yaml }
68
+
69
+ it 'feature_config returns the correct configuration' do
70
+ expected_config = HashWithIndifferentAccess.new({
71
+ foo: {
72
+ description: 'Foo Feature',
73
+ states: {
74
+ development: true,
75
+ test: true,
76
+ production: false
77
+ }
78
+ },
79
+ bar: {
80
+ description: 'Bar Feature',
81
+ states: {
82
+ development: true,
83
+ test: false,
84
+ production: true
85
+ }
86
+ }
87
+ })
88
+
89
+ assert_feature_config_works_fine(expected_config)
90
+ end
91
+
92
+ it 'on? works fine' do
93
+ assert_on_works_fine
94
+ end
95
+
96
+ it 'off? works fine' do
97
+ assert_off_works_fine
98
+ end
99
+
100
+ it 'turn_on works fine' do
101
+ err_msg_1 = "Cannot find feature 'foobar', check out your feature_config.yml file."
102
+ err_msg_2 = "Cannot find environment 'qa' for feature 'foo', check out your feature_config.yml file."
103
+ assert_turn_on_works_fine(err_msg_1, err_msg_2)
104
+ end
105
+
106
+ it 'turn_off works fine' do
107
+ err_msg_1 = "Cannot find feature 'foobar', check out your feature_config.yml file."
108
+ err_msg_2 = "Cannot find environment 'qa' for feature 'foo', check out your feature_config.yml file."
109
+ assert_turn_off_works_fine(err_msg_1, err_msg_2)
110
+ end
111
+
112
+ it 'update works fine' do
113
+ assert_update_works_fine
114
+ end
115
+
116
+ it 'delete works fine' do
117
+ assert_delete_works_fine
118
+ end
119
+
120
+ it 'raise errors correctly' do
121
+ error_msg_1 = "Cannot find feature 'foobar', check out your feature_config.yml file."
122
+ error_msg_2 = "Cannot find environment 'dev' for feature 'foo', check out your feature_config.yml file."
123
+
124
+ assert_raise_errors_correctly(error_msg_1, error_msg_2)
125
+ end
126
+ end
127
+
128
+ private
129
+
130
+ def test_reset_db
131
+ allow(SimpleSwitch).to receive(:feature_store).and_return(:database)
132
+ SimpleSwitch.feature_manager.send(:reload_config!)
133
+ end
134
+
135
+ def test_reset_yaml
136
+ # reset feature_config.yml
137
+ File.open('spec/config/feature_config.yml', 'w') do |f|
138
+ init_hash = HashWithIndifferentAccess.new(
139
+ {
140
+ foo: {
141
+ description: 'Foo Feature',
142
+ states: {
143
+ development: true,
144
+ test: true,
145
+ production: false
146
+ }
147
+ },
148
+ bar: {
149
+ description: 'Bar Feature',
150
+ states: {
151
+ development: true,
152
+ test: false,
153
+ production: true
154
+ }
155
+ }
156
+ }
157
+ )
158
+
159
+ f.puts init_hash.to_hash.to_yaml
160
+ end
161
+
162
+ allow_any_instance_of(SimpleSwitch::FeatureManagerYaml).to receive(:file_path).and_return('spec/config/feature_config.yml')
163
+ allow(SimpleSwitch).to receive(:feature_store).and_return(:yml)
164
+ SimpleSwitch.feature_manager.send(:reload_config!)
165
+ end
166
+
167
+ def assert_feature_config_works_fine(expected_config)
168
+ expect(SimpleSwitch.feature_manager.feature_config).to eq(expected_config)
169
+ end
170
+
171
+ def assert_on_works_fine
172
+ allow(Rails).to receive(:env).and_return('development')
173
+
174
+ expect(SimpleSwitch.feature_manager.on?(:foo)).to be_truthy
175
+ expect(SimpleSwitch.feature_manager.on?(:bar)).to be_truthy
176
+
177
+ allow(Rails).to receive(:env).and_return('test')
178
+
179
+ expect(SimpleSwitch.feature_manager.on?(:foo)).to be_truthy
180
+ expect(SimpleSwitch.feature_manager.on?(:bar)).to be_falsey
181
+
182
+ allow(Rails).to receive(:env).and_return('production')
183
+
184
+ expect(SimpleSwitch.feature_manager.on?(:foo)).to be_falsey
185
+ expect(SimpleSwitch.feature_manager.on?(:bar)).to be_truthy
186
+
187
+ expect(SimpleSwitch.feature_manager.on?(:foo, :development)).to be_truthy
188
+ expect(SimpleSwitch.feature_manager.on?(:bar, :development)).to be_truthy
189
+
190
+ expect(SimpleSwitch.feature_manager.on?(:foo, :test)).to be_truthy
191
+ expect(SimpleSwitch.feature_manager.on?(:bar, :test)).to be_falsey
192
+
193
+ expect(SimpleSwitch.feature_manager.on?(:foo, :production)).to be_falsey
194
+ expect(SimpleSwitch.feature_manager.on?(:bar, :production)).to be_truthy
195
+ end
196
+
197
+ def assert_off_works_fine
198
+ allow(Rails).to receive(:env).and_return('development')
199
+
200
+ expect(SimpleSwitch.feature_manager.off?(:foo)).to be_falsey
201
+ expect(SimpleSwitch.feature_manager.off?(:bar)).to be_falsey
202
+
203
+ allow(Rails).to receive(:env).and_return('test')
204
+
205
+ expect(SimpleSwitch.feature_manager.off?(:foo)).to be_falsey
206
+ expect(SimpleSwitch.feature_manager.off?(:bar)).to be_truthy
207
+
208
+ allow(Rails).to receive(:env).and_return('production')
209
+
210
+ expect(SimpleSwitch.feature_manager.off?(:foo)).to be_truthy
211
+ expect(SimpleSwitch.feature_manager.off?(:bar)).to be_falsey
212
+
213
+ expect(SimpleSwitch.feature_manager.off?(:foo, :development)).to be_falsey
214
+ expect(SimpleSwitch.feature_manager.off?(:bar, :development)).to be_falsey
215
+
216
+ expect(SimpleSwitch.feature_manager.off?(:foo, :test)).to be_falsey
217
+ expect(SimpleSwitch.feature_manager.off?(:bar, :test)).to be_truthy
218
+
219
+ expect(SimpleSwitch.feature_manager.off?(:foo, :production)).to be_truthy
220
+ expect(SimpleSwitch.feature_manager.off?(:bar, :production)).to be_falsey
221
+ end
222
+
223
+ def assert_turn_on_works_fine(err_msg_1, err_msg_2)
224
+ allow(Rails).to receive(:env).and_return('production')
225
+
226
+ expect(SimpleSwitch.feature_manager.on?(:foo)).to be_falsey
227
+
228
+ SimpleSwitch.feature_manager.turn_on(:foo, :production)
229
+
230
+ expect(SimpleSwitch.feature_manager.on?(:foo)).to be_truthy
231
+
232
+ expect { SimpleSwitch.feature_manager.turn_on(:foobar, :production) }.to raise_error(err_msg_1)
233
+ expect { SimpleSwitch.feature_manager.turn_on(:foo, :qa) }.to raise_error(err_msg_2)
234
+ end
235
+
236
+ def assert_turn_off_works_fine(err_msg_1, err_msg_2)
237
+ allow(Rails).to receive(:env).and_return('development')
238
+
239
+ expect(SimpleSwitch.feature_manager.on?(:foo)).to be_truthy
240
+
241
+ SimpleSwitch.feature_manager.turn_off(:foo, :development)
242
+
243
+ expect(SimpleSwitch.feature_manager.on?(:foo)).to be_falsey
244
+
245
+ expect { SimpleSwitch.feature_manager.turn_off(:foobar, :production) }.to raise_error(err_msg_1)
246
+ expect { SimpleSwitch.feature_manager.turn_off(:foo, :qa) }.to raise_error(err_msg_2)
247
+ end
248
+
249
+ def assert_update_works_fine
250
+ expect(SimpleSwitch.feature_manager.on?(:foo, :development)).to be_truthy
251
+
252
+ SimpleSwitch.feature_manager.update(:foo, :development, false)
253
+
254
+ expect(SimpleSwitch.feature_manager.off?(:foo, :development)).to be_truthy
255
+
256
+ expect(SimpleSwitch.feature_manager.off?(:bar, :test)).to be_truthy
257
+
258
+ SimpleSwitch.feature_manager.update(:bar, :test, true)
259
+
260
+ expect(SimpleSwitch.feature_manager.on?(:bar, :test)).to be_truthy
261
+ end
262
+
263
+ def assert_delete_works_fine
264
+ expect(SimpleSwitch.feature_manager.on?(:foo, :development)).to be_truthy
265
+ expect(SimpleSwitch.feature_manager.on?(:foo, :production)).to be_falsey
266
+
267
+ expect { SimpleSwitch.feature_manager.delete(:foo) }.to_not raise_error
268
+
269
+ expect(SimpleSwitch.feature_manager.on?(:foo, :development)).to be_truthy
270
+ expect(SimpleSwitch.feature_manager.on?(:foo, :production)).to be_truthy
271
+ end
272
+
273
+ def assert_raise_errors_correctly(err_msg_1, err_msg_2)
274
+ expect {
275
+ SimpleSwitch.feature_manager.update(:foobar, :development, false)
276
+ }.to raise_error(RuntimeError, err_msg_1)
277
+
278
+ expect {
279
+ SimpleSwitch.feature_manager.update(:foo, :dev, false)
280
+ }.to raise_error(RuntimeError, err_msg_2)
281
+ end
282
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,35 +1,30 @@
1
- require 'bundler/setup'
2
- require 'rails'
3
- require 'simple_switch'
1
+ ENV['RAILS_ENV'] ||= 'test'
4
2
 
5
- Bundler.setup
3
+ require File.expand_path('../../spec/dummy/config/environment', __FILE__)
4
+ require 'route_helper'
5
+ require 'rspec/rails'
6
+ require 'shoulda-matchers'
7
+ require 'database_cleaner'
8
+ require 'factory_girl_rails'
9
+
10
+ ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
6
11
 
7
12
  RSpec.configure do |config|
8
- config.expect_with(:rspec) { |c| c.syntax = :expect }
9
- config.order = :random
13
+ config.use_transactional_fixtures = false
14
+ config.order = :random
10
15
 
11
- config.before :each do
12
- # reset feature_config.yml
13
- File.open('spec/config/feature_config.yml', 'w') do |f|
14
- init_hash = HashWithIndifferentAccess.new(
15
- {
16
- foo: {
17
- development: true,
18
- test: true,
19
- production: false
20
- },
21
- bar: {
22
- development: true,
23
- test: false,
24
- production: true
25
- }
26
- }
27
- )
16
+ config.include RouteHelper, type: :routing
17
+ config.include RouteHelper, type: :controller
28
18
 
29
- f.puts init_hash.to_hash.to_yaml
30
- end
19
+ config.before(:suite) do
20
+ DatabaseCleaner.clean_with(:truncation)
21
+ DatabaseCleaner.strategy = :transaction
22
+ Rails.application.load_seed
23
+ end
31
24
 
32
- allow_any_instance_of(SimpleSwitch::Switch).to receive(:file_path).and_return('spec/config/feature_config.yml')
33
- SimpleSwitch.feature_manager.send(:reload_config!)
25
+ config.around(:each) do |example|
26
+ DatabaseCleaner.cleaning do
27
+ example.run
28
+ end
34
29
  end
35
30
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_switch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sen Zhang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sqlite3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -43,6 +57,9 @@ dependencies:
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '4.2'
62
+ - - '>='
46
63
  - !ruby/object:Gem::Version
47
64
  version: 4.2.0
48
65
  type: :development
@@ -50,52 +67,176 @@ dependencies:
50
67
  version_requirements: !ruby/object:Gem::Requirement
51
68
  requirements:
52
69
  - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: '4.2'
72
+ - - '>='
53
73
  - !ruby/object:Gem::Version
54
74
  version: 4.2.0
55
75
  - !ruby/object:Gem::Dependency
56
- name: rspec
76
+ name: rspec-rails
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '3.2'
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: 3.2.0
85
+ type: :development
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ version: '3.2'
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: 3.2.0
95
+ - !ruby/object:Gem::Dependency
96
+ name: shoulda-matchers
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '2.7'
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: 2.7.0
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: '2.7'
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: 2.7.0
115
+ - !ruby/object:Gem::Dependency
116
+ name: database_cleaner
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ~>
120
+ - !ruby/object:Gem::Version
121
+ version: '1.3'
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.3.0
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '1.3'
132
+ - - '>='
133
+ - !ruby/object:Gem::Version
134
+ version: 1.3.0
135
+ - !ruby/object:Gem::Dependency
136
+ name: factory_girl_rails
57
137
  requirement: !ruby/object:Gem::Requirement
58
138
  requirements:
59
139
  - - ~>
60
140
  - !ruby/object:Gem::Version
61
- version: 3.3.0
141
+ version: '4.5'
142
+ - - '>='
143
+ - !ruby/object:Gem::Version
144
+ version: 4.5.0
62
145
  type: :development
63
146
  prerelease: false
64
147
  version_requirements: !ruby/object:Gem::Requirement
65
148
  requirements:
66
149
  - - ~>
67
150
  - !ruby/object:Gem::Version
68
- version: 3.3.0
69
- description: Simple Feature Switch Engine
151
+ version: '4.5'
152
+ - - '>='
153
+ - !ruby/object:Gem::Version
154
+ version: 4.5.0
155
+ description: Simple Feature Switch Engine for Rails App
70
156
  email:
71
157
  - solowolf21@gmail.com
72
158
  executables: []
73
159
  extensions: []
74
160
  extra_rdoc_files: []
75
161
  files:
76
- - .gitignore
77
- - .rspec
78
- - .travis.yml
79
162
  - CHANGELOG.md
80
- - Gemfile
81
- - LICENSE.txt
82
163
  - README.md
83
164
  - Rakefile
84
- - codeclimate.yml
165
+ - app/assets/javascripts/simple_switch/application.js
166
+ - app/assets/stylesheets/simple_switch/application.css
167
+ - app/controllers/simple_switch/application_controller.rb
168
+ - app/helpers/simple_switch/application_helper.rb
169
+ - app/models/simple_switch/environment.rb
170
+ - app/models/simple_switch/feature.rb
171
+ - app/models/simple_switch/state.rb
172
+ - app/views/layouts/simple_switch/application.html.erb
173
+ - config/routes.rb
174
+ - db/migrate/20151216180633_create_simple_switch_tables.simple_switch.rb
175
+ - lib/generators/simple_switch/initialize_generator.rb
85
176
  - lib/generators/simple_switch/install_generator.rb
86
- - lib/generators/simple_switch/install_yaml_generator.rb
87
177
  - lib/generators/templates/feature_config_sample.yml
178
+ - lib/generators/templates/migration.rb
88
179
  - lib/generators/templates/simple_switch.rb
89
180
  - lib/simple_switch.rb
90
181
  - lib/simple_switch/action_controller/base.rb
91
182
  - lib/simple_switch/active_record/base.rb
183
+ - lib/simple_switch/engine.rb
184
+ - lib/simple_switch/feature_manager.rb
185
+ - lib/simple_switch/feature_manager_db.rb
186
+ - lib/simple_switch/feature_manager_yaml.rb
187
+ - lib/simple_switch/manager_shared_methods.rb
188
+ - lib/simple_switch/railtie.rb
92
189
  - lib/simple_switch/shared_controller_methods.rb
93
190
  - lib/simple_switch/shared_methods.rb
94
- - lib/simple_switch/switch.rb
95
191
  - lib/simple_switch/version.rb
96
- - simple_switch.gemspec
192
+ - lib/tasks/simple_switch.rake
97
193
  - spec/config/feature_config.yml
98
- - spec/simple_switch_spec.rb
194
+ - spec/dummy/README.rdoc
195
+ - spec/dummy/Rakefile
196
+ - spec/dummy/app/assets/javascripts/application.js
197
+ - spec/dummy/app/assets/stylesheets/application.css
198
+ - spec/dummy/app/controllers/application_controller.rb
199
+ - spec/dummy/app/helpers/application_helper.rb
200
+ - spec/dummy/app/views/layouts/application.html.erb
201
+ - spec/dummy/bin/bundle
202
+ - spec/dummy/bin/rails
203
+ - spec/dummy/bin/rake
204
+ - spec/dummy/bin/setup
205
+ - spec/dummy/config.ru
206
+ - spec/dummy/config/application.rb
207
+ - spec/dummy/config/boot.rb
208
+ - spec/dummy/config/database.yml
209
+ - spec/dummy/config/environment.rb
210
+ - spec/dummy/config/environments/development.rb
211
+ - spec/dummy/config/environments/production.rb
212
+ - spec/dummy/config/environments/test.rb
213
+ - spec/dummy/config/initializers/assets.rb
214
+ - spec/dummy/config/initializers/backtrace_silencers.rb
215
+ - spec/dummy/config/initializers/cookies_serializer.rb
216
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
217
+ - spec/dummy/config/initializers/inflections.rb
218
+ - spec/dummy/config/initializers/mime_types.rb
219
+ - spec/dummy/config/initializers/session_store.rb
220
+ - spec/dummy/config/initializers/simple_switch.rb
221
+ - spec/dummy/config/initializers/wrap_parameters.rb
222
+ - spec/dummy/config/locales/en.yml
223
+ - spec/dummy/config/routes.rb
224
+ - spec/dummy/config/secrets.yml
225
+ - spec/dummy/db/development.sqlite3
226
+ - spec/dummy/db/schema.rb
227
+ - spec/dummy/db/seeds.rb
228
+ - spec/dummy/db/test.sqlite3
229
+ - spec/dummy/log/development.log
230
+ - spec/dummy/log/test.log
231
+ - spec/dummy/public/favicon.ico
232
+ - spec/factories/simple_switch_environments.rb
233
+ - spec/factories/simple_switch_features.rb
234
+ - spec/factories/simple_switch_states.rb
235
+ - spec/models/simple_switch/environment_spec.rb
236
+ - spec/models/simple_switch/feature_spec.rb
237
+ - spec/models/simple_switch/state_spec.rb
238
+ - spec/route_helper.rb
239
+ - spec/simple_switch_feature_managers_spec.rb
99
240
  - spec/spec_helper.rb
100
241
  homepage: https://github.com/Sen-Zhang/simple_switch
101
242
  licenses:
@@ -123,6 +264,51 @@ specification_version: 4
123
264
  summary: Simple Feature Switch Engine
124
265
  test_files:
125
266
  - spec/config/feature_config.yml
126
- - spec/simple_switch_spec.rb
267
+ - spec/dummy/app/assets/javascripts/application.js
268
+ - spec/dummy/app/assets/stylesheets/application.css
269
+ - spec/dummy/app/controllers/application_controller.rb
270
+ - spec/dummy/app/helpers/application_helper.rb
271
+ - spec/dummy/app/views/layouts/application.html.erb
272
+ - spec/dummy/bin/bundle
273
+ - spec/dummy/bin/rails
274
+ - spec/dummy/bin/rake
275
+ - spec/dummy/bin/setup
276
+ - spec/dummy/config/application.rb
277
+ - spec/dummy/config/boot.rb
278
+ - spec/dummy/config/database.yml
279
+ - spec/dummy/config/environment.rb
280
+ - spec/dummy/config/environments/development.rb
281
+ - spec/dummy/config/environments/production.rb
282
+ - spec/dummy/config/environments/test.rb
283
+ - spec/dummy/config/initializers/assets.rb
284
+ - spec/dummy/config/initializers/backtrace_silencers.rb
285
+ - spec/dummy/config/initializers/cookies_serializer.rb
286
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
287
+ - spec/dummy/config/initializers/inflections.rb
288
+ - spec/dummy/config/initializers/mime_types.rb
289
+ - spec/dummy/config/initializers/session_store.rb
290
+ - spec/dummy/config/initializers/simple_switch.rb
291
+ - spec/dummy/config/initializers/wrap_parameters.rb
292
+ - spec/dummy/config/locales/en.yml
293
+ - spec/dummy/config/routes.rb
294
+ - spec/dummy/config/secrets.yml
295
+ - spec/dummy/config.ru
296
+ - spec/dummy/db/development.sqlite3
297
+ - spec/dummy/db/schema.rb
298
+ - spec/dummy/db/seeds.rb
299
+ - spec/dummy/db/test.sqlite3
300
+ - spec/dummy/log/development.log
301
+ - spec/dummy/log/test.log
302
+ - spec/dummy/public/favicon.ico
303
+ - spec/dummy/Rakefile
304
+ - spec/dummy/README.rdoc
305
+ - spec/factories/simple_switch_environments.rb
306
+ - spec/factories/simple_switch_features.rb
307
+ - spec/factories/simple_switch_states.rb
308
+ - spec/models/simple_switch/environment_spec.rb
309
+ - spec/models/simple_switch/feature_spec.rb
310
+ - spec/models/simple_switch/state_spec.rb
311
+ - spec/route_helper.rb
312
+ - spec/simple_switch_feature_managers_spec.rb
127
313
  - spec/spec_helper.rb
128
314
  has_rdoc: