chili 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +1 -1
  2. data/Gemfile +1 -0
  3. data/README.md +15 -15
  4. data/lib/chili/engine.rb +4 -0
  5. data/lib/chili/version.rb +1 -1
  6. data/lib/generators/chili/USAGE +2 -2
  7. data/lib/generators/chili/extension_generator.rb +109 -0
  8. data/spec/dummy/{template_ext → blank_extension}/MIT-LICENSE +0 -0
  9. data/spec/dummy/blank_extension/README.rdoc +3 -0
  10. data/spec/dummy/{example/vendor/chili/social_ext/app/assets/images/social_ext → blank_extension/app/assets/images/blank_extension}/.gitkeep +0 -0
  11. data/spec/dummy/{template_ext/app/assets/javascripts/template_ext → blank_extension/app/assets/javascripts/blank_extension}/application.js +0 -0
  12. data/spec/dummy/{template_ext/app/assets/stylesheets/template_ext → blank_extension/app/assets/stylesheets/blank_extension}/application.css +0 -0
  13. data/spec/dummy/blank_extension/app/overrides/layouts/application/assets.html.erb.deface +3 -0
  14. data/spec/dummy/{template_ext → blank_extension}/app/overrides/layouts/application/example.html.erb.deface +2 -2
  15. data/spec/dummy/{template_ext/template_ext.gemspec → blank_extension/blank_extension.gemspec} +7 -7
  16. data/spec/dummy/blank_extension/config/routes.rb +3 -0
  17. data/spec/dummy/{template_ext/lib/template_ext.rb → blank_extension/lib/blank_extension.rb} +2 -2
  18. data/spec/dummy/{example/vendor/chili/social_ext/lib/social_ext → blank_extension/lib/blank_extension}/engine.rb +2 -2
  19. data/spec/dummy/{template_ext/lib/template_ext → blank_extension/lib/blank_extension}/version.rb +1 -1
  20. data/spec/dummy/{template_ext/lib/tasks/template_ext_tasks.rake → blank_extension/lib/tasks/blank_extension_tasks.rake} +1 -1
  21. data/spec/dummy/{template_ext → blank_extension}/script/rails +1 -1
  22. data/spec/dummy/example/config/application.rb +2 -1
  23. data/spec/dummy/example/config/boot.rb +2 -1
  24. data/spec/dummy/example/db/migrate/20120513032032_create_social_extension_likes.rb +11 -0
  25. data/spec/dummy/example/db/schema.rb +1 -1
  26. data/spec/dummy/example/vendor/chili/invites_extension/.gitignore +3 -0
  27. data/spec/dummy/{template_ext/app/assets/images/template_ext → example/vendor/chili/invites_extension/app/assets/images/invites_extension}/.gitkeep +0 -0
  28. data/spec/dummy/example/vendor/chili/invites_extension/app/assets/javascripts/invites_extension/application.js +13 -0
  29. data/spec/dummy/example/vendor/chili/invites_extension/app/assets/stylesheets/invites_extension/application.css +13 -0
  30. data/spec/dummy/example/vendor/chili/invites_extension/app/overrides/posts/index/disclaimer.html.erb.deface +2 -0
  31. data/spec/dummy/example/vendor/chili/invites_extension/config/routes.rb +3 -0
  32. data/spec/dummy/example/vendor/chili/invites_extension/lib/invites_extension.rb +7 -0
  33. data/spec/dummy/example/vendor/chili/invites_extension/lib/invites_extension/engine.rb +10 -0
  34. data/spec/dummy/example/vendor/chili/social_extension/app/assets/images/social_extension/.gitkeep +0 -0
  35. data/spec/dummy/example/vendor/chili/{social_ext/app/assets/javascripts/social_ext → social_extension/app/assets/javascripts/social_extension}/application.js +0 -0
  36. data/spec/dummy/example/vendor/chili/{social_ext/app/assets/stylesheets/social_ext → social_extension/app/assets/stylesheets/social_extension}/application.css.scss +0 -0
  37. data/spec/dummy/example/vendor/chili/social_extension/app/controllers/social_extension/likes_controller.rb +20 -0
  38. data/spec/dummy/example/vendor/chili/{social_ext/app/models/social_ext → social_extension/app/models/social_extension}/like.rb +1 -1
  39. data/spec/dummy/example/vendor/chili/{social_ext/app/models/social_ext → social_extension/app/models/social_extension}/post.rb +1 -1
  40. data/spec/dummy/example/vendor/chili/{social_ext/app/models/social_ext → social_extension/app/models/social_extension}/user.rb +1 -1
  41. data/spec/dummy/example/vendor/chili/{social_ext → social_extension}/app/overrides/posts/_post/like_actions.html.erb.deface +2 -2
  42. data/spec/dummy/example/vendor/chili/{social_ext → social_extension}/app/overrides/posts/index/disclaimer.html.erb.deface +0 -0
  43. data/spec/dummy/example/vendor/chili/social_extension/app/overrides/posts/index/like_links.html.erb.deface +2 -0
  44. data/spec/dummy/example/vendor/chili/{social_ext/app/views/social_ext → social_extension/app/views/social_extension}/likes/index.html.erb +0 -0
  45. data/spec/dummy/example/vendor/chili/social_extension/config/routes.rb +4 -0
  46. data/spec/dummy/example/vendor/chili/social_extension/db/migrate/20120513031021_create_likes_extension_likes.rb +10 -0
  47. data/spec/dummy/example/vendor/chili/{social_ext/lib/social_ext.rb → social_extension/lib/social_extension.rb} +2 -2
  48. data/spec/dummy/{template_ext/lib/template_ext → example/vendor/chili/social_extension/lib/social_extension}/engine.rb +2 -2
  49. data/spec/generators/chili/chili_generator_spec.rb +4 -4
  50. data/spec/requests/{social_ext_spec.rb → social_extension_spec.rb} +11 -2
  51. metadata +133 -86
  52. data/lib/generators/chili/chili_generator.rb +0 -104
  53. data/spec/dummy/example/db/migrate/20120513032032_create_social_ext_likes.rb +0 -11
  54. data/spec/dummy/example/vendor/chili/social_ext/app/controllers/social_ext/likes_controller.rb +0 -14
  55. data/spec/dummy/example/vendor/chili/social_ext/app/overrides/layouts/application/assets.html.erb.deface +0 -2
  56. data/spec/dummy/example/vendor/chili/social_ext/app/overrides/posts/index/like_links.html.erb.deface +0 -2
  57. data/spec/dummy/example/vendor/chili/social_ext/config/routes.rb +0 -4
  58. data/spec/dummy/example/vendor/chili/social_ext/db/migrate/20120513031021_create_likes_ext_likes.rb +0 -10
  59. data/spec/dummy/example/vendor/chili/social_ext/db/migrate/20120513031021_create_social_ext_likes.rb +0 -10
  60. data/spec/dummy/template_ext/README.rdoc +0 -3
  61. data/spec/dummy/template_ext/app/overrides/layouts/application/assets.html.erb.deface +0 -3
  62. data/spec/dummy/template_ext/config/routes.rb +0 -3
@@ -1,104 +0,0 @@
1
- class ChiliGenerator < Rails::Generators::NamedBase
2
- NAME = "#{ARGV[0]}_ext"
3
- PATH = "vendor/chili/#{NAME}"
4
-
5
- def run_plugin_generator
6
- ARGV[0] = PATH
7
- ARGV[1] = "--mountable"
8
- ARGV[2] = '--skip-test-unit'
9
- ARGV[3] = '--skip-bundle'
10
-
11
- require 'rails/generators'
12
- require 'rails/generators/rails/plugin_new/plugin_new_generator'
13
- Rails::Generators::PluginNewGenerator.start
14
- end
15
-
16
- def reset_destination_root
17
- self.destination_root = ''
18
- end
19
-
20
- def edit_gemspec
21
- require File.expand_path('../../../chili/version', __FILE__)
22
- gemspec = "#{NAME}.gemspec"
23
- gsub_file gemspec, '# s.add_dependency "jquery-rails"', "s.add_dependency 'chili', '~> #{Chili::VERSION}'"
24
- gsub_file gemspec, 'TODO: Your name', `git config user.NAME`.chomp
25
- gsub_file gemspec, 'TODO: Your email', `git config user.email`.chomp
26
- gsub_file gemspec, /TODO(:\s)?/, ''
27
- end
28
-
29
- def add_gem_to_main_gemfile
30
- append_to_file "../../../Gemfile", "gem '#{NAME}', path: '#{PATH}'"
31
- end
32
-
33
- def remove_unused_files
34
- remove_dir "app/controllers/#{NAME}"
35
- remove_dir "app/helpers/#{NAME}"
36
- remove_dir 'app/views/layouts'
37
- remove_file 'Gemfile'
38
- remove_file 'Rakefile'
39
- end
40
-
41
- def remove_jquery_stuff
42
- gsub_file "app/assets/javascripts/#{NAME}/application.js", "//= require jquery_ujs\n", ''
43
- gsub_file "app/assets/javascripts/#{NAME}/application.js", "//= require jquery\n", ''
44
- end
45
-
46
- def set_up_custom_generator
47
- inject_into_file "lib/#{NAME}/engine.rb", after: "isolate_namespace #{NAME.camelcase}\n" do <<-RUBY
48
- config.generators do |g|
49
- g.scaffold_controller :chili
50
- end
51
- RUBY
52
- end
53
- end
54
-
55
- def set_up_rspec
56
- inject_into_file "lib/#{NAME}/engine.rb", :after => " g.scaffold_controller :chili\n" do <<-RUBY
57
- g.test_framework :rspec, view_specs: false, routing_specs: false, controller_specs: false
58
- g.integration_tool :rspec
59
- RUBY
60
- end
61
- end
62
-
63
- def clean_up_gitignore
64
- gsub_file ".gitignore", /test\/dummy.*\n/, ''
65
- end
66
-
67
- def automount_engine
68
- prepend_to_file 'config/routes.rb', "#{NAME.camelcase}::Engine.automount!\n"
69
- end
70
-
71
- def include_chili_libs
72
- prepend_to_file "lib/#{NAME}.rb", "require \"chili\"\n"
73
- end
74
-
75
- def include_active_if
76
- inject_into_file "lib/#{NAME}.rb", :after => "module #{NAME.camelcase}\n" do <<-RUBY
77
- extend Chili::Activatable
78
- active_if { logged_in? }
79
- RUBY
80
- end
81
- end
82
-
83
- def add_dummy_override
84
- example_file_path = "app/overrides/layouts/application/example.html.erb.deface"
85
- create_file example_file_path do <<-RUBY
86
- <!-- insert_bottom 'body' -->
87
- <div style='background: #FFF;text-align: center; padding: 4px 0;position: fixed;width: 100%;z-index: 9999;top: 0;'>
88
- #{NAME} active - edit/remove this file:<br/>
89
- <strong>#{PATH}/#{example_file_path}</strong><br/>
90
- <%= link_to 'deface docs', 'https://github.com/railsdog/deface', target: '_blank' %>
91
- </div>
92
- RUBY
93
- end
94
- end
95
-
96
- def add_assets_override
97
- create_file 'app/overrides/layouts/application/assets.html.erb.deface' do <<-RUBY
98
- <!-- insert_bottom 'head' -->
99
- <%= stylesheet_link_tag '#{NAME}/application' %>
100
- <%= javascript_include_tag '#{NAME}/application' %>
101
- RUBY
102
- end
103
- end
104
- end
@@ -1,11 +0,0 @@
1
- # This migration comes from social_ext (originally 20120513031021)
2
- class CreateSocialExtLikes < ActiveRecord::Migration
3
- def change
4
- create_table :social_ext_likes do |t|
5
- t.integer :post_id
6
- t.integer :user_id
7
-
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,14 +0,0 @@
1
- module SocialExt
2
- class LikesController < Chili::ApplicationController
3
-
4
- def index
5
- @likes = current_user.becomes(SocialExt::User).likes
6
- end
7
-
8
- def create
9
- @like = current_user.becomes(SocialExt::User).likes.create!(params[:like])
10
- redirect_to :back, notice: 'Post liked!'
11
- end
12
-
13
- end
14
- end
@@ -1,2 +0,0 @@
1
- <!-- insert_bottom 'head' -->
2
- <%# stylesheet_link_tag 'social_ext/application' %>
@@ -1,2 +0,0 @@
1
- <!-- insert_before '#posts' -->
2
- <%= link_to 'See Your Likes', social_ext.likes_path %>
@@ -1,4 +0,0 @@
1
- SocialExt::Engine.automount!
2
- SocialExt::Engine.routes.draw do
3
- resources :likes
4
- end
@@ -1,10 +0,0 @@
1
- class CreateSocialExtLikes < ActiveRecord::Migration
2
- def change
3
- create_table :social_ext_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
- class CreateSocialExtLikes < ActiveRecord::Migration
2
- def change
3
- create_table :chili_likes_likes do |t|
4
- t.integer :post_id
5
- t.integer :user_id
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,3 +0,0 @@
1
- = TemplateExt
2
-
3
- This project rocks and uses MIT-LICENSE.
@@ -1,3 +0,0 @@
1
- <!-- insert_bottom 'head' -->
2
- <%= stylesheet_link_tag 'template_ext/application' %>
3
- <%= javascript_include_tag 'template_ext/application' %>
@@ -1,3 +0,0 @@
1
- TemplateExt::Engine.automount!
2
- TemplateExt::Engine.routes.draw do
3
- end