chili 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -3
- data/chili.gemspec +1 -1
- data/lib/chili/version.rb +1 -1
- data/spec/dummy/blank_extension/blank_extension.gemspec +1 -1
- data/spec/dummy/example_app/app/assets/javascripts/application.js +0 -2
- data/spec/dummy/example_app/app/assets/stylesheets/scaffold.css +38 -2
- data/spec/dummy/example_app/app/controllers/application_controller.rb +2 -1
- data/spec/dummy/example_app/app/controllers/sessions_controller.rb +11 -0
- data/spec/dummy/example_app/app/views/layouts/application.html.erb +12 -2
- data/spec/dummy/example_app/app/views/posts/index.html.erb +0 -3
- data/spec/dummy/example_app/app/views/sessions/new.html.erb +5 -0
- data/spec/dummy/example_app/config/routes.rb +2 -0
- data/spec/dummy/example_app/db/migrate/20120513023840_create_users.rb +1 -1
- data/spec/dummy/example_app/db/schema.rb +3 -3
- data/spec/dummy/example_app/spec/support/user_macros.rb +8 -0
- data/spec/dummy/example_app/vendor/chili/social_extension/app/assets/javascripts/social_extension/application.js +0 -2
- data/spec/dummy/example_app/vendor/chili/social_extension/app/assets/stylesheets/social_extension/application.css.scss +0 -7
- data/spec/dummy/example_app/vendor/chili/social_extension/app/overrides/{posts/index/like_links.html.erb.deface → layouts/application/likes_link.html.erb.deface} +1 -1
- data/spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/_post/like_actions.html.erb.deface +1 -1
- data/spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/index/table_headers.html.erb.deface +2 -0
- data/spec/requests/social_extension_spec.rb +7 -7
- data/spec/spec_helper.rb +1 -1
- metadata +29 -21
data/README.md
CHANGED
@@ -7,6 +7,10 @@ If so, Chili can help.
|
|
7
7
|
Chili is built on top of Rails Engines and Deface and allows you to conditionally add new/modify existing views,
|
8
8
|
while leaving the main code untouched.
|
9
9
|
|
10
|
+
## Tutorial & Examples
|
11
|
+
|
12
|
+
- [Walkthrough of creating and releasing a new feature with Chili](http://balvig.github.com/chili/)
|
13
|
+
|
10
14
|
## Installation
|
11
15
|
|
12
16
|
First add Chili to your app's Gemfile:
|
@@ -62,9 +66,9 @@ For example, assuming the main app has the partial `app/views/posts/_post.html.e
|
|
62
66
|
|
63
67
|
### Adding new resources
|
64
68
|
|
65
|
-
Run `rails g scaffold Like` within the extension's directory. The new resource will be namespaced to `SocialExtension::Like`
|
66
|
-
and automounted in the main app at `/chili/social_extension/likes`,
|
67
|
-
|
69
|
+
Run `rails g scaffold Like` from within the extension's directory. The new resource will be namespaced to `SocialExtension::Like`
|
70
|
+
and automounted as an [isolated engine](http://railscasts.com/episodes/277-mountable-engines?view=asciicast) in the main app at `/chili/social_extension/likes`,
|
71
|
+
but will only be accessible when active_if is true.
|
68
72
|
|
69
73
|
### Migrations
|
70
74
|
|
data/chili.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["jens@balvig.com"]
|
7
7
|
gem.description = %q{The spicy extension framework}
|
8
8
|
gem.summary = %q{The spicy extension framework}
|
9
|
-
gem.homepage = "
|
9
|
+
gem.homepage = "http://balvig.github.com/chili/"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/chili/version.rb
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
17
17
|
|
18
18
|
s.add_dependency "rails", "~> 3.2.8"
|
19
|
-
s.add_dependency 'chili', '~> 0.3.
|
19
|
+
s.add_dependency 'chili', '~> 0.3.5'
|
20
20
|
|
21
21
|
s.add_development_dependency "sqlite3"
|
22
22
|
end
|
@@ -12,8 +12,8 @@ pre {
|
|
12
12
|
font-size: 11px;
|
13
13
|
}
|
14
14
|
|
15
|
-
a { color: #
|
16
|
-
a:visited { color: #
|
15
|
+
a { color: #4CAEDD; }
|
16
|
+
a:visited { color: #4CAEDD; }
|
17
17
|
a:hover { color: #fff; background-color:#000; }
|
18
18
|
|
19
19
|
div.field, div.actions {
|
@@ -54,3 +54,39 @@ div.field, div.actions {
|
|
54
54
|
font-size: 12px;
|
55
55
|
list-style: square;
|
56
56
|
}
|
57
|
+
|
58
|
+
header {
|
59
|
+
background:#DDD;
|
60
|
+
padding:8px 6px;
|
61
|
+
}
|
62
|
+
|
63
|
+
header form, header form div {
|
64
|
+
display: inline;
|
65
|
+
}
|
66
|
+
|
67
|
+
table {
|
68
|
+
border:1px solid #CCC;
|
69
|
+
border-radius:4px;
|
70
|
+
}
|
71
|
+
|
72
|
+
th {
|
73
|
+
text-align:left;
|
74
|
+
border-bottom:3px double #CCC;
|
75
|
+
}
|
76
|
+
|
77
|
+
th, td {
|
78
|
+
padding:0.8em 1.1em;
|
79
|
+
font-size: 1.1em;
|
80
|
+
}
|
81
|
+
|
82
|
+
.remark {
|
83
|
+
font-weight:normal;
|
84
|
+
font-style:italic;
|
85
|
+
color:#888;
|
86
|
+
}
|
87
|
+
|
88
|
+
.disclaimer {
|
89
|
+
background: #FFFF8B;
|
90
|
+
padding: 9px;
|
91
|
+
display: inline-block;
|
92
|
+
}
|
@@ -3,12 +3,22 @@
|
|
3
3
|
<head>
|
4
4
|
<title>Dummy</title>
|
5
5
|
<%= stylesheet_link_tag "application", :media => "all" %>
|
6
|
-
<%= javascript_include_tag "application" %>
|
6
|
+
<%= javascript_include_tag "application", '//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js', 'https://raw.github.com/rails/jquery-ujs/master/src/rails.js' %>
|
7
7
|
<%= csrf_meta_tags %>
|
8
8
|
</head>
|
9
9
|
<body>
|
10
10
|
|
11
|
-
|
11
|
+
<header>
|
12
|
+
<% if logged_in? %>
|
13
|
+
<span class="user">Hi <%= current_user.name %>. </span><%= button_to 'Log out', main_app.session_path, method: 'delete' %>
|
14
|
+
<% else %>
|
15
|
+
<%= link_to "Log in", main_app.new_session_path %>
|
16
|
+
<% end %>
|
17
|
+
</header>
|
18
|
+
|
19
|
+
<section>
|
20
|
+
<%= yield %>
|
21
|
+
</section>
|
12
22
|
|
13
23
|
</body>
|
14
24
|
</html>
|
@@ -27,10 +27,10 @@ ActiveRecord::Schema.define(:version => 20120513032032) do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
create_table "users", :force => true do |t|
|
30
|
-
t.string "name"
|
30
|
+
t.string "name", :default => "Bob"
|
31
31
|
t.boolean "admin"
|
32
|
-
t.datetime "created_at",
|
33
|
-
t.datetime "updated_at",
|
32
|
+
t.datetime "created_at", :null => false
|
33
|
+
t.datetime "updated_at", :null => false
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<!--
|
1
|
+
<!-- insert_after '.user' -->
|
2
2
|
<%= link_to 'See Your Likes', social_extension.likes_path %>
|
@@ -2,5 +2,5 @@
|
|
2
2
|
<% post.becomes(SocialExtension::Post).tap do |post| %>
|
3
3
|
<td><%= link_to 'Like!', social_extension.likes_path(like: {post_id: post}), method: :post %></td>
|
4
4
|
<td><%= pluralize post.likes.size, 'like' %></td>
|
5
|
-
<td><%= post.well_liked? ? 'This post is well liked!' : 'This post is boring...' %></td>
|
5
|
+
<td class='remark'><%= post.well_liked? ? 'This post is well liked!' : 'This post is boring...' %></td>
|
6
6
|
<% end %>
|
@@ -2,27 +2,27 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
feature 'View overrides' do
|
4
4
|
scenario 'when user is not admin active_if toggles overrides off' do
|
5
|
-
User.create!
|
5
|
+
login User.create!
|
6
6
|
visit('/posts')
|
7
7
|
page.should_not have_content('See Your Likes')
|
8
8
|
page.should_not have_content('Like functionality is in beta')
|
9
9
|
end
|
10
10
|
|
11
11
|
scenario 'when admin active_if toggles overrides on' do
|
12
|
-
User.create!(admin: true)
|
12
|
+
login User.create!(admin: true)
|
13
13
|
visit('/posts')
|
14
14
|
page.should have_content('See Your Likes')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
feature 'Togglable controllers' do
|
19
|
-
scenario 'when user is not admin active_if hides
|
20
|
-
User.create!
|
19
|
+
scenario 'when user is not admin active_if hides extension controller' do
|
20
|
+
login User.create!
|
21
21
|
expect { visit('/chili/social_extension/likes') }.to raise_error(ActionController::RoutingError)
|
22
22
|
end
|
23
23
|
|
24
|
-
scenario 'when admin active_if
|
25
|
-
User.create!(admin: true)
|
24
|
+
scenario 'when admin active_if makes extension controller available' do
|
25
|
+
login User.create!(admin: true)
|
26
26
|
visit('/chili/social_extension/likes')
|
27
27
|
page.should have_content('Your Likes')
|
28
28
|
end
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
feature 'Multiple chili extensions' do
|
32
32
|
scenario 'multiple overrides do not redefine each other' do
|
33
|
-
User.create!(admin: true)
|
33
|
+
login User.create!(admin: true)
|
34
34
|
visit('/posts')
|
35
35
|
page.should have_content('Like functionality is in beta')
|
36
36
|
page.should have_content('Invite functionality is also in beta')
|
data/spec/spec_helper.rb
CHANGED
@@ -23,5 +23,5 @@ RSpec.configure do |config|
|
|
23
23
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
24
|
# examples within a transaction, remove the following line or assign false
|
25
25
|
# instead of true.
|
26
|
-
|
26
|
+
config.use_transactional_fixtures = true
|
27
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chili
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70314269414460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70314269414460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: deface
|
27
|
-
requirement: &
|
27
|
+
requirement: &70314269422480 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0.rc1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70314269422480
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70314269432180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.9.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70314269432180
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec-rails
|
49
|
-
requirement: &
|
49
|
+
requirement: &70314269456920 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.9.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70314269456920
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jquery-rails
|
60
|
-
requirement: &
|
60
|
+
requirement: &70314269475560 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70314269475560
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: capybara
|
71
|
-
requirement: &
|
71
|
+
requirement: &70314273098540 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70314273098540
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: sqlite3
|
82
|
-
requirement: &
|
82
|
+
requirement: &70314273094860 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70314273094860
|
91
91
|
description: The spicy extension framework
|
92
92
|
email:
|
93
93
|
- jens@balvig.com
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- spec/dummy/example_app/app/assets/stylesheets/users.css
|
138
138
|
- spec/dummy/example_app/app/controllers/application_controller.rb
|
139
139
|
- spec/dummy/example_app/app/controllers/posts_controller.rb
|
140
|
+
- spec/dummy/example_app/app/controllers/sessions_controller.rb
|
140
141
|
- spec/dummy/example_app/app/controllers/users_controller.rb
|
141
142
|
- spec/dummy/example_app/app/helpers/application_helper.rb
|
142
143
|
- spec/dummy/example_app/app/helpers/posts_helper.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- spec/dummy/example_app/app/views/posts/index.html.erb
|
153
154
|
- spec/dummy/example_app/app/views/posts/new.html.erb
|
154
155
|
- spec/dummy/example_app/app/views/posts/show.html.erb
|
156
|
+
- spec/dummy/example_app/app/views/sessions/new.html.erb
|
155
157
|
- spec/dummy/example_app/app/views/users/_form.html.erb
|
156
158
|
- spec/dummy/example_app/app/views/users/edit.html.erb
|
157
159
|
- spec/dummy/example_app/app/views/users/index.html.erb
|
@@ -184,6 +186,7 @@ files:
|
|
184
186
|
- spec/dummy/example_app/public/500.html
|
185
187
|
- spec/dummy/example_app/public/favicon.ico
|
186
188
|
- spec/dummy/example_app/script/rails
|
189
|
+
- spec/dummy/example_app/spec/support/user_macros.rb
|
187
190
|
- spec/dummy/example_app/vendor/chili/invites_extension/.gitignore
|
188
191
|
- spec/dummy/example_app/vendor/chili/invites_extension/app/assets/images/invites_extension/.gitkeep
|
189
192
|
- spec/dummy/example_app/vendor/chili/invites_extension/app/assets/javascripts/invites_extension/application.js
|
@@ -199,9 +202,10 @@ files:
|
|
199
202
|
- spec/dummy/example_app/vendor/chili/social_extension/app/models/social_extension/like.rb
|
200
203
|
- spec/dummy/example_app/vendor/chili/social_extension/app/models/social_extension/post.rb
|
201
204
|
- spec/dummy/example_app/vendor/chili/social_extension/app/models/social_extension/user.rb
|
205
|
+
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/layouts/application/likes_link.html.erb.deface
|
202
206
|
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/_post/like_actions.html.erb.deface
|
203
207
|
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/index/disclaimer.html.erb.deface
|
204
|
-
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/index/
|
208
|
+
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/index/table_headers.html.erb.deface
|
205
209
|
- spec/dummy/example_app/vendor/chili/social_extension/app/views/social_extension/likes/index.html.erb
|
206
210
|
- spec/dummy/example_app/vendor/chili/social_extension/config/routes.rb
|
207
211
|
- spec/dummy/example_app/vendor/chili/social_extension/db/migrate/20120513031021_create_likes_extension_likes.rb
|
@@ -211,7 +215,7 @@ files:
|
|
211
215
|
- spec/lib/chili/activatable_spec.rb
|
212
216
|
- spec/requests/social_extension_spec.rb
|
213
217
|
- spec/spec_helper.rb
|
214
|
-
homepage:
|
218
|
+
homepage: http://balvig.github.com/chili/
|
215
219
|
licenses: []
|
216
220
|
post_install_message:
|
217
221
|
rdoc_options: []
|
@@ -225,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
229
|
version: '0'
|
226
230
|
segments:
|
227
231
|
- 0
|
228
|
-
hash:
|
232
|
+
hash: 1370491786989256238
|
229
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
234
|
none: false
|
231
235
|
requirements:
|
@@ -234,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
238
|
version: '0'
|
235
239
|
segments:
|
236
240
|
- 0
|
237
|
-
hash:
|
241
|
+
hash: 1370491786989256238
|
238
242
|
requirements: []
|
239
243
|
rubyforge_project:
|
240
244
|
rubygems_version: 1.8.11
|
@@ -265,6 +269,7 @@ test_files:
|
|
265
269
|
- spec/dummy/example_app/app/assets/stylesheets/users.css
|
266
270
|
- spec/dummy/example_app/app/controllers/application_controller.rb
|
267
271
|
- spec/dummy/example_app/app/controllers/posts_controller.rb
|
272
|
+
- spec/dummy/example_app/app/controllers/sessions_controller.rb
|
268
273
|
- spec/dummy/example_app/app/controllers/users_controller.rb
|
269
274
|
- spec/dummy/example_app/app/helpers/application_helper.rb
|
270
275
|
- spec/dummy/example_app/app/helpers/posts_helper.rb
|
@@ -280,6 +285,7 @@ test_files:
|
|
280
285
|
- spec/dummy/example_app/app/views/posts/index.html.erb
|
281
286
|
- spec/dummy/example_app/app/views/posts/new.html.erb
|
282
287
|
- spec/dummy/example_app/app/views/posts/show.html.erb
|
288
|
+
- spec/dummy/example_app/app/views/sessions/new.html.erb
|
283
289
|
- spec/dummy/example_app/app/views/users/_form.html.erb
|
284
290
|
- spec/dummy/example_app/app/views/users/edit.html.erb
|
285
291
|
- spec/dummy/example_app/app/views/users/index.html.erb
|
@@ -312,6 +318,7 @@ test_files:
|
|
312
318
|
- spec/dummy/example_app/public/500.html
|
313
319
|
- spec/dummy/example_app/public/favicon.ico
|
314
320
|
- spec/dummy/example_app/script/rails
|
321
|
+
- spec/dummy/example_app/spec/support/user_macros.rb
|
315
322
|
- spec/dummy/example_app/vendor/chili/invites_extension/.gitignore
|
316
323
|
- spec/dummy/example_app/vendor/chili/invites_extension/app/assets/images/invites_extension/.gitkeep
|
317
324
|
- spec/dummy/example_app/vendor/chili/invites_extension/app/assets/javascripts/invites_extension/application.js
|
@@ -327,9 +334,10 @@ test_files:
|
|
327
334
|
- spec/dummy/example_app/vendor/chili/social_extension/app/models/social_extension/like.rb
|
328
335
|
- spec/dummy/example_app/vendor/chili/social_extension/app/models/social_extension/post.rb
|
329
336
|
- spec/dummy/example_app/vendor/chili/social_extension/app/models/social_extension/user.rb
|
337
|
+
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/layouts/application/likes_link.html.erb.deface
|
330
338
|
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/_post/like_actions.html.erb.deface
|
331
339
|
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/index/disclaimer.html.erb.deface
|
332
|
-
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/index/
|
340
|
+
- spec/dummy/example_app/vendor/chili/social_extension/app/overrides/posts/index/table_headers.html.erb.deface
|
333
341
|
- spec/dummy/example_app/vendor/chili/social_extension/app/views/social_extension/likes/index.html.erb
|
334
342
|
- spec/dummy/example_app/vendor/chili/social_extension/config/routes.rb
|
335
343
|
- spec/dummy/example_app/vendor/chili/social_extension/db/migrate/20120513031021_create_likes_extension_likes.rb
|