chili 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/README.md +12 -8
- data/chili.gemspec +2 -0
- data/lib/chili.rb +1 -0
- data/lib/chili/template.rb +13 -10
- data/lib/chili/version.rb +1 -1
- metadata +27 -16
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -9,9 +9,9 @@ while leaving the main code untouched.
|
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
Install Chili on your system (not in your app
|
12
|
+
Install Chili on your system (not in your app):
|
13
13
|
|
14
|
-
gem install chili
|
14
|
+
$ gem install chili
|
15
15
|
|
16
16
|
## Usage
|
17
17
|
|
@@ -21,13 +21,13 @@ Just like engines chili extensions are like mini apps that are created separatel
|
|
21
21
|
|
22
22
|
Assuming you want to add a new extension that adds exposes a new social feature such as a "like" button feature to a subset of users, first run:
|
23
23
|
|
24
|
-
chili social # social is the name of the extension
|
24
|
+
$ chili social # social is the name of the extension
|
25
25
|
|
26
26
|
This is basically a shortcut for running the `rails plugin new` engine generator with a custom template and will:
|
27
27
|
|
28
28
|
1. Create a directory named chili_social containing the basic structure for the extension
|
29
29
|
2. Clone the app you are adding the extension to as a submodule into chili_social/main_app
|
30
|
-
3. Add a reference to the
|
30
|
+
3. Add a reference to the extension to the main app gemfile for development/testing
|
31
31
|
|
32
32
|
### Define who can see the extension
|
33
33
|
|
@@ -66,7 +66,7 @@ Create a model with the same name as the one you want to modify: `rails g model
|
|
66
66
|
and inherit from the original:
|
67
67
|
|
68
68
|
```ruby
|
69
|
-
# app/
|
69
|
+
# app/models/chili_social/user.rb
|
70
70
|
module ChiliSocial
|
71
71
|
class User < ::User
|
72
72
|
has_many :likes
|
@@ -99,13 +99,17 @@ Add files as usual in `app/assets/chili_social/javascripts|stylesheets` and inje
|
|
99
99
|
|
100
100
|
## Roadmap
|
101
101
|
|
102
|
+
### Missing features
|
103
|
+
|
104
|
+
- Running any rails command (rails server, bundle etc) should run the command in the main app directory
|
105
|
+
- Docs for releasing to production
|
106
|
+
- Docs for running tests
|
107
|
+
|
102
108
|
### Current Issues
|
103
109
|
|
104
|
-
- Can only have one override per engine per partial due to the way I'm grabbing the class from the override
|
105
110
|
- Haven't found a good way to modify existing controller actions
|
106
|
-
- Need to use DSL branch from deface
|
107
111
|
|
108
112
|
### Minor niggles
|
109
113
|
|
110
|
-
- Have to add gemspec to main app
|
111
114
|
- Request specs don't have access to path helpers
|
115
|
+
- Generated specs don't namespace properly
|
data/chili.gemspec
CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Chili::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency "rails", "~> 3.2"
|
19
|
+
gem.add_dependency "deface", "~> 0.9"
|
20
|
+
|
19
21
|
gem.add_development_dependency 'rspec', '~> 2.9.0'
|
20
22
|
gem.add_development_dependency 'rspec-rails', '~> 2.9.0'
|
21
23
|
gem.add_development_dependency 'jquery-rails'
|
data/lib/chili.rb
CHANGED
data/lib/chili/template.rb
CHANGED
@@ -6,14 +6,8 @@ if main_app_git_repo.present?
|
|
6
6
|
run "cd #{destination_root} && git submodule add #{main_app_git_repo} main_app"
|
7
7
|
end
|
8
8
|
|
9
|
-
# Add
|
10
|
-
append_to_file "main_app/Gemfile"
|
11
|
-
|
12
|
-
# Chili dev dependencies
|
13
|
-
gemspec path: '../'
|
14
|
-
gem 'deface', github: 'railsdog/deface'
|
15
|
-
RUBY
|
16
|
-
end
|
9
|
+
# Add gem to main app Gemfile
|
10
|
+
append_to_file "main_app/Gemfile", "gem '#{app_path}', path: '../' # git: '...'"
|
17
11
|
|
18
12
|
# Uses Chili::ApplicationController and the layout from the main app
|
19
13
|
remove_dir "app/controllers/#{app_path}"
|
@@ -32,6 +26,10 @@ require 'chili/tasks'
|
|
32
26
|
RUBY
|
33
27
|
end
|
34
28
|
|
29
|
+
# Remove jquery stuff from application.js
|
30
|
+
gsub_file "app/assets/javascripts/#{app_path}/application.js", "//= require jquery_ujs\n", ''
|
31
|
+
gsub_file "app/assets/javascripts/#{app_path}/application.js", "//= require jquery\n", ''
|
32
|
+
|
35
33
|
# Setup custom generator
|
36
34
|
inject_into_file "lib/#{app_path}/engine.rb", :after => "isolate_namespace #{app_path.camelcase}\n" do <<-RUBY
|
37
35
|
config.generators do |g|
|
@@ -70,16 +68,21 @@ inject_into_file "lib/#{app_path}/engine.rb", :after => " g.scaffold_controller
|
|
70
68
|
RUBY
|
71
69
|
end
|
72
70
|
|
71
|
+
# Edit .gitignore
|
72
|
+
gsub_file ".gitignore", /test\/dummy.*\n/, ''
|
73
|
+
|
73
74
|
# Automount engine
|
74
75
|
prepend_to_file 'config/routes.rb', "#{app_path.camelcase}::Engine.automount!\n"
|
75
76
|
|
76
77
|
# Include chili libs
|
78
|
+
require File.expand_path('../version', __FILE__)
|
79
|
+
|
77
80
|
prepend_to_file "lib/#{app_path}.rb" do <<-RUBY
|
78
81
|
require "chili"
|
79
82
|
RUBY
|
80
83
|
end
|
81
84
|
|
82
|
-
gsub_file "#{app_path}.gemspec", '# s.add_dependency "jquery-rails"',
|
85
|
+
gsub_file "#{app_path}.gemspec", '# s.add_dependency "jquery-rails"', "s.add_dependency 'chili', '~> #{Chili::VERSION}'"
|
83
86
|
|
84
87
|
# Include active_if
|
85
88
|
inject_into_file "lib/#{app_path}.rb", :after => "module #{app_path.camelcase}\n" do <<-RUBY
|
@@ -89,7 +92,7 @@ RUBY
|
|
89
92
|
end
|
90
93
|
|
91
94
|
# Add dummy override
|
92
|
-
example_file_path = "app/overrides/layouts/application
|
95
|
+
example_file_path = "app/overrides/layouts/application/example.html.erb.deface"
|
93
96
|
create_file example_file_path do <<-RUBY
|
94
97
|
<!-- insert_bottom 'body' -->
|
95
98
|
<div style='background: #FFF;text-align: center; padding: 4px 0;position: fixed;width: 100%;z-index: 9999;top: 0;'>
|
data/lib/chili/version.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.8
|
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-05-
|
12
|
+
date: 2012-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70101475238260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,21 @@ dependencies:
|
|
21
21
|
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70101475238260
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: deface
|
27
|
+
requirement: &70101475237760 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.9'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70101475237760
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: rspec
|
27
|
-
requirement: &
|
38
|
+
requirement: &70101475237300 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ~>
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: 2.9.0
|
33
44
|
type: :development
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70101475237300
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: rspec-rails
|
38
|
-
requirement: &
|
49
|
+
requirement: &70101475236840 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ~>
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: 2.9.0
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70101475236840
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: jquery-rails
|
49
|
-
requirement: &
|
60
|
+
requirement: &70101475252800 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,10 +65,10 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70101475252800
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: capybara
|
60
|
-
requirement: &
|
71
|
+
requirement: &70101475252300 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ! '>='
|
@@ -65,10 +76,10 @@ dependencies:
|
|
65
76
|
version: '0'
|
66
77
|
type: :development
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *70101475252300
|
69
80
|
- !ruby/object:Gem::Dependency
|
70
81
|
name: sqlite3
|
71
|
-
requirement: &
|
82
|
+
requirement: &70101475251760 !ruby/object:Gem::Requirement
|
72
83
|
none: false
|
73
84
|
requirements:
|
74
85
|
- - ! '>='
|
@@ -76,7 +87,7 @@ dependencies:
|
|
76
87
|
version: '0'
|
77
88
|
type: :development
|
78
89
|
prerelease: false
|
79
|
-
version_requirements: *
|
90
|
+
version_requirements: *70101475251760
|
80
91
|
description: The spicy extension framework (work in progress)
|
81
92
|
email:
|
82
93
|
- jens@balvig.com
|
@@ -192,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
203
|
version: '0'
|
193
204
|
segments:
|
194
205
|
- 0
|
195
|
-
hash:
|
206
|
+
hash: 4520049109413080519
|
196
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
208
|
none: false
|
198
209
|
requirements:
|
@@ -201,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
212
|
version: '0'
|
202
213
|
segments:
|
203
214
|
- 0
|
204
|
-
hash:
|
215
|
+
hash: 4520049109413080519
|
205
216
|
requirements: []
|
206
217
|
rubyforge_project:
|
207
218
|
rubygems_version: 1.8.11
|