chili 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.gitignore +5 -3
  2. data/Gemfile +1 -0
  3. data/README.md +37 -45
  4. data/chili.gemspec +7 -0
  5. data/lib/chili/template.rb +19 -5
  6. data/lib/chili/version.rb +1 -1
  7. data/spec/dummy/chili_likes/app/assets/images/chili_likes/.gitkeep +0 -0
  8. data/spec/dummy/chili_likes/app/assets/javascripts/chili_likes/application.js +15 -0
  9. data/spec/dummy/chili_likes/app/assets/stylesheets/chili_likes/application.css.scss +7 -0
  10. data/spec/dummy/chili_likes/app/controllers/chili_likes/likes_controller.rb +14 -0
  11. data/spec/dummy/chili_likes/app/models/chili_likes/like.rb +7 -0
  12. data/spec/dummy/chili_likes/app/models/chili_likes/post.rb +9 -0
  13. data/spec/dummy/chili_likes/app/models/chili_likes/user.rb +5 -0
  14. data/spec/dummy/chili_likes/app/overrides/layouts/application/chili_likes.html.erb.deface +2 -0
  15. data/spec/dummy/chili_likes/app/overrides/posts/_post/chili_likes.html.erb.deface +6 -0
  16. data/spec/dummy/chili_likes/app/overrides/posts/index/chili_likes.html.erb.deface +2 -0
  17. data/spec/dummy/chili_likes/app/views/chili_likes/likes/index.html.erb +9 -0
  18. data/spec/dummy/chili_likes/config/routes.rb +4 -0
  19. data/spec/dummy/chili_likes/db/migrate/20120513031021_create_chili_likes_likes.rb +10 -0
  20. data/spec/dummy/chili_likes/lib/chili_likes.rb +7 -0
  21. data/spec/dummy/chili_likes/lib/chili_likes/engine.rb +10 -0
  22. data/spec/dummy/main_app/README.rdoc +261 -0
  23. data/spec/dummy/main_app/Rakefile +7 -0
  24. data/spec/dummy/main_app/app/assets/javascripts/application.js +2 -0
  25. data/spec/dummy/main_app/app/assets/stylesheets/application.css +13 -0
  26. data/spec/dummy/main_app/app/assets/stylesheets/posts.css +4 -0
  27. data/spec/dummy/main_app/app/assets/stylesheets/scaffold.css +56 -0
  28. data/spec/dummy/main_app/app/assets/stylesheets/users.css +4 -0
  29. data/spec/dummy/main_app/app/controllers/application_controller.rb +11 -0
  30. data/spec/dummy/main_app/app/controllers/posts_controller.rb +83 -0
  31. data/spec/dummy/main_app/app/controllers/users_controller.rb +83 -0
  32. data/spec/dummy/main_app/app/helpers/application_helper.rb +2 -0
  33. data/spec/dummy/main_app/app/helpers/posts_helper.rb +2 -0
  34. data/spec/dummy/main_app/app/helpers/users_helper.rb +2 -0
  35. data/spec/dummy/main_app/app/mailers/.gitkeep +0 -0
  36. data/spec/dummy/main_app/app/models/.gitkeep +0 -0
  37. data/spec/dummy/main_app/app/models/post.rb +3 -0
  38. data/spec/dummy/main_app/app/models/user.rb +3 -0
  39. data/spec/dummy/main_app/app/views/layouts/application.html.erb +14 -0
  40. data/spec/dummy/main_app/app/views/posts/_form.html.erb +21 -0
  41. data/spec/dummy/main_app/app/views/posts/_post.html.erb +3 -0
  42. data/spec/dummy/main_app/app/views/posts/edit.html.erb +6 -0
  43. data/spec/dummy/main_app/app/views/posts/index.html.erb +16 -0
  44. data/spec/dummy/main_app/app/views/posts/new.html.erb +5 -0
  45. data/spec/dummy/main_app/app/views/posts/show.html.erb +10 -0
  46. data/spec/dummy/main_app/app/views/users/_form.html.erb +21 -0
  47. data/spec/dummy/main_app/app/views/users/edit.html.erb +6 -0
  48. data/spec/dummy/main_app/app/views/users/index.html.erb +23 -0
  49. data/spec/dummy/main_app/app/views/users/new.html.erb +5 -0
  50. data/spec/dummy/main_app/app/views/users/show.html.erb +10 -0
  51. data/spec/dummy/main_app/config.ru +4 -0
  52. data/spec/dummy/main_app/config/application.rb +57 -0
  53. data/spec/dummy/main_app/config/boot.rb +11 -0
  54. data/spec/dummy/main_app/config/database.yml +25 -0
  55. data/spec/dummy/main_app/config/environment.rb +5 -0
  56. data/spec/dummy/main_app/config/environments/development.rb +37 -0
  57. data/spec/dummy/main_app/config/environments/production.rb +67 -0
  58. data/spec/dummy/main_app/config/environments/test.rb +37 -0
  59. data/spec/dummy/main_app/config/initializers/backtrace_silencers.rb +7 -0
  60. data/spec/dummy/main_app/config/initializers/inflections.rb +15 -0
  61. data/spec/dummy/main_app/config/initializers/mime_types.rb +5 -0
  62. data/spec/dummy/main_app/config/initializers/secret_token.rb +7 -0
  63. data/spec/dummy/main_app/config/initializers/session_store.rb +8 -0
  64. data/spec/dummy/main_app/config/initializers/wrap_parameters.rb +14 -0
  65. data/spec/dummy/main_app/config/locales/en.yml +5 -0
  66. data/spec/dummy/main_app/config/routes.rb +6 -0
  67. data/spec/dummy/main_app/db/migrate/20120513023816_create_posts.rb +9 -0
  68. data/spec/dummy/main_app/db/migrate/20120513023840_create_users.rb +9 -0
  69. data/spec/dummy/main_app/db/migrate/20120513032032_create_chili_likes_likes.chili_likes.rb +11 -0
  70. data/spec/dummy/main_app/db/schema.rb +36 -0
  71. data/spec/dummy/main_app/lib/assets/.gitkeep +0 -0
  72. data/spec/dummy/main_app/log/.gitkeep +0 -0
  73. data/spec/dummy/main_app/public/404.html +26 -0
  74. data/spec/dummy/main_app/public/422.html +26 -0
  75. data/spec/dummy/main_app/public/500.html +25 -0
  76. data/spec/dummy/main_app/public/favicon.ico +0 -0
  77. data/spec/dummy/main_app/script/rails +6 -0
  78. data/spec/lib/chili/activatable_spec.rb +21 -0
  79. data/spec/requests/chili_likes_spec.rb +28 -0
  80. data/spec/spec_helper.rb +27 -0
  81. metadata +255 -5
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,2 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,11 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+
4
+ def current_user
5
+ User.last
6
+ end
7
+
8
+ def logged_in?
9
+ current_user
10
+ end
11
+ end
@@ -0,0 +1,83 @@
1
+ class PostsController < ApplicationController
2
+ # GET /posts
3
+ # GET /posts.json
4
+ def index
5
+ @posts = Post.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @posts }
10
+ end
11
+ end
12
+
13
+ # GET /posts/1
14
+ # GET /posts/1.json
15
+ def show
16
+ @post = Post.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @post }
21
+ end
22
+ end
23
+
24
+ # GET /posts/new
25
+ # GET /posts/new.json
26
+ def new
27
+ @post = Post.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @post }
32
+ end
33
+ end
34
+
35
+ # GET /posts/1/edit
36
+ def edit
37
+ @post = Post.find(params[:id])
38
+ end
39
+
40
+ # POST /posts
41
+ # POST /posts.json
42
+ def create
43
+ @post = Post.new(params[:post])
44
+
45
+ respond_to do |format|
46
+ if @post.save
47
+ format.html { redirect_to @post, notice: 'Post was successfully created.' }
48
+ format.json { render json: @post, status: :created, location: @post }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @post.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /posts/1
57
+ # PUT /posts/1.json
58
+ def update
59
+ @post = Post.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @post.update_attributes(params[:post])
63
+ format.html { redirect_to @post, notice: 'Post was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @post.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /posts/1
73
+ # DELETE /posts/1.json
74
+ def destroy
75
+ @post = Post.find(params[:id])
76
+ @post.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to posts_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,83 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.json
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.json
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.json
26
+ def new
27
+ @user = User.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @user }
32
+ end
33
+ end
34
+
35
+ # GET /users/1/edit
36
+ def edit
37
+ @user = User.find(params[:id])
38
+ end
39
+
40
+ # POST /users
41
+ # POST /users.json
42
+ def create
43
+ @user = User.new(params[:user])
44
+
45
+ respond_to do |format|
46
+ if @user.save
47
+ format.html { redirect_to @user, notice: 'User was successfully created.' }
48
+ format.json { render json: @user, status: :created, location: @user }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @user.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /users/1
57
+ # PUT /users/1.json
58
+ def update
59
+ @user = User.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @user.update_attributes(params[:user])
63
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @user.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /users/1
73
+ # DELETE /users/1.json
74
+ def destroy
75
+ @user = User.find(params[:id])
76
+ @user.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to users_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PostsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class Post < ActiveRecord::Base
2
+ attr_accessible :title
3
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ attr_accessible :name, :admin
3
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,21 @@
1
+ <%= form_for(@post) do |f| %>
2
+ <% if @post.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @post.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title %><br />
16
+ <%= f.text_field :title %>
17
+ </div>
18
+ <div class="actions">
19
+ <%= f.submit %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <tr>
2
+ <td><%= post.title %></td>
3
+ </tr>
@@ -0,0 +1,6 @@
1
+ <h1>Editing post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @post %> |
6
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,16 @@
1
+ <h1>Listing posts</h1>
2
+
3
+ <table id='posts'>
4
+ <tr>
5
+ <th>Title</th>
6
+ <th></th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+
11
+ <%= render @posts %>
12
+ </table>
13
+
14
+ <br />
15
+
16
+ <%= link_to 'New Post', new_post_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,10 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Title:</b>
5
+ <%= @post.title %>
6
+ </p>
7
+
8
+
9
+ <%= link_to 'Edit', edit_post_path(@post) %> |
10
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,21 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="actions">
19
+ <%= f.submit %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,23 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th></th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+
11
+ <% @users.each do |user| %>
12
+ <tr>
13
+ <td><%= user.name %></td>
14
+ <td><%= link_to 'Show', user %></td>
15
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
16
+ <td><%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %></td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'New User', new_user_path %>