chili 2.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -52,7 +52,7 @@ The context of the active_if block is the application controller so you can use
52
52
  ```ruby
53
53
  # {feature}/lib/social_feature.rb
54
54
  module SocialFeature
55
- extend Chili::Activatable
55
+ extend Chili::Base
56
56
  active_if { logged_in? && current_user.admin? } # Feature is only visible to logged in admin users
57
57
  end
58
58
  ```
@@ -83,11 +83,9 @@ but will only be accessible when active_if is true.
83
83
 
84
84
  ### Migrations
85
85
 
86
- Migrations are handled the same way as engines. Use the
87
- following commands after you've added a new migration to a feature:
86
+ To copy and run feature db migrations use the following command:
88
87
 
89
- $ rake social_feature:migrations:install
90
- $ rake db:migrate
88
+ $ rake social_feature:db:migrate
91
89
 
92
90
  ### Modifying existing models
93
91
 
@@ -18,9 +18,10 @@ Gem::Specification.new do |gem|
18
18
  gem.add_dependency "rails", "~> 3.2"
19
19
  gem.add_dependency "deface", "~> 1.0.0.rc1"
20
20
 
21
- gem.add_development_dependency 'rspec', '~> 2.9.0'
22
- gem.add_development_dependency 'rspec-rails', '~> 2.9.0'
21
+ gem.add_development_dependency 'rspec', '~> 2.12.0'
22
+ gem.add_development_dependency 'rspec-rails', '~> 2.12.0'
23
23
  gem.add_development_dependency 'jquery-rails'
24
- gem.add_development_dependency 'capybara'
24
+ gem.add_development_dependency 'capybara', '~> 2.0'
25
+ gem.add_development_dependency 'xpath'
25
26
  gem.add_development_dependency 'sqlite3'
26
27
  end
@@ -1,8 +1,7 @@
1
1
  require "deface"
2
- require "chili/activatable"
2
+ require "chili/base"
3
3
  require "chili/bundler"
4
4
  require "chili/engine"
5
- require "chili/extensions/rails/engine"
6
5
  require "chili/feature"
7
6
  require "chili/overrides"
8
7
  require "chili/version"
@@ -0,0 +1,11 @@
1
+ require "chili/activatable"
2
+ require "chili/engine_extensions"
3
+
4
+ module Chili
5
+ module Base
6
+ def self.extended(base)
7
+ base.extend(Activatable)
8
+ base::Engine.extend(EngineExtensions)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ module Chili
2
+ module EngineExtensions
3
+ def self.extended(base)
4
+ base.rake_tasks do
5
+ next if self.is_a?(Rails::Application)
6
+ next unless has_migrations?
7
+
8
+ namespace railtie_name do
9
+ namespace :db do
10
+ desc "Copy and migrate migrations from #{railtie_name}"
11
+ task :migrate do
12
+ Rake::Task["#{railtie_name}:install:migrations"].invoke
13
+ Rake::Task["db:migrate"].invoke
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ def automount!(path = nil)
21
+ engine = self
22
+ path ||= 'chili/' + engine.parent.to_s.underscore
23
+ Rails.application.routes.draw do
24
+ mount engine => path
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Chili
2
- VERSION = "2.0.1"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -40,6 +40,7 @@ module Chili
40
40
  remove_dir 'script'
41
41
  remove_file 'Gemfile'
42
42
  remove_file 'Rakefile'
43
+ remove_file 'MIT-LICENSE'
43
44
  end
44
45
 
45
46
  def remove_jquery_stuff
@@ -63,9 +64,9 @@ module Chili
63
64
  prepend_to_file "lib/#{feature.name}.rb", "require \"chili\"\n"
64
65
  end
65
66
 
66
- def include_active_if
67
+ def include_base_and_active_if
67
68
  inject_into_file "lib/#{feature.name}.rb", after: "module #{feature.name.camelcase}\n" do <<-RUBY
68
- extend Chili::Activatable
69
+ extend Chili::Base
69
70
  active_if { true } # edit this to activate/deactivate feature at runtime
70
71
  RUBY
71
72
  end
@@ -0,0 +1,17 @@
1
+ { spec: 'RSpec::Core::RakeTask', test: 'Rake::TestTask' }.each do |test_lib, rake_task|
2
+ if Rake::Task.task_defined?(test_lib)
3
+
4
+ Rake::Task[test_lib].clear
5
+ chili_specs = "#{Chili::FEATURE_FOLDER}/**/#{test_lib}/**/*_#{test_lib}.rb"
6
+
7
+ task = rake_task.constantize.new(test_lib => 'test:prepare')
8
+ task.pattern = [task.pattern, chili_specs]
9
+
10
+ namespace test_lib do
11
+ desc "Run tests for all Chili features"
12
+ rake_task.constantize.new(:chili) do |t|
13
+ t.pattern = chili_specs
14
+ end
15
+ end
16
+ end
17
+ end
@@ -13,6 +13,6 @@ spec/dummy/app # dummy app for generating chili features inside
13
13
  spec/dummy/blank_feature # blank feature template used to compare output of generators
14
14
  spec/example_app # rails app containing 2 chili features for integration testing
15
15
  spec/generators # generator tests
16
- spec/lib # lib unit tests
16
+ spec/chili # chili unit tests
17
17
  spec/requests # integration tests
18
18
  ```
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
17
17
 
18
- s.add_dependency "rails", "~> 3.2.8"
19
- s.add_dependency 'chili', '~> 2.0'
18
+ s.add_dependency "rails", "~> 3.2.9"
19
+ s.add_dependency 'chili', '~> 3.0'
20
20
 
21
21
  s.add_development_dependency "sqlite3"
22
22
  end
@@ -2,6 +2,6 @@ require "chili"
2
2
  require "blank_feature/engine"
3
3
 
4
4
  module BlankFeature
5
- extend Chili::Activatable
5
+ extend Chili::Base
6
6
  active_if { true } # edit this to activate/deactivate feature at runtime
7
7
  end
@@ -2,6 +2,6 @@ require "chili"
2
2
  require "invites_feature/engine"
3
3
 
4
4
  module InvitesFeature
5
- extend Chili::Activatable
5
+ extend Chili::Base
6
6
  active_if { logged_in? }
7
7
  end
@@ -2,6 +2,6 @@ require "chili"
2
2
  require "social_feature/engine"
3
3
 
4
4
  module SocialFeature
5
- extend Chili::Activatable
5
+ extend Chili::Base
6
6
  active_if { logged_in? && current_user.admin? }
7
7
  end
@@ -2,6 +2,7 @@
2
2
  ENV["RAILS_ENV"] ||= 'test'
3
3
  require File.expand_path("../example_app/config/environment", __FILE__)
4
4
  require 'rspec/rails'
5
+ require 'capybara/rspec'
5
6
 
6
7
  # Requires supporting ruby files with custom matchers and macros, etc,
7
8
  # in spec/support/ and its subdirectories.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chili
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-25 00:00:00.000000000 Z
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 2.9.0
53
+ version: 2.12.0
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 2.9.0
61
+ version: 2.12.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec-rails
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 2.9.0
69
+ version: 2.12.0
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 2.9.0
77
+ version: 2.12.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: jquery-rails
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +93,22 @@ dependencies:
93
93
  version: '0'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: capybara
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '2.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '2.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: xpath
96
112
  requirement: !ruby/object:Gem::Requirement
97
113
  none: false
98
114
  requirements:
@@ -140,16 +156,19 @@ files:
140
156
  - chili.gemspec
141
157
  - lib/chili.rb
142
158
  - lib/chili/activatable.rb
159
+ - lib/chili/base.rb
143
160
  - lib/chili/bundler.rb
144
161
  - lib/chili/engine.rb
145
- - lib/chili/extensions/rails/engine.rb
162
+ - lib/chili/engine_extensions.rb
146
163
  - lib/chili/feature.rb
147
164
  - lib/chili/overrides.rb
148
165
  - lib/chili/version.rb
149
166
  - lib/generators/chili/feature/USAGE
150
167
  - lib/generators/chili/feature/feature_generator.rb
151
168
  - lib/generators/chili/generator_proxy.rb
169
+ - lib/tasks/chili.rake
152
170
  - spec/README.md
171
+ - spec/chili/activatable_spec.rb
153
172
  - spec/dummy/app/app/controllers/application_controller.rb
154
173
  - spec/dummy/app/config/application.rb
155
174
  - spec/dummy/app/config/boot.rb
@@ -158,7 +177,6 @@ files:
158
177
  - spec/dummy/app/config/environments/development.rb
159
178
  - spec/dummy/app/config/environments/test.rb
160
179
  - spec/dummy/app/script/rails
161
- - spec/dummy/blank_feature/MIT-LICENSE
162
180
  - spec/dummy/blank_feature/README.rdoc
163
181
  - spec/dummy/blank_feature/app/assets/images/blank_feature/.gitkeep
164
182
  - spec/dummy/blank_feature/app/assets/javascripts/blank_feature/application.js
@@ -260,10 +278,9 @@ files:
260
278
  - spec/example_app/public/favicon.ico
261
279
  - spec/example_app/script/rails
262
280
  - spec/example_app/spec/support/user_macros.rb
281
+ - spec/features/social_extension_spec.rb
263
282
  - spec/generators/chili/feature_generator_spec.rb
264
283
  - spec/generators/chili/generator_proxy_spec.rb
265
- - spec/lib/chili/activatable_spec.rb
266
- - spec/requests/social_extension_spec.rb
267
284
  - spec/spec_helper.rb
268
285
  - spec/support/dummy_app.rb
269
286
  homepage: http://balvig.github.com/chili/
@@ -280,7 +297,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
280
297
  version: '0'
281
298
  segments:
282
299
  - 0
283
- hash: 1121667919544637223
300
+ hash: 2891570347868177261
284
301
  required_rubygems_version: !ruby/object:Gem::Requirement
285
302
  none: false
286
303
  requirements:
@@ -289,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
306
  version: '0'
290
307
  segments:
291
308
  - 0
292
- hash: 1121667919544637223
309
+ hash: 2891570347868177261
293
310
  requirements: []
294
311
  rubyforge_project:
295
312
  rubygems_version: 1.8.23
@@ -298,6 +315,7 @@ specification_version: 3
298
315
  summary: The spicy feature toggle framework
299
316
  test_files:
300
317
  - spec/README.md
318
+ - spec/chili/activatable_spec.rb
301
319
  - spec/dummy/app/app/controllers/application_controller.rb
302
320
  - spec/dummy/app/config/application.rb
303
321
  - spec/dummy/app/config/boot.rb
@@ -306,7 +324,6 @@ test_files:
306
324
  - spec/dummy/app/config/environments/development.rb
307
325
  - spec/dummy/app/config/environments/test.rb
308
326
  - spec/dummy/app/script/rails
309
- - spec/dummy/blank_feature/MIT-LICENSE
310
327
  - spec/dummy/blank_feature/README.rdoc
311
328
  - spec/dummy/blank_feature/app/assets/images/blank_feature/.gitkeep
312
329
  - spec/dummy/blank_feature/app/assets/javascripts/blank_feature/application.js
@@ -408,9 +425,8 @@ test_files:
408
425
  - spec/example_app/public/favicon.ico
409
426
  - spec/example_app/script/rails
410
427
  - spec/example_app/spec/support/user_macros.rb
428
+ - spec/features/social_extension_spec.rb
411
429
  - spec/generators/chili/feature_generator_spec.rb
412
430
  - spec/generators/chili/generator_proxy_spec.rb
413
- - spec/lib/chili/activatable_spec.rb
414
- - spec/requests/social_extension_spec.rb
415
431
  - spec/spec_helper.rb
416
432
  - spec/support/dummy_app.rb
@@ -1,9 +0,0 @@
1
- class Rails::Engine
2
- def self.automount!(path = nil)
3
- engine = self
4
- path ||= 'chili/' + engine.parent.to_s.underscore
5
- Rails.application.routes.draw do
6
- mount engine => path
7
- end
8
- end
9
- end
@@ -1,20 +0,0 @@
1
- Copyright 2012 YOURNAME
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.