chili 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/.gitignore +7 -7
  2. data/README.md +33 -28
  3. data/Rakefile +1 -1
  4. data/app/controllers/chili/application_controller.rb +3 -3
  5. data/chili.gemspec +3 -3
  6. data/lib/chili.rb +5 -3
  7. data/lib/chili/feature.rb +15 -0
  8. data/lib/chili/version.rb +1 -1
  9. data/lib/generators/chili/feature/USAGE +8 -0
  10. data/lib/generators/chili/{extension_generator.rb → feature/feature_generator.rb} +36 -37
  11. data/lib/generators/chili/generator_proxy.rb +20 -0
  12. data/spec/dummy/app/app/controllers/application_controller.rb +3 -0
  13. data/spec/dummy/app/config/application.rb +14 -0
  14. data/spec/dummy/{example_app → app}/config/boot.rb +1 -2
  15. data/spec/dummy/{example_app → app}/config/database.yml +0 -0
  16. data/spec/dummy/{example_app → app}/config/environment.rb +0 -0
  17. data/spec/dummy/{example_app → app}/config/environments/development.rb +0 -0
  18. data/spec/dummy/{example_app → app}/config/environments/test.rb +0 -0
  19. data/spec/dummy/{example_app → app}/script/rails +0 -0
  20. data/spec/dummy/{blank_extension → blank_feature}/MIT-LICENSE +0 -0
  21. data/spec/dummy/blank_feature/README.rdoc +3 -0
  22. data/spec/dummy/{blank_extension/app/assets/images/blank_extension → blank_feature/app/assets/images/blank_feature}/.gitkeep +0 -0
  23. data/spec/dummy/{blank_extension/app/assets/javascripts/blank_extension → blank_feature/app/assets/javascripts/blank_feature}/application.js +0 -0
  24. data/spec/dummy/{blank_extension/app/assets/stylesheets/blank_extension → blank_feature/app/assets/stylesheets/blank_feature}/application.css +0 -0
  25. data/spec/dummy/blank_feature/app/controllers/blank_feature/application_controller.rb +4 -0
  26. data/spec/dummy/blank_feature/app/overrides/layouts/application/assets.html.erb.deface +3 -0
  27. data/spec/dummy/{blank_extension → blank_feature}/app/overrides/layouts/application/example.html.erb.deface +2 -2
  28. data/spec/dummy/{blank_extension/blank_extension.gemspec → blank_feature/blank_feature.gemspec} +6 -6
  29. data/spec/dummy/blank_feature/config/routes.rb +3 -0
  30. data/spec/dummy/blank_feature/lib/blank_feature.rb +7 -0
  31. data/spec/dummy/blank_feature/lib/blank_feature/engine.rb +5 -0
  32. data/spec/dummy/{blank_extension/lib/blank_extension → blank_feature/lib/blank_feature}/version.rb +1 -1
  33. data/spec/dummy/blank_feature/lib/generators/blank_feature_generator.rb +3 -0
  34. data/spec/dummy/{blank_extension/lib/tasks/blank_extension_tasks.rake → blank_feature/lib/tasks/blank_feature_tasks.rake} +1 -1
  35. data/spec/{dummy/example_app → example_app}/README.rdoc +0 -0
  36. data/spec/{dummy/example_app → example_app}/Rakefile +0 -0
  37. data/spec/{dummy/example_app → example_app}/app/assets/javascripts/application.js +0 -0
  38. data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/application.css +0 -0
  39. data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/posts.css +0 -0
  40. data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/scaffold.css +0 -0
  41. data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/users.css +0 -0
  42. data/spec/{dummy/example_app → example_app}/app/controllers/application_controller.rb +0 -0
  43. data/spec/{dummy/example_app → example_app}/app/controllers/posts_controller.rb +0 -0
  44. data/spec/{dummy/example_app → example_app}/app/controllers/sessions_controller.rb +0 -0
  45. data/spec/{dummy/example_app → example_app}/app/controllers/users_controller.rb +0 -0
  46. data/spec/{dummy/example_app → example_app}/app/helpers/application_helper.rb +0 -0
  47. data/spec/{dummy/example_app → example_app}/app/helpers/posts_helper.rb +0 -0
  48. data/spec/{dummy/example_app → example_app}/app/helpers/users_helper.rb +0 -0
  49. data/spec/{dummy/example_app → example_app}/app/mailers/.gitkeep +0 -0
  50. data/spec/{dummy/example_app → example_app}/app/models/.gitkeep +0 -0
  51. data/spec/{dummy/example_app → example_app}/app/models/post.rb +0 -0
  52. data/spec/{dummy/example_app → example_app}/app/models/user.rb +0 -0
  53. data/spec/{dummy/example_app → example_app}/app/views/layouts/application.html.erb +0 -0
  54. data/spec/{dummy/example_app → example_app}/app/views/posts/_form.html.erb +0 -0
  55. data/spec/{dummy/example_app → example_app}/app/views/posts/_post.html.erb +0 -0
  56. data/spec/{dummy/example_app → example_app}/app/views/posts/edit.html.erb +0 -0
  57. data/spec/{dummy/example_app → example_app}/app/views/posts/index.html.erb +0 -0
  58. data/spec/{dummy/example_app → example_app}/app/views/posts/new.html.erb +0 -0
  59. data/spec/{dummy/example_app → example_app}/app/views/posts/show.html.erb +0 -0
  60. data/spec/{dummy/example_app → example_app}/app/views/sessions/new.html.erb +0 -0
  61. data/spec/{dummy/example_app → example_app}/app/views/users/_form.html.erb +0 -0
  62. data/spec/{dummy/example_app → example_app}/app/views/users/edit.html.erb +0 -0
  63. data/spec/{dummy/example_app → example_app}/app/views/users/index.html.erb +0 -0
  64. data/spec/{dummy/example_app → example_app}/app/views/users/new.html.erb +0 -0
  65. data/spec/{dummy/example_app → example_app}/app/views/users/show.html.erb +0 -0
  66. data/spec/{dummy/example_app → example_app}/config.ru +0 -0
  67. data/spec/{dummy/example_app → example_app}/config/application.rb +2 -2
  68. data/spec/example_app/config/boot.rb +12 -0
  69. data/spec/example_app/config/database.yml +25 -0
  70. data/spec/example_app/config/environment.rb +5 -0
  71. data/spec/example_app/config/environments/development.rb +37 -0
  72. data/spec/{dummy/example_app → example_app}/config/environments/production.rb +0 -0
  73. data/spec/example_app/config/environments/test.rb +37 -0
  74. data/spec/{dummy/example_app → example_app}/config/initializers/backtrace_silencers.rb +0 -0
  75. data/spec/{dummy/example_app → example_app}/config/initializers/inflections.rb +0 -0
  76. data/spec/{dummy/example_app → example_app}/config/initializers/mime_types.rb +0 -0
  77. data/spec/{dummy/example_app → example_app}/config/initializers/secret_token.rb +0 -0
  78. data/spec/{dummy/example_app → example_app}/config/initializers/session_store.rb +0 -0
  79. data/spec/{dummy/example_app → example_app}/config/initializers/wrap_parameters.rb +0 -0
  80. data/spec/{dummy/example_app → example_app}/config/locales/en.yml +0 -0
  81. data/spec/{dummy/example_app → example_app}/config/routes.rb +0 -0
  82. data/spec/{dummy/example_app → example_app}/db/migrate/20120513023816_create_posts.rb +0 -0
  83. data/spec/{dummy/example_app → example_app}/db/migrate/20120513023840_create_users.rb +0 -0
  84. data/spec/example_app/db/migrate/20120513032032_create_social_feature_likes.rb +11 -0
  85. data/spec/{dummy/example_app → example_app}/db/schema.rb +1 -1
  86. data/spec/{dummy/example_app → example_app}/lib/assets/.gitkeep +0 -0
  87. data/spec/{dummy/example_app/vendor/chili/invites_extension → example_app/lib/chili/invites_feature}/.gitignore +0 -0
  88. data/spec/{dummy/example_app/log → example_app/lib/chili/invites_feature/app/assets/images/invites_feature}/.gitkeep +0 -0
  89. data/spec/{dummy/example_app/vendor/chili/invites_extension/app/assets/javascripts/invites_extension → example_app/lib/chili/invites_feature/app/assets/javascripts/invites_feature}/application.js +0 -0
  90. data/spec/{dummy/example_app/vendor/chili/invites_extension/app/assets/stylesheets/invites_extension → example_app/lib/chili/invites_feature/app/assets/stylesheets/invites_feature}/application.css +0 -0
  91. data/spec/example_app/lib/chili/invites_feature/app/controllers/invites_feature/application_controller.rb +4 -0
  92. data/spec/{dummy/example_app/vendor/chili/invites_extension → example_app/lib/chili/invites_feature}/app/overrides/posts/index/disclaimer.html.erb.deface +0 -0
  93. data/spec/example_app/lib/chili/invites_feature/config/routes.rb +3 -0
  94. data/spec/example_app/lib/chili/invites_feature/lib/generators/invites_feature_generator.rb +3 -0
  95. data/spec/{dummy/example_app/vendor/chili/invites_extension/lib/invites_extension.rb → example_app/lib/chili/invites_feature/lib/invites_feature.rb} +2 -2
  96. data/spec/example_app/lib/chili/invites_feature/lib/invites_feature/engine.rb +5 -0
  97. data/spec/{dummy/example_app/vendor/chili/invites_extension/app/assets/images/invites_extension → example_app/lib/chili/social_feature/app/assets/images/social_feature}/.gitkeep +0 -0
  98. data/spec/{dummy/example_app/vendor/chili/social_extension/app/assets/javascripts/social_extension → example_app/lib/chili/social_feature/app/assets/javascripts/social_feature}/application.js +0 -0
  99. data/spec/{dummy/example_app/vendor/chili/social_extension/app/assets/stylesheets/social_extension → example_app/lib/chili/social_feature/app/assets/stylesheets/social_feature}/application.css.scss +0 -0
  100. data/spec/example_app/lib/chili/social_feature/app/controllers/social_feature/application_controller.rb +4 -0
  101. data/spec/{dummy/example_app/vendor/chili/social_extension/app/controllers/social_extension → example_app/lib/chili/social_feature/app/controllers/social_feature}/likes_controller.rb +3 -3
  102. data/spec/{dummy/example_app/vendor/chili/social_extension/app/models/social_extension → example_app/lib/chili/social_feature/app/models/social_feature}/like.rb +1 -1
  103. data/spec/{dummy/example_app/vendor/chili/social_extension/app/models/social_extension → example_app/lib/chili/social_feature/app/models/social_feature}/post.rb +1 -1
  104. data/spec/{dummy/example_app/vendor/chili/social_extension/app/models/social_extension → example_app/lib/chili/social_feature/app/models/social_feature}/user.rb +1 -1
  105. data/spec/example_app/lib/chili/social_feature/app/overrides/layouts/application/likes_link.html.erb.deface +2 -0
  106. data/spec/{dummy/example_app/vendor/chili/social_extension → example_app/lib/chili/social_feature}/app/overrides/posts/_post/like_actions.html.erb.deface +2 -2
  107. data/spec/{dummy/example_app/vendor/chili/social_extension → example_app/lib/chili/social_feature}/app/overrides/posts/index/disclaimer.html.erb.deface +0 -0
  108. data/spec/{dummy/example_app/vendor/chili/social_extension → example_app/lib/chili/social_feature}/app/overrides/posts/index/table_headers.html.erb.deface +0 -0
  109. data/spec/{dummy/example_app/vendor/chili/social_extension/app/views/social_extension → example_app/lib/chili/social_feature/app/views/social_feature}/likes/index.html.erb +0 -0
  110. data/spec/example_app/lib/chili/social_feature/config/routes.rb +4 -0
  111. data/spec/example_app/lib/chili/social_feature/db/migrate/20120513031021_create_social_feature_likes.rb +10 -0
  112. data/spec/example_app/lib/chili/social_feature/lib/generators/social_feature_generator.rb +3 -0
  113. data/spec/{dummy/example_app/vendor/chili/social_extension/lib/social_extension.rb → example_app/lib/chili/social_feature/lib/social_feature.rb} +2 -2
  114. data/spec/example_app/lib/chili/social_feature/lib/social_feature/engine.rb +5 -0
  115. data/spec/{dummy/example_app/vendor/chili/social_extension/app/assets/images/social_extension → example_app/log}/.gitkeep +0 -0
  116. data/spec/{dummy/example_app → example_app}/public/404.html +0 -0
  117. data/spec/{dummy/example_app → example_app}/public/422.html +0 -0
  118. data/spec/{dummy/example_app → example_app}/public/500.html +0 -0
  119. data/spec/{dummy/example_app → example_app}/public/favicon.ico +0 -0
  120. data/spec/example_app/script/rails +6 -0
  121. data/spec/{dummy/example_app → example_app}/spec/support/user_macros.rb +0 -0
  122. data/spec/generators/chili/feature_generator_spec.rb +40 -0
  123. data/spec/generators/chili/generator_proxy_spec.rb +28 -0
  124. data/spec/requests/social_extension_spec.rb +5 -5
  125. data/spec/spec_helper.rb +2 -1
  126. data/spec/support/dummy_app.rb +21 -0
  127. metadata +251 -256
  128. data/lib/generators/chili/USAGE +0 -8
  129. data/lib/generators/rails/chili_generator.rb +0 -11
  130. data/lib/generators/rails/templates/controller.rb +0 -73
  131. data/spec/dummy/blank_extension/README.rdoc +0 -3
  132. data/spec/dummy/blank_extension/app/overrides/layouts/application/assets.html.erb.deface +0 -3
  133. data/spec/dummy/blank_extension/config/routes.rb +0 -3
  134. data/spec/dummy/blank_extension/lib/blank_extension.rb +0 -7
  135. data/spec/dummy/blank_extension/lib/blank_extension/engine.rb +0 -10
  136. data/spec/dummy/blank_extension/script/rails +0 -8
  137. data/spec/dummy/example_app/db/migrate/20120513032032_create_social_extension_likes.rb +0 -11
  138. data/spec/dummy/example_app/vendor/chili/invites_extension/config/routes.rb +0 -3
  139. data/spec/dummy/example_app/vendor/chili/invites_extension/lib/invites_extension/engine.rb +0 -10
  140. data/spec/dummy/example_app/vendor/chili/social_extension/app/overrides/layouts/application/likes_link.html.erb.deface +0 -2
  141. data/spec/dummy/example_app/vendor/chili/social_extension/config/routes.rb +0 -4
  142. data/spec/dummy/example_app/vendor/chili/social_extension/db/migrate/20120513031021_create_likes_extension_likes.rb +0 -10
  143. data/spec/dummy/example_app/vendor/chili/social_extension/lib/social_extension/engine.rb +0 -10
  144. data/spec/generators/chili/chili_generator_spec.rb +0 -53
@@ -1,8 +0,0 @@
1
- Description:
2
- Generate a new chili extension
3
-
4
- Example:
5
- rails generate chili:extension social
6
-
7
- This will create:
8
- basic extension structure in vendor/chili/social_extension
@@ -1,11 +0,0 @@
1
- require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
2
-
3
- module Rails
4
- module Generators
5
- class ChiliGenerator < ScaffoldControllerGenerator
6
- def self.source_root
7
- @source_root ||= File.expand_path("templates", File.dirname(__FILE__))
8
- end
9
- end
10
- end
11
- end
@@ -1,73 +0,0 @@
1
- <% module_namespacing do -%>
2
- class <%= controller_class_name %>Controller < Chili::ApplicationController
3
-
4
- def index
5
- @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
6
-
7
- respond_to do |format|
8
- format.html # index.html.erb
9
- format.json { render json: <%= "@#{plural_table_name}" %> }
10
- end
11
- end
12
-
13
- def show
14
- @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
15
-
16
- respond_to do |format|
17
- format.html # show.html.erb
18
- format.json { render json: <%= "@#{singular_table_name}" %> }
19
- end
20
- end
21
-
22
- def new
23
- @<%= singular_table_name %> = <%= orm_class.build(class_name) %>
24
-
25
- respond_to do |format|
26
- format.html # new.html.erb
27
- format.json { render json: <%= "@#{singular_table_name}" %> }
28
- end
29
- end
30
-
31
- def edit
32
- @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
33
- end
34
-
35
- def create
36
- @<%= singular_table_name %> = <%= orm_class.build(class_name, "params[:#{singular_table_name}]") %>
37
-
38
- respond_to do |format|
39
- if @<%= orm_instance.save %>
40
- format.html { redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully created.'" %> }
41
- format.json { render json: <%= "@#{singular_table_name}" %>, status: :created, location: <%= "@#{singular_table_name}" %> }
42
- else
43
- format.html { render action: "new" }
44
- format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
45
- end
46
- end
47
- end
48
-
49
- def update
50
- @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
51
-
52
- respond_to do |format|
53
- if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %>
54
- format.html { redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %> }
55
- format.json { head :no_content }
56
- else
57
- format.html { render action: "edit" }
58
- format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
59
- end
60
- end
61
- end
62
-
63
- def destroy
64
- @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
65
- @<%= orm_instance.destroy %>
66
-
67
- respond_to do |format|
68
- format.html { redirect_to <%= index_helper %>_url }
69
- format.json { head :no_content }
70
- end
71
- end
72
- end
73
- <% end -%>
@@ -1,3 +0,0 @@
1
- = BlankExtension
2
-
3
- This project rocks and uses MIT-LICENSE.
@@ -1,3 +0,0 @@
1
- <!-- insert_bottom 'head' -->
2
- <%= stylesheet_link_tag 'blank_extension/application' %>
3
- <%= javascript_include_tag 'blank_extension/application' %>
@@ -1,3 +0,0 @@
1
- BlankExtension::Engine.automount!
2
- BlankExtension::Engine.routes.draw do
3
- end
@@ -1,7 +0,0 @@
1
- require "chili"
2
- require "blank_extension/engine"
3
-
4
- module BlankExtension
5
- extend Chili::Activatable
6
- active_if { true } # edit this to activate/deactivate extension at runtime
7
- end
@@ -1,10 +0,0 @@
1
- module BlankExtension
2
- class Engine < ::Rails::Engine
3
- isolate_namespace BlankExtension
4
- config.generators do |g|
5
- g.scaffold_controller :chili
6
- g.test_framework :rspec, view_specs: false, routing_specs: false, controller_specs: false
7
- g.integration_tool :rspec
8
- end
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/blank_extension/engine', __FILE__)
6
-
7
- require 'rails/all'
8
- require 'rails/engine/commands'
@@ -1,11 +0,0 @@
1
- # This migration comes from social_extension (originally 20120513031021)
2
- class CreateSocialExtensionLikes < ActiveRecord::Migration
3
- def change
4
- create_table :social_extension_likes do |t|
5
- t.integer :post_id
6
- t.integer :user_id
7
-
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,3 +0,0 @@
1
- InvitesExtension::Engine.automount!
2
- InvitesExtension::Engine.routes.draw do
3
- end
@@ -1,10 +0,0 @@
1
- module InvitesExtension
2
- class Engine < ::Rails::Engine
3
- isolate_namespace InvitesExtension
4
- config.generators do |g|
5
- g.scaffold_controller :chili
6
- g.test_framework :rspec, view_specs: false, routing_specs: false, controller_specs: false
7
- g.integration_tool :rspec
8
- end
9
- end
10
- end
@@ -1,2 +0,0 @@
1
- <!-- insert_after '.user' -->
2
- <%= link_to 'See Your Likes', social_extension.likes_path %>
@@ -1,4 +0,0 @@
1
- SocialExtension::Engine.automount!
2
- SocialExtension::Engine.routes.draw do
3
- resources :likes
4
- end
@@ -1,10 +0,0 @@
1
- class CreateSocialExtensionLikes < ActiveRecord::Migration
2
- def change
3
- create_table :social_extension_likes do |t|
4
- t.integer :post_id
5
- t.integer :user_id
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- module SocialExtension
2
- class Engine < ::Rails::Engine
3
- isolate_namespace SocialExtension
4
- config.generators do |g|
5
- g.scaffold_controller :chili
6
- g.test_framework :rspec, view_specs: false, routing_specs: false, controller_specs: false
7
- g.integration_tool :rspec
8
- end
9
- end
10
- end
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'ChiliGenerator' do
4
- describe 'rails g chili EXTENSION_NAME' do
5
- let(:app_path) { File.expand_path("../../../dummy/example_app", __FILE__) }
6
- let(:template_path) { File.expand_path("../../../dummy/blank_extension", __FILE__) }
7
- let(:gemfile) { File.join(app_path, 'Gemfile') }
8
-
9
- before do
10
- FileUtils.rm_rf File.join(app_path, 'vendor/chili/blank_extension')
11
- FileUtils.rm_rf File.join(app_path, 'vendor/chili/another_blank_extension')
12
- FileUtils.rm_rf gemfile
13
- File.open(gemfile, 'w') do |f|
14
- f.write <<-RUBY
15
- group :development do
16
- gem 'somegem'
17
- end
18
- RUBY
19
- end
20
- end
21
-
22
- it 'creates a new extension with a correct file structure and appends it to the gemfile' do
23
- puts `cd #{app_path} && rails g chili:extension blank`
24
-
25
- Dir.glob(File.join(template_path, "**/*")).reject { |f| File.directory?(f) }.each do |template|
26
- result = File.join(app_path, 'vendor/chili/blank_extension', template.sub(template_path, ''))
27
- result_text = File.open(result, 'rb').read
28
- template_text = File.open(template, 'rb').read
29
- template_text.sub!('GIT_AUTHOR',`git config user.name`.chomp) # Git author is different on each machine
30
- template_text.sub!('GIT_EMAIL',`git config user.email`.chomp) # Git email is different on each machine
31
- result_text.should == template_text
32
- end
33
- end
34
-
35
- it "appends new extensions to the chili group within the gemfile" do
36
- puts `cd #{app_path} && rails g chili:extension blank`
37
- File.open(gemfile, 'rb').read.should include <<-RUBY.chomp
38
- group :chili do
39
- gem 'blank_extension', path: 'vendor/chili/blank_extension'
40
- end
41
- RUBY
42
-
43
- puts `cd #{app_path} && rails g chili:extension another_blank`
44
- File.open(gemfile, 'rb').read.should include <<-RUBY.chomp
45
- group :chili do
46
- gem 'another_blank_extension', path: 'vendor/chili/another_blank_extension'
47
- gem 'blank_extension', path: 'vendor/chili/blank_extension'
48
- end
49
- RUBY
50
- end
51
-
52
- end
53
- end