Permalink
Browse files

extensions are now "features"

  • Loading branch information...
1 parent 6f7216e commit 8b461fcfa299e680f6006385c91b98a397ac6662 @balvig committed Oct 16, 2012
Showing with 154 additions and 164 deletions.
  1. +3 −3 app/controllers/chili/application_controller.rb
  2. +2 −2 chili.gemspec
  3. +1 −1 lib/chili.rb
  4. +2 −2 lib/chili/{extension.rb → feature.rb}
  5. 0 lib/generators/chili/{extension → feature}/USAGE
  6. +20 −20 lib/generators/chili/{extension/extension_generator.rb → feature/feature_generator.rb}
  7. +1 −1 lib/generators/chili/generator_proxy.rb
  8. +1 −1 spec/dummy/app/config/boot.rb
  9. +0 −3 spec/dummy/blank_extension/README.rdoc
  10. +0 −3 spec/dummy/blank_extension/app/overrides/layouts/application/assets.html.erb.deface
  11. +0 −3 spec/dummy/blank_extension/config/routes.rb
  12. +0 −7 spec/dummy/blank_extension/lib/blank_extension.rb
  13. +0 −5 spec/dummy/blank_extension/lib/blank_extension/engine.rb
  14. +0 −3 spec/dummy/blank_extension/lib/generators/blank_extension_generator.rb
  15. 0 spec/dummy/{blank_extension → blank_feature}/MIT-LICENSE
  16. +3 −0 spec/dummy/blank_feature/README.rdoc
  17. 0 ...pp/assets/images/social_extension → dummy/blank_feature/app/assets/images/blank_feature}/.gitkeep
  18. 0 ...ripts/social_extension → dummy/blank_feature/app/assets/javascripts/blank_feature}/application.js
  19. 0 ...ets/invites_extension → dummy/blank_feature/app/assets/stylesheets/blank_feature}/application.css
  20. +1 −1 ...trollers/blank_extension → blank_feature/app/controllers/blank_feature}/application_controller.rb
  21. +3 −0 spec/dummy/blank_feature/app/overrides/layouts/application/assets.html.erb.deface
  22. +2 −2 ...dummy/{blank_extension → blank_feature}/app/overrides/layouts/application/example.html.erb.deface
  23. +5 −5 spec/dummy/{blank_extension/blank_extension.gemspec → blank_feature/blank_feature.gemspec}
  24. +3 −0 spec/dummy/blank_feature/config/routes.rb
  25. +7 −0 spec/dummy/blank_feature/lib/blank_feature.rb
  26. +5 −0 spec/dummy/blank_feature/lib/blank_feature/engine.rb
  27. +1 −1 spec/dummy/{blank_extension/lib/blank_extension → blank_feature/lib/blank_feature}/version.rb
  28. +3 −0 spec/dummy/blank_feature/lib/generators/blank_feature_generator.rb
  29. +1 −1 ...xtension/lib/tasks/blank_extension_tasks.rake → blank_feature/lib/tasks/blank_feature_tasks.rake}
  30. +1 −1 spec/dummy/{blank_extension → blank_feature}/script/rails
  31. +2 −2 spec/example_app/config/application.rb
  32. +2 −2 spec/example_app/config/boot.rb
  33. +0 −11 spec/example_app/db/migrate/20120513032032_create_social_extension_likes.rb
  34. +11 −0 spec/example_app/db/migrate/20120513032032_create_social_feature_likes.rb
  35. +1 −1 spec/example_app/db/schema.rb
  36. +0 −3 spec/example_app/vendor/chili/invites_extension/config/routes.rb
  37. +0 −3 spec/example_app/vendor/chili/invites_extension/lib/generators/invites_extension_generator.rb
  38. +0 −10 spec/example_app/vendor/chili/invites_extension/lib/invites_extension/engine.rb
  39. 0 spec/example_app/vendor/chili/{invites_extension → invites_feature}/.gitignore
  40. 0 ...app/assets/images/invites_extension → invites_feature/app/assets/images/invites_feature}/.gitkeep
  41. 0 ...cripts/invites_extension → invites_feature/app/assets/javascripts/invites_feature}/application.js
  42. 0 ... example_app/vendor/chili/invites_feature/app/assets/stylesheets/invites_feature}/application.css
  43. +1 −1 ...ers/social_extension → invites_feature/app/controllers/invites_feature}/application_controller.rb
  44. 0 .../chili/{invites_extension → invites_feature}/app/overrides/posts/index/disclaimer.html.erb.deface
  45. +3 −0 spec/example_app/vendor/chili/invites_feature/config/routes.rb
  46. +3 −0 spec/example_app/vendor/chili/invites_feature/lib/generators/invites_feature_generator.rb
  47. +2 −2 ...endor/chili/{invites_extension/lib/invites_extension.rb → invites_feature/lib/invites_feature.rb}
  48. +5 −0 spec/example_app/vendor/chili/invites_feature/lib/invites_feature/engine.rb
  49. +0 −2 ...le_app/vendor/chili/social_extension/app/overrides/layouts/application/likes_link.html.erb.deface
  50. +0 −4 spec/example_app/vendor/chili/social_extension/config/routes.rb
  51. +0 −10 ...ample_app/vendor/chili/social_extension/db/migrate/20120513031021_create_likes_extension_likes.rb
  52. +0 −3 spec/example_app/vendor/chili/social_extension/lib/generators/social_extension_generator.rb
  53. +0 −10 spec/example_app/vendor/chili/social_extension/lib/social_extension/engine.rb
  54. 0 ...nk_extension → example_app/vendor/chili/social_feature/app/assets/images/social_feature}/.gitkeep
  55. 0 ...n → example_app/vendor/chili/social_feature/app/assets/javascripts/social_feature}/application.js
  56. 0 ...ets/social_extension → social_feature/app/assets/stylesheets/social_feature}/application.css.scss
  57. +1 −1 ...lers/invites_extension → social_feature/app/controllers/social_feature}/application_controller.rb
  58. +2 −2 ...controllers/social_extension → social_feature/app/controllers/social_feature}/likes_controller.rb
  59. +1 −1 ...{social_extension/app/models/social_extension → social_feature/app/models/social_feature}/like.rb
  60. +1 −1 ...{social_extension/app/models/social_extension → social_feature/app/models/social_feature}/post.rb
  61. +1 −1 ...{social_extension/app/models/social_extension → social_feature/app/models/social_feature}/user.rb
  62. +2 −0 ...mple_app/vendor/chili/social_feature/app/overrides/layouts/application/likes_link.html.erb.deface
  63. +2 −2 .../chili/{social_extension → social_feature}/app/overrides/posts/_post/like_actions.html.erb.deface
  64. 0 ...or/chili/{social_extension → social_feature}/app/overrides/posts/index/disclaimer.html.erb.deface
  65. 0 ...chili/{social_extension → social_feature}/app/overrides/posts/index/table_headers.html.erb.deface
  66. 0 ...ension/app/views/social_extension → social_feature/app/views/social_feature}/likes/index.html.erb
  67. +4 −0 spec/example_app/vendor/chili/social_feature/config/routes.rb
  68. +10 −0 .../example_app/vendor/chili/social_feature/db/migrate/20120513031021_create_social_feature_likes.rb
  69. +3 −0 spec/example_app/vendor/chili/social_feature/lib/generators/social_feature_generator.rb
  70. +2 −2 ...pp/vendor/chili/{social_extension/lib/social_extension.rb → social_feature/lib/social_feature.rb}
  71. +5 −0 spec/example_app/vendor/chili/social_feature/lib/social_feature/engine.rb
  72. +12 −12 spec/generators/chili/{extension_generator_spec.rb → feature_generator_spec.rb}
  73. +8 −8 spec/generators/chili/generator_proxy_spec.rb
  74. +5 −5 spec/requests/social_extension_spec.rb
@@ -1,10 +1,10 @@
module Chili
class ApplicationController < ::ApplicationController
- before_filter :activate_extension
+ before_filter :activate_feature
private
- def activate_extension
- raise ActionController::RoutingError, 'Extension Disabled' unless self.class.parent.active?(self)
+ def activate_feature
+ raise ActionController::RoutingError, 'Feature Disabled' unless self.class.parent.active?(self)
end
end
end
View
@@ -4,8 +4,8 @@ require File.expand_path('../lib/chili/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Jens Balvig"]
gem.email = ["jens@balvig.com"]
- gem.description = %q{The spicy extension framework}
- gem.summary = %q{The spicy extension framework}
+ gem.description = %q{The spicy feature toggle framework}
+ gem.summary = %q{The spicy feature toggle framework}
gem.homepage = "http://balvig.github.com/chili/"
gem.files = `git ls-files`.split($\)
View
@@ -2,8 +2,8 @@
require "chili/activatable"
require "chili/bundler"
require "chili/engine"
-require "chili/extension"
require "chili/extensions/rails/engine"
+require "chili/feature"
require "chili/overrides"
require "chili/version"
require "generators/chili/generator_proxy"
@@ -1,11 +1,11 @@
module Chili
- class Extension
+ class Feature
def initialize(short_name)
@short_name = short_name
end
def name
- @short_name.to_s.underscore.gsub('_extension','') + '_extension'
+ @short_name.to_s.underscore.gsub('_feature','') + '_feature'
end
def path
@@ -1,9 +1,9 @@
module Chili
module Generators
- class ExtensionGenerator < Rails::Generators::NamedBase
+ class FeatureGenerator < Rails::Generators::NamedBase
def run_plugin_generator
- ARGV[0] = extension.path
+ ARGV[0] = feature.path
ARGV[1] = '--mountable'
ARGV[2] = '--skip-test-unit'
ARGV[3] = '--skip-bundle'
@@ -19,7 +19,7 @@ def reset_destination_root
def edit_gemspec
require File.expand_path('../../../../chili/version', __FILE__)
- gemspec = "#{extension.name}.gemspec"
+ gemspec = "#{feature.name}.gemspec"
gsub_file gemspec, '# s.add_dependency "jquery-rails"', "s.add_dependency 'chili', '~> #{Chili::VERSION.sub(/\.\d+$/,'')}'"
gsub_file gemspec, 'TODO: Your name', `git config user.NAME`.chomp
gsub_file gemspec, 'TODO: Your email', `git config user.email`.chomp
@@ -30,42 +30,42 @@ def add_gem_to_main_gemfile
gemfile = "../../../Gemfile"
group = "group :chili do\n"
append_to_file gemfile, group
- append_to_file gemfile, " gem '#{extension.name}', path: '#{extension.path}'\nend", after: group
+ append_to_file gemfile, " gem '#{feature.name}', path: '#{feature.path}'\nend", after: group
gsub_file gemfile, 'end gem', ' gem' #nasty cleanup
end
def remove_unused_files
- remove_dir "app/helpers/#{extension.name}"
+ remove_dir "app/helpers/#{feature.name}"
remove_dir 'app/views/layouts'
remove_file 'Gemfile'
remove_file 'Rakefile'
end
def remove_jquery_stuff
- gsub_file "app/assets/javascripts/#{extension.name}/application.js", "//= require jquery_ujs\n", ''
- gsub_file "app/assets/javascripts/#{extension.name}/application.js", "//= require jquery\n", ''
+ gsub_file "app/assets/javascripts/#{feature.name}/application.js", "//= require jquery_ujs\n", ''
+ gsub_file "app/assets/javascripts/#{feature.name}/application.js", "//= require jquery\n", ''
end
def chilify_application_controller
- gsub_file "app/controllers/#{extension.name}/application_controller.rb", "ActionController::Base", 'Chili::ApplicationController'
+ gsub_file "app/controllers/#{feature.name}/application_controller.rb", "ActionController::Base", 'Chili::ApplicationController'
end
def clean_up_gitignore
gsub_file ".gitignore", /test\/dummy.*\n/, ''
end
def automount_engine
- prepend_to_file 'config/routes.rb', "#{extension.name.camelcase}::Engine.automount!\n"
+ prepend_to_file 'config/routes.rb', "#{feature.name.camelcase}::Engine.automount!\n"
end
def include_chili_libs
- prepend_to_file "lib/#{extension.name}.rb", "require \"chili\"\n"
+ prepend_to_file "lib/#{feature.name}.rb", "require \"chili\"\n"
end
def include_active_if
- inject_into_file "lib/#{extension.name}.rb", after: "module #{extension.name.camelcase}\n" do <<-RUBY
+ inject_into_file "lib/#{feature.name}.rb", after: "module #{feature.name.camelcase}\n" do <<-RUBY
extend Chili::Activatable
- active_if { true } # edit this to activate/deactivate extension at runtime
+ active_if { true } # edit this to activate/deactivate feature at runtime
RUBY
end
end
@@ -75,8 +75,8 @@ def add_dummy_override
create_file example_file_path do <<-RUBY
<!-- insert_bottom 'body' -->
<div style='background: #FFF;text-align: center; padding: 4px 0;position: fixed;width: 100%;z-index: 9999;top: 0;'>
- #{extension.name} active - edit/remove this file:<br/>
- <strong>#{extension.path}/#{example_file_path}</strong><br/>
+ #{feature.name} active - edit/remove this file:<br/>
+ <strong>#{feature.path}/#{example_file_path}</strong><br/>
<%= link_to 'deface docs', 'https://github.com/spree/deface', target: '_blank' %>
</div>
RUBY
@@ -86,15 +86,15 @@ def add_dummy_override
def add_assets_override
create_file 'app/overrides/layouts/application/assets.html.erb.deface' do <<-RUBY
<!-- insert_bottom 'head' -->
-<%= stylesheet_link_tag '#{extension.name}/application' %>
-<%= javascript_include_tag '#{extension.name}/application' %>
+<%= stylesheet_link_tag '#{feature.name}/application' %>
+<%= javascript_include_tag '#{feature.name}/application' %>
RUBY
end
end
def add_generator_proxy
- create_file "lib/generators/#{extension.name}_generator.rb" do <<-RUBY
-class #{extension.name.camelcase}Generator < Rails::Generators::Base
+ create_file "lib/generators/#{feature.name}_generator.rb" do <<-RUBY
+class #{feature.name.camelcase}Generator < Rails::Generators::Base
include Chili::GeneratorProxy
end
RUBY
@@ -103,8 +103,8 @@ class #{extension.name.camelcase}Generator < Rails::Generators::Base
protected
- def extension
- @extension ||= Chili::Extension.new(ARGV[0])
+ def feature
+ @feature ||= Chili::Feature.new(ARGV[0])
end
end
end
@@ -12,7 +12,7 @@ def self.desc
def delegate
engine = self.class.generator_name.classify.constantize
Rails::Generators.namespace = engine
- Rails::Generators.invoke ARGV.shift, ARGV, destination_root: Extension.new(engine).path, behavior: behavior
+ Rails::Generators.invoke ARGV.shift, ARGV, destination_root: Feature.new(engine).path, behavior: behavior
end
end
end
@@ -8,4 +8,4 @@
end
$:.unshift File.expand_path('../../../../../lib', __FILE__)
-$:.unshift File.expand_path('../../vendor/chili/blank_extension/lib', __FILE__)
+$:.unshift File.expand_path('../../vendor/chili/blank_feature/lib', __FILE__)
@@ -1,3 +0,0 @@
-= BlankExtension
-
-This project rocks and uses MIT-LICENSE.
@@ -1,3 +0,0 @@
-<!-- insert_bottom 'head' -->
-<%= stylesheet_link_tag 'blank_extension/application' %>
-<%= javascript_include_tag 'blank_extension/application' %>
@@ -1,3 +0,0 @@
-BlankExtension::Engine.automount!
-BlankExtension::Engine.routes.draw do
-end
@@ -1,7 +0,0 @@
-require "chili"
-require "blank_extension/engine"
-
-module BlankExtension
- extend Chili::Activatable
- active_if { true } # edit this to activate/deactivate extension at runtime
-end
@@ -1,5 +0,0 @@
-module BlankExtension
- class Engine < ::Rails::Engine
- isolate_namespace BlankExtension
- end
-end
@@ -1,3 +0,0 @@
-class BlankExtensionGenerator < Rails::Generators::Base
- include Chili::GeneratorProxy
-end
@@ -0,0 +1,3 @@
+= BlankFeature
+
+This project rocks and uses MIT-LICENSE.
@@ -1,4 +1,4 @@
-module BlankExtension
+module BlankFeature
class ApplicationController < Chili::ApplicationController
end
end
@@ -0,0 +1,3 @@
+<!-- insert_bottom 'head' -->
+<%= stylesheet_link_tag 'blank_feature/application' %>
+<%= javascript_include_tag 'blank_feature/application' %>
@@ -1,6 +1,6 @@
<!-- insert_bottom 'body' -->
<div style='background: #FFF;text-align: center; padding: 4px 0;position: fixed;width: 100%;z-index: 9999;top: 0;'>
- blank_extension active - edit/remove this file:<br/>
- <strong>vendor/chili/blank_extension/app/overrides/layouts/application/example.html.erb.deface</strong><br/>
+ blank_feature active - edit/remove this file:<br/>
+ <strong>vendor/chili/blank_feature/app/overrides/layouts/application/example.html.erb.deface</strong><br/>
<%= link_to 'deface docs', 'https://github.com/spree/deface', target: '_blank' %>
</div>
@@ -1,17 +1,17 @@
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
-require "blank_extension/version"
+require "blank_feature/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
- s.name = "blank_extension"
- s.version = BlankExtension::VERSION
+ s.name = "blank_feature"
+ s.version = BlankFeature::VERSION
s.authors = ["GIT_AUTHOR"]
s.email = ["GIT_EMAIL"]
s.homepage = ""
- s.summary = "Summary of BlankExtension."
- s.description = "Description of BlankExtension."
+ s.summary = "Summary of BlankFeature."
+ s.description = "Description of BlankFeature."
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
@@ -0,0 +1,3 @@
+BlankFeature::Engine.automount!
+BlankFeature::Engine.routes.draw do
+end
@@ -0,0 +1,7 @@
+require "chili"
+require "blank_feature/engine"
+
+module BlankFeature
+ extend Chili::Activatable
+ active_if { true } # edit this to activate/deactivate feature at runtime
+end
@@ -0,0 +1,5 @@
+module BlankFeature
+ class Engine < ::Rails::Engine
+ isolate_namespace BlankFeature
+ end
+end
@@ -1,3 +1,3 @@
-module BlankExtension
+module BlankFeature
VERSION = "0.0.1"
end
@@ -0,0 +1,3 @@
+class BlankFeatureGenerator < Rails::Generators::Base
+ include Chili::GeneratorProxy
+end
@@ -1,4 +1,4 @@
# desc "Explaining what the task does"
-# task :blank_extension do
+# task :blank_feature do
# # Task goes here
# end
@@ -2,7 +2,7 @@
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
-ENGINE_PATH = File.expand_path('../../lib/blank_extension/engine', __FILE__)
+ENGINE_PATH = File.expand_path('../../lib/blank_feature/engine', __FILE__)
require 'rails/all'
require 'rails/engine/commands'
@@ -4,8 +4,8 @@
Bundler.require
require "chili"
-require "social_extension"
-require "invites_extension"
+require "social_feature"
+require "invites_feature"
module Dummy
class Application < Rails::Application
@@ -8,5 +8,5 @@
end
$:.unshift File.expand_path('../../../../../lib', __FILE__)
-$:.unshift File.expand_path('../../vendor/chili/social_extension/lib', __FILE__)
-$:.unshift File.expand_path('../../vendor/chili/invites_extension/lib', __FILE__)
+$:.unshift File.expand_path('../../vendor/chili/social_feature/lib', __FILE__)
+$:.unshift File.expand_path('../../vendor/chili/invites_feature/lib', __FILE__)
@@ -1,11 +0,0 @@
-# This migration comes from social_extension (originally 20120513031021)
-class CreateSocialExtensionLikes < ActiveRecord::Migration
- def change
- create_table :social_extension_likes do |t|
- t.integer :post_id
- t.integer :user_id
-
- t.timestamps
- end
- end
-end
@@ -0,0 +1,11 @@
+# This migration comes from social_feature (originally 20120513031021)
+class CreateSocialFeatureLikes < ActiveRecord::Migration
+ def change
+ create_table :social_feature_likes do |t|
+ t.integer :post_id
+ t.integer :user_id
+
+ t.timestamps
+ end
+ end
+end
@@ -19,7 +19,7 @@
t.datetime "updated_at", :null => false
end
- create_table "social_extension_likes", :force => true do |t|
+ create_table "social_feature_likes", :force => true do |t|
t.integer "post_id"
t.integer "user_id"
t.datetime "created_at", :null => false
@@ -1,3 +0,0 @@
-InvitesExtension::Engine.automount!
-InvitesExtension::Engine.routes.draw do
-end
@@ -1,3 +0,0 @@
-class InvitesExtensionGenerator < Rails::Generators::Base
- include Chili::GeneratorProxy
-end
@@ -1,10 +0,0 @@
-module InvitesExtension
- class Engine < ::Rails::Engine
- isolate_namespace InvitesExtension
- config.generators do |g|
- g.scaffold_controller :chili
- g.test_framework :rspec, view_specs: false, routing_specs: false, controller_specs: false
- g.integration_tool :rspec
- end
- end
-end
@@ -1,4 +1,4 @@
-module SocialExtension
+module InvitesFeature
class ApplicationController < Chili::ApplicationController
end
end
@@ -0,0 +1,3 @@
+InvitesFeature::Engine.automount!
+InvitesFeature::Engine.routes.draw do
+end
@@ -0,0 +1,3 @@
+class InvitesFeatureGenerator < Rails::Generators::Base
+ include Chili::GeneratorProxy
+end
@@ -1,7 +1,7 @@
require "chili"
-require "invites_extension/engine"
+require "invites_feature/engine"
-module InvitesExtension
+module InvitesFeature
extend Chili::Activatable
active_if { logged_in? }
end
@@ -0,0 +1,5 @@
+module InvitesFeature
+ class Engine < ::Rails::Engine
+ isolate_namespace InvitesFeature
+ end
+end
Oops, something went wrong. Retry.

0 comments on commit 8b461fc

Please sign in to comment.