chili 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -7
- data/README.md +33 -28
- data/Rakefile +1 -1
- data/app/controllers/chili/application_controller.rb +3 -3
- data/chili.gemspec +3 -3
- data/lib/chili.rb +5 -3
- data/lib/chili/feature.rb +15 -0
- data/lib/chili/version.rb +1 -1
- data/lib/generators/chili/feature/USAGE +8 -0
- data/lib/generators/chili/{extension_generator.rb → feature/feature_generator.rb} +36 -37
- data/lib/generators/chili/generator_proxy.rb +20 -0
- data/spec/dummy/app/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/config/application.rb +14 -0
- data/spec/dummy/{example_app → app}/config/boot.rb +1 -2
- data/spec/dummy/{example_app → app}/config/database.yml +0 -0
- data/spec/dummy/{example_app → app}/config/environment.rb +0 -0
- data/spec/dummy/{example_app → app}/config/environments/development.rb +0 -0
- data/spec/dummy/{example_app → app}/config/environments/test.rb +0 -0
- data/spec/dummy/{example_app → app}/script/rails +0 -0
- data/spec/dummy/{blank_extension → blank_feature}/MIT-LICENSE +0 -0
- data/spec/dummy/blank_feature/README.rdoc +3 -0
- data/spec/dummy/{blank_extension/app/assets/images/blank_extension → blank_feature/app/assets/images/blank_feature}/.gitkeep +0 -0
- data/spec/dummy/{blank_extension/app/assets/javascripts/blank_extension → blank_feature/app/assets/javascripts/blank_feature}/application.js +0 -0
- data/spec/dummy/{blank_extension/app/assets/stylesheets/blank_extension → blank_feature/app/assets/stylesheets/blank_feature}/application.css +0 -0
- data/spec/dummy/blank_feature/app/controllers/blank_feature/application_controller.rb +4 -0
- data/spec/dummy/blank_feature/app/overrides/layouts/application/assets.html.erb.deface +3 -0
- data/spec/dummy/{blank_extension → blank_feature}/app/overrides/layouts/application/example.html.erb.deface +2 -2
- data/spec/dummy/{blank_extension/blank_extension.gemspec → blank_feature/blank_feature.gemspec} +6 -6
- data/spec/dummy/blank_feature/config/routes.rb +3 -0
- data/spec/dummy/blank_feature/lib/blank_feature.rb +7 -0
- data/spec/dummy/blank_feature/lib/blank_feature/engine.rb +5 -0
- data/spec/dummy/{blank_extension/lib/blank_extension → blank_feature/lib/blank_feature}/version.rb +1 -1
- data/spec/dummy/blank_feature/lib/generators/blank_feature_generator.rb +3 -0
- data/spec/dummy/{blank_extension/lib/tasks/blank_extension_tasks.rake → blank_feature/lib/tasks/blank_feature_tasks.rake} +1 -1
- data/spec/{dummy/example_app → example_app}/README.rdoc +0 -0
- data/spec/{dummy/example_app → example_app}/Rakefile +0 -0
- data/spec/{dummy/example_app → example_app}/app/assets/javascripts/application.js +0 -0
- data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/application.css +0 -0
- data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/posts.css +0 -0
- data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/scaffold.css +0 -0
- data/spec/{dummy/example_app → example_app}/app/assets/stylesheets/users.css +0 -0
- data/spec/{dummy/example_app → example_app}/app/controllers/application_controller.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/controllers/posts_controller.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/controllers/sessions_controller.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/controllers/users_controller.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/helpers/application_helper.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/helpers/posts_helper.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/helpers/users_helper.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/mailers/.gitkeep +0 -0
- data/spec/{dummy/example_app → example_app}/app/models/.gitkeep +0 -0
- data/spec/{dummy/example_app → example_app}/app/models/post.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/models/user.rb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/layouts/application.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/posts/_form.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/posts/_post.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/posts/edit.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/posts/index.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/posts/new.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/posts/show.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/sessions/new.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/users/_form.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/users/edit.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/users/index.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/users/new.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/app/views/users/show.html.erb +0 -0
- data/spec/{dummy/example_app → example_app}/config.ru +0 -0
- data/spec/{dummy/example_app → example_app}/config/application.rb +2 -2
- data/spec/example_app/config/boot.rb +12 -0
- data/spec/example_app/config/database.yml +25 -0
- data/spec/example_app/config/environment.rb +5 -0
- data/spec/example_app/config/environments/development.rb +37 -0
- data/spec/{dummy/example_app → example_app}/config/environments/production.rb +0 -0
- data/spec/example_app/config/environments/test.rb +37 -0
- data/spec/{dummy/example_app → example_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/{dummy/example_app → example_app}/config/initializers/inflections.rb +0 -0
- data/spec/{dummy/example_app → example_app}/config/initializers/mime_types.rb +0 -0
- data/spec/{dummy/example_app → example_app}/config/initializers/secret_token.rb +0 -0
- data/spec/{dummy/example_app → example_app}/config/initializers/session_store.rb +0 -0
- data/spec/{dummy/example_app → example_app}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/{dummy/example_app → example_app}/config/locales/en.yml +0 -0
- data/spec/{dummy/example_app → example_app}/config/routes.rb +0 -0
- data/spec/{dummy/example_app → example_app}/db/migrate/20120513023816_create_posts.rb +0 -0
- data/spec/{dummy/example_app → example_app}/db/migrate/20120513023840_create_users.rb +0 -0
- data/spec/example_app/db/migrate/20120513032032_create_social_feature_likes.rb +11 -0
- data/spec/{dummy/example_app → example_app}/db/schema.rb +1 -1
- data/spec/{dummy/example_app → example_app}/lib/assets/.gitkeep +0 -0
- data/spec/{dummy/example_app/vendor/chili/invites_extension → example_app/lib/chili/invites_feature}/.gitignore +0 -0
- data/spec/{dummy/example_app/log → example_app/lib/chili/invites_feature/app/assets/images/invites_feature}/.gitkeep +0 -0
- 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
- 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
- data/spec/example_app/lib/chili/invites_feature/app/controllers/invites_feature/application_controller.rb +4 -0
- 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
- data/spec/example_app/lib/chili/invites_feature/config/routes.rb +3 -0
- data/spec/example_app/lib/chili/invites_feature/lib/generators/invites_feature_generator.rb +3 -0
- 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
- data/spec/example_app/lib/chili/invites_feature/lib/invites_feature/engine.rb +5 -0
- 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
- 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
- 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
- data/spec/example_app/lib/chili/social_feature/app/controllers/social_feature/application_controller.rb +4 -0
- 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
- 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
- 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
- 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
- data/spec/example_app/lib/chili/social_feature/app/overrides/layouts/application/likes_link.html.erb.deface +2 -0
- 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
- 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
- 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
- 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
- data/spec/example_app/lib/chili/social_feature/config/routes.rb +4 -0
- data/spec/example_app/lib/chili/social_feature/db/migrate/20120513031021_create_social_feature_likes.rb +10 -0
- data/spec/example_app/lib/chili/social_feature/lib/generators/social_feature_generator.rb +3 -0
- 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
- data/spec/example_app/lib/chili/social_feature/lib/social_feature/engine.rb +5 -0
- data/spec/{dummy/example_app/vendor/chili/social_extension/app/assets/images/social_extension → example_app/log}/.gitkeep +0 -0
- data/spec/{dummy/example_app → example_app}/public/404.html +0 -0
- data/spec/{dummy/example_app → example_app}/public/422.html +0 -0
- data/spec/{dummy/example_app → example_app}/public/500.html +0 -0
- data/spec/{dummy/example_app → example_app}/public/favicon.ico +0 -0
- data/spec/example_app/script/rails +6 -0
- data/spec/{dummy/example_app → example_app}/spec/support/user_macros.rb +0 -0
- data/spec/generators/chili/feature_generator_spec.rb +40 -0
- data/spec/generators/chili/generator_proxy_spec.rb +28 -0
- data/spec/requests/social_extension_spec.rb +5 -5
- data/spec/spec_helper.rb +2 -1
- data/spec/support/dummy_app.rb +21 -0
- metadata +251 -256
- data/lib/generators/chili/USAGE +0 -8
- data/lib/generators/rails/chili_generator.rb +0 -11
- data/lib/generators/rails/templates/controller.rb +0 -73
- data/spec/dummy/blank_extension/README.rdoc +0 -3
- data/spec/dummy/blank_extension/app/overrides/layouts/application/assets.html.erb.deface +0 -3
- data/spec/dummy/blank_extension/config/routes.rb +0 -3
- data/spec/dummy/blank_extension/lib/blank_extension.rb +0 -7
- data/spec/dummy/blank_extension/lib/blank_extension/engine.rb +0 -10
- data/spec/dummy/blank_extension/script/rails +0 -8
- data/spec/dummy/example_app/db/migrate/20120513032032_create_social_extension_likes.rb +0 -11
- data/spec/dummy/example_app/vendor/chili/invites_extension/config/routes.rb +0 -3
- data/spec/dummy/example_app/vendor/chili/invites_extension/lib/invites_extension/engine.rb +0 -10
- data/spec/dummy/example_app/vendor/chili/social_extension/app/overrides/layouts/application/likes_link.html.erb.deface +0 -2
- data/spec/dummy/example_app/vendor/chili/social_extension/config/routes.rb +0 -4
- data/spec/dummy/example_app/vendor/chili/social_extension/db/migrate/20120513031021_create_likes_extension_likes.rb +0 -10
- data/spec/dummy/example_app/vendor/chili/social_extension/lib/social_extension/engine.rb +0 -10
- data/spec/generators/chili/chili_generator_spec.rb +0 -53
data/lib/generators/chili/USAGE
DELETED
@@ -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,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,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,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
|