chili 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +6 -5
- data/README.md +28 -30
- data/Rakefile +2 -2
- data/bin/chili +1 -1
- data/lib/chili/tasks.rb +0 -4
- data/lib/chili/template.rb +15 -51
- data/lib/chili/version.rb +1 -1
- data/spec/bin/chili_spec.rb +9 -8
- data/spec/dummy/{main_app → example}/README.rdoc +0 -0
- data/spec/dummy/{main_app → example}/Rakefile +0 -0
- data/spec/dummy/{main_app → example}/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/{chili_template/app/assets/stylesheets/chili_template → example/app/assets/stylesheets}/application.css +0 -0
- data/spec/dummy/{main_app → example}/app/assets/stylesheets/posts.css +0 -0
- data/spec/dummy/{main_app → example}/app/assets/stylesheets/scaffold.css +0 -0
- data/spec/dummy/{main_app → example}/app/assets/stylesheets/users.css +0 -0
- data/spec/dummy/{main_app → example}/app/controllers/application_controller.rb +0 -0
- data/spec/dummy/{main_app → example}/app/controllers/posts_controller.rb +0 -0
- data/spec/dummy/{main_app → example}/app/controllers/users_controller.rb +0 -0
- data/spec/dummy/{main_app → example}/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/{main_app → example}/app/helpers/posts_helper.rb +0 -0
- data/spec/dummy/{main_app → example}/app/helpers/users_helper.rb +0 -0
- data/spec/dummy/{chili_social/app/assets/images/chili_social → example/app/mailers}/.gitkeep +0 -0
- data/spec/dummy/{chili_template/app/assets/images/chili_template → example/app/models}/.gitkeep +0 -0
- data/spec/dummy/{main_app → example}/app/models/post.rb +0 -0
- data/spec/dummy/{main_app → example}/app/models/user.rb +0 -0
- data/spec/dummy/{main_app → example}/app/views/layouts/application.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/posts/_form.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/posts/_post.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/posts/edit.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/posts/index.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/posts/new.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/posts/show.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/users/_form.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/users/edit.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/users/index.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/users/new.html.erb +0 -0
- data/spec/dummy/{main_app → example}/app/views/users/show.html.erb +0 -0
- data/spec/dummy/{main_app → example}/config.ru +0 -0
- data/spec/dummy/{main_app → example}/config/application.rb +0 -0
- data/spec/dummy/{main_app → example}/config/boot.rb +1 -1
- data/spec/dummy/{main_app → example}/config/database.yml +0 -0
- data/spec/dummy/{main_app → example}/config/environment.rb +0 -0
- data/spec/dummy/{main_app → example}/config/environments/development.rb +0 -0
- data/spec/dummy/{main_app → example}/config/environments/production.rb +0 -0
- data/spec/dummy/{main_app → example}/config/environments/test.rb +0 -0
- data/spec/dummy/{main_app → example}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/{main_app → example}/config/initializers/inflections.rb +0 -0
- data/spec/dummy/{main_app → example}/config/initializers/mime_types.rb +0 -0
- data/spec/dummy/{main_app → example}/config/initializers/secret_token.rb +0 -0
- data/spec/dummy/{main_app → example}/config/initializers/session_store.rb +0 -0
- data/spec/dummy/{main_app → example}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/dummy/{main_app → example}/config/locales/en.yml +0 -0
- data/spec/dummy/{main_app → example}/config/routes.rb +0 -0
- data/spec/dummy/{main_app → example}/db/migrate/20120513023816_create_posts.rb +0 -0
- data/spec/dummy/{main_app → example}/db/migrate/20120513023840_create_users.rb +0 -0
- data/spec/dummy/{main_app → example}/db/migrate/20120513032032_create_chili_social_likes.chili_likes.rb +0 -0
- data/spec/dummy/{main_app → example}/db/schema.rb +0 -0
- data/spec/dummy/{main_app/app/mailers → example/lib/assets}/.gitkeep +0 -0
- data/spec/dummy/{main_app/app/models → example/log}/.gitkeep +0 -0
- data/spec/dummy/{main_app → example}/public/404.html +0 -0
- data/spec/dummy/{main_app → example}/public/422.html +0 -0
- data/spec/dummy/{main_app → example}/public/500.html +0 -0
- data/spec/dummy/{main_app → example}/public/favicon.ico +0 -0
- data/spec/dummy/{main_app → example}/script/rails +0 -0
- data/spec/dummy/{main_app/lib/assets → example/vendor/chili_social/app/assets/images/chili_social}/.gitkeep +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/assets/javascripts/chili_social/application.js +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/assets/stylesheets/chili_social/application.css.scss +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/controllers/chili_social/likes_controller.rb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/models/chili_social/like.rb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/models/chili_social/post.rb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/models/chili_social/user.rb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/overrides/layouts/application/stylesheets.html.erb.deface +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/overrides/posts/_post/like_actions.html.erb.deface +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/overrides/posts/index/disclaimer.html.erb.deface +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/overrides/posts/index/like_links.html.erb.deface +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/app/views/chili_social/likes/index.html.erb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/config/routes.rb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/db/migrate/20120513031021_create_chili_likes_likes.rb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/lib/chili_social.rb +0 -0
- data/spec/dummy/{chili_social → example/vendor/chili_social}/lib/chili_social/engine.rb +0 -0
- data/spec/dummy/{chili_template → template}/MIT-LICENSE +0 -0
- data/spec/dummy/{chili_template → template}/README.rdoc +0 -0
- data/spec/dummy/{main_app/log → template/app/assets/images/chili_template}/.gitkeep +0 -0
- data/spec/dummy/{chili_template → template}/app/assets/javascripts/chili_template/application.js +0 -0
- data/spec/dummy/{main_app/app/assets/stylesheets → template/app/assets/stylesheets/chili_template}/application.css +0 -0
- data/spec/dummy/{chili_template → template}/app/overrides/layouts/application/example.html.erb.deface +1 -1
- data/spec/dummy/{chili_template → template}/chili_template.gemspec +3 -3
- data/spec/dummy/{chili_template → template}/config/routes.rb +0 -0
- data/spec/dummy/{chili_template → template}/lib/chili_template.rb +0 -0
- data/spec/dummy/{chili_template → template}/lib/chili_template/engine.rb +0 -0
- data/spec/dummy/{chili_template → template}/lib/chili_template/version.rb +0 -0
- data/spec/dummy/{chili_template → template}/lib/tasks/chili_template_tasks.rake +0 -0
- data/spec/dummy/{chili_template → template}/script/rails +0 -0
- data/spec/spec_helper.rb +1 -1
- metadata +189 -228
- data/spec/dummy/chili_template/Rakefile +0 -6
- data/spec/dummy/chili_template/spec/spec_helper.rb +0 -11
data/.gitignore
CHANGED
|
@@ -12,10 +12,11 @@ lib/bundler/man
|
|
|
12
12
|
pkg
|
|
13
13
|
rdoc
|
|
14
14
|
spec/reports
|
|
15
|
-
spec/dummy/
|
|
16
|
-
spec/dummy/
|
|
17
|
-
spec/dummy/
|
|
18
|
-
spec/dummy/
|
|
19
|
-
spec/
|
|
15
|
+
spec/dummy/example/db/*.sqlite3
|
|
16
|
+
spec/dummy/example/log/*.log
|
|
17
|
+
spec/dummy/example/tmp/
|
|
18
|
+
spec/dummy/example/.sass-cache
|
|
19
|
+
spec/dummy/example/vendor/chili_template
|
|
20
|
+
spec/dummy/example/Gemfile
|
|
20
21
|
tmp
|
|
21
22
|
.DS_Store
|
data/README.md
CHANGED
|
@@ -9,26 +9,32 @@ while leaving the main code untouched.
|
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
First add chili to your app's Gemfile:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'chili'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
...and run `bundle`.
|
|
15
19
|
|
|
16
20
|
## Usage
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
Chili extensions are like mini apps that are created inside your main app's vendor directory using using the "chili" command.
|
|
19
23
|
|
|
20
24
|
### Creating a new chili extension
|
|
21
25
|
|
|
22
|
-
As an example, assuming you want to add a new extension named "social" that exposes a new social feature in the form of a like-button
|
|
23
|
-
to a subset of users, first run:
|
|
26
|
+
As an example, assuming you want to add a new extension named "social" that exposes a new social feature in the form of a like-button
|
|
27
|
+
to a subset of users, first run within your main app:
|
|
24
28
|
|
|
25
29
|
$ chili social
|
|
26
30
|
|
|
27
31
|
This is basically a shortcut for running the `rails plugin new` engine generator with a custom template and will:
|
|
28
32
|
|
|
29
|
-
1. Create a directory
|
|
30
|
-
2.
|
|
31
|
-
|
|
33
|
+
1. Create a the directory vendor/chili_social containing the basic structure for the extension
|
|
34
|
+
2. Add a reference to the extension to the main app gemfile
|
|
35
|
+
|
|
36
|
+
Since the extension is mounted as a gem you'll have to run `bundle`
|
|
37
|
+
after this.
|
|
32
38
|
|
|
33
39
|
### Define who can see the extension
|
|
34
40
|
|
|
@@ -46,7 +52,7 @@ end
|
|
|
46
52
|
### Modifying view templates in main app
|
|
47
53
|
|
|
48
54
|
Chili uses deface to modify existing view templates (see [deface docs](https://github.com/railsdog/deface#using-the-deface-dsl-deface-files) for details)
|
|
49
|
-
Add overrides to the `app/overides` directory
|
|
55
|
+
Add overrides to the `app/overides` directory mirroring the path of the view you want to modify.
|
|
50
56
|
For example, assuming the main app has the partial `app/views/posts/_post.html.erb`:
|
|
51
57
|
|
|
52
58
|
```erb
|
|
@@ -57,14 +63,23 @@ For example, assuming the main app has the partial `app/views/posts/_post.html.e
|
|
|
57
63
|
|
|
58
64
|
### Adding new resources
|
|
59
65
|
|
|
60
|
-
|
|
66
|
+
Go to the extension's directory and use `rails g scaffold Like` as usual when using engines. The new resource will be namespaced to ChiliSocial::Like
|
|
61
67
|
and automounted in the main app at `/chili/social/likes`, but only accessible when active_if is true.
|
|
62
68
|
All the rules for using [engine-based models](http://railscasts.com/episodes/277-mountable-engines?view=asciicast) apply.
|
|
63
69
|
|
|
70
|
+
|
|
71
|
+
### Migrations
|
|
72
|
+
|
|
73
|
+
Migrations are handled exactly the same way as engines. Use the
|
|
74
|
+
following commands after you've added a new migration to your extension:
|
|
75
|
+
|
|
76
|
+
$ rake chili_social:migrations:install
|
|
77
|
+
$ rake db:migrate
|
|
78
|
+
|
|
64
79
|
### Modifying existing models
|
|
65
80
|
|
|
66
|
-
Create a model with the same name as the one you want to modify: `rails g model User --migration=false`
|
|
67
|
-
and inherit from the original:
|
|
81
|
+
Create a model with the same name as the one you want to modify by running: `rails g model User --migration=false` inside your extension's directory
|
|
82
|
+
and edit it to inherit from the original:
|
|
68
83
|
|
|
69
84
|
```ruby
|
|
70
85
|
# app/models/chili_social/user.rb
|
|
@@ -75,7 +90,7 @@ module ChiliSocial
|
|
|
75
90
|
end
|
|
76
91
|
```
|
|
77
92
|
|
|
78
|
-
Access through the namespaced model:
|
|
93
|
+
Access in your overrides/extension views through the namespaced model:
|
|
79
94
|
|
|
80
95
|
```erb
|
|
81
96
|
<%= ChiliSocial::User.first.likes %>
|
|
@@ -93,23 +108,6 @@ Add files as usual in `app/assets/chili_social/javascripts|stylesheets` and inje
|
|
|
93
108
|
<%= javascript_include_tag 'chili_social/application' %>
|
|
94
109
|
```
|
|
95
110
|
|
|
96
|
-
## Releasing to production
|
|
97
|
-
|
|
98
|
-
Once your chili extension is ready to be released all you have to do is push the repo somewhere,
|
|
99
|
-
add the extension to the Gemfile of the app you are releasing it to:
|
|
100
|
-
|
|
101
|
-
```ruby
|
|
102
|
-
gem 'chili_social', git: 'git@github.com:githubuser/chili_social.git'
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
...and bundle and install any migrations (just like any other engine):
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
$ bundle
|
|
109
|
-
$ rake chili_social:migrations:install
|
|
110
|
-
$ rake db:migrate
|
|
111
|
-
```
|
|
112
|
-
|
|
113
111
|
## Gotchas
|
|
114
112
|
|
|
115
113
|
- Chili will not be able to automount if you use a catch-all route in your main app (ie `match '*a', to: 'errors#routing'`), you will have to remove the catch-all or manually add the engine to the main app's routes file.
|
data/Rakefile
CHANGED
|
@@ -6,8 +6,8 @@ rescue LoadError
|
|
|
6
6
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
APP_RAKEFILE = File.expand_path("../spec/dummy/main_app/Rakefile", __FILE__)
|
|
10
|
-
load 'rails/tasks/engine.rake'
|
|
9
|
+
# APP_RAKEFILE = File.expand_path("../spec/dummy/main_app/Rakefile", __FILE__)
|
|
10
|
+
# load 'rails/tasks/engine.rake'
|
|
11
11
|
|
|
12
12
|
require 'rspec/core/rake_task'
|
|
13
13
|
|
data/bin/chili
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
template_file = File.join(File.dirname(__FILE__), '..', 'lib', 'chili', 'template.rb')
|
|
4
|
-
system "rails plugin new chili_#{ARGV.first} --mountable -m #{template_file}"
|
|
4
|
+
system "rails plugin new vendor/chili_#{ARGV.first} --mountable -m #{template_file}"
|
data/lib/chili/tasks.rb
CHANGED
data/lib/chili/template.rb
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
# Edit gemspec
|
|
2
2
|
require File.expand_path('../version', __FILE__)
|
|
3
|
-
gemspec = "#{
|
|
3
|
+
gemspec = "#{name}.gemspec"
|
|
4
4
|
gsub_file gemspec, '# s.add_dependency "jquery-rails"', "s.add_dependency 'chili', '~> #{Chili::VERSION}'"
|
|
5
5
|
gsub_file gemspec, 'TODO: Your name', `git config user.name`.chomp
|
|
6
6
|
gsub_file gemspec, 'TODO: Your email', `git config user.email`.chomp
|
|
7
7
|
gsub_file gemspec, /TODO(:\s)?/, ''
|
|
8
8
|
gsub_file gemspec, 'Dir["test/**/*"]', 's.files.grep(%r{^(test|spec|features)/})'
|
|
9
9
|
|
|
10
|
-
# Add main app
|
|
11
|
-
|
|
12
|
-
main_app_git_repo = ENV['MAIN_APP'] || ask("Where is the main app you are extending located? (ie git://github.com/myname/myapp.git)")
|
|
13
|
-
if main_app_git_repo.present?
|
|
14
|
-
run "cd #{destination_root} && git init"
|
|
15
|
-
run "cd #{destination_root} && git submodule add #{main_app_git_repo} main_app"
|
|
16
|
-
|
|
17
|
-
# Add gem to main app Gemfile
|
|
18
|
-
append_to_file "main_app/Gemfile", "gem '#{app_path}', path: '../' # git: '...'"
|
|
19
|
-
end
|
|
20
|
-
|
|
10
|
+
# Add gem to main app Gemfile
|
|
11
|
+
append_to_file "../../Gemfile", "gem '#{name}', path: '#{app_path}'"
|
|
21
12
|
|
|
22
13
|
# Uses Chili::ApplicationController and the layout from the main app
|
|
23
|
-
remove_dir "app/controllers/#{
|
|
24
|
-
remove_dir "app/helpers/#{
|
|
14
|
+
remove_dir "app/controllers/#{name}"
|
|
15
|
+
remove_dir "app/helpers/#{name}"
|
|
25
16
|
remove_dir 'app/views/layouts'
|
|
26
17
|
|
|
27
18
|
# Uses Gemfile from main app
|
|
@@ -29,50 +20,23 @@ remove_file 'Gemfile'
|
|
|
29
20
|
|
|
30
21
|
# Replace Rakefile
|
|
31
22
|
remove_file 'Rakefile'
|
|
32
|
-
create_file 'Rakefile' do <<-RUBY
|
|
33
|
-
#!/usr/bin/env rake
|
|
34
|
-
APP_RAKEFILE = File.expand_path("../main_app/Rakefile", __FILE__)
|
|
35
|
-
require 'chili/tasks'
|
|
36
|
-
RUBY
|
|
37
|
-
end
|
|
38
23
|
|
|
39
24
|
# Remove jquery stuff from application.js
|
|
40
|
-
gsub_file "app/assets/javascripts/#{
|
|
41
|
-
gsub_file "app/assets/javascripts/#{
|
|
25
|
+
gsub_file "app/assets/javascripts/#{name}/application.js", "//= require jquery_ujs\n", ''
|
|
26
|
+
gsub_file "app/assets/javascripts/#{name}/application.js", "//= require jquery\n", ''
|
|
42
27
|
|
|
43
28
|
# Setup custom generator
|
|
44
|
-
inject_into_file "lib/#{
|
|
29
|
+
inject_into_file "lib/#{name}/engine.rb", after: "isolate_namespace #{name.camelcase}\n" do <<-RUBY
|
|
45
30
|
config.generators do |g|
|
|
46
31
|
g.scaffold_controller :chili
|
|
47
32
|
end
|
|
48
33
|
RUBY
|
|
49
34
|
end
|
|
50
35
|
|
|
51
|
-
#
|
|
36
|
+
# Remove dummy stuff
|
|
52
37
|
remove_dir 'test'
|
|
53
|
-
create_file 'spec/spec_helper.rb' do <<-RUBY
|
|
54
|
-
ENV["RAILS_ENV"] ||= 'test'
|
|
55
|
-
require File.expand_path("../../main_app/config/environment", __FILE__)
|
|
56
|
-
require 'rspec/rails'
|
|
57
|
-
require 'rspec/autorun'
|
|
58
|
-
|
|
59
|
-
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
|
60
|
-
|
|
61
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
62
|
-
# in spec/support/ and its subdirectories in both main app and the extension.
|
|
63
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f }
|
|
64
|
-
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
|
|
65
|
-
RUBY
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
append_to_file 'Rakefile' do <<-RUBY
|
|
69
|
-
|
|
70
|
-
# Default rake task to rspec
|
|
71
|
-
task default: 'app:spec'
|
|
72
|
-
RUBY
|
|
73
|
-
end
|
|
74
38
|
|
|
75
|
-
inject_into_file "lib/#{
|
|
39
|
+
inject_into_file "lib/#{name}/engine.rb", :after => " g.scaffold_controller :chili\n" do <<-RUBY
|
|
76
40
|
g.test_framework :rspec, view_specs: false, routing_specs: false, controller_specs: false
|
|
77
41
|
g.integration_tool :rspec
|
|
78
42
|
RUBY
|
|
@@ -82,17 +46,17 @@ end
|
|
|
82
46
|
gsub_file ".gitignore", /test\/dummy.*\n/, ''
|
|
83
47
|
|
|
84
48
|
# Automount engine
|
|
85
|
-
prepend_to_file 'config/routes.rb', "#{
|
|
49
|
+
prepend_to_file 'config/routes.rb', "#{name.camelcase}::Engine.automount!\n"
|
|
86
50
|
|
|
87
51
|
# Include chili libs
|
|
88
|
-
prepend_to_file "lib/#{
|
|
52
|
+
prepend_to_file "lib/#{name}.rb" do <<-RUBY
|
|
89
53
|
require "chili"
|
|
90
54
|
RUBY
|
|
91
55
|
end
|
|
92
56
|
|
|
93
57
|
|
|
94
58
|
# Include active_if
|
|
95
|
-
inject_into_file "lib/#{
|
|
59
|
+
inject_into_file "lib/#{name}.rb", :after => "module #{name.camelcase}\n" do <<-RUBY
|
|
96
60
|
extend Chili::Activatable
|
|
97
61
|
active_if { logged_in? }
|
|
98
62
|
RUBY
|
|
@@ -103,8 +67,8 @@ example_file_path = "app/overrides/layouts/application/example.html.erb.deface"
|
|
|
103
67
|
create_file example_file_path do <<-RUBY
|
|
104
68
|
<!-- insert_bottom 'body' -->
|
|
105
69
|
<div style='background: #FFF;text-align: center; padding: 4px 0;position: fixed;width: 100%;z-index: 9999;top: 0;'>
|
|
106
|
-
#{
|
|
107
|
-
<strong>#{example_file_path}</strong><br/>
|
|
70
|
+
#{name} active - edit/remove this file:<br/>
|
|
71
|
+
<strong>#{app_path}/#{example_file_path}</strong><br/>
|
|
108
72
|
<%= link_to 'deface docs', 'https://github.com/railsdog/deface', target: '_blank' %>
|
|
109
73
|
</div>
|
|
110
74
|
RUBY
|
data/lib/chili/version.rb
CHANGED
data/spec/bin/chili_spec.rb
CHANGED
|
@@ -3,20 +3,21 @@ require 'spec_helper'
|
|
|
3
3
|
describe 'Chili Binary' do
|
|
4
4
|
describe 'chili EXTENSION_NAME' do
|
|
5
5
|
let(:chili) { File.expand_path("../../../bin/chili", __FILE__) }
|
|
6
|
-
let(:
|
|
7
|
-
let(:
|
|
6
|
+
let(:app_path) { File.expand_path("../../dummy/example", __FILE__) }
|
|
7
|
+
let(:template_path) { File.expand_path("../../dummy/template", __FILE__) }
|
|
8
8
|
|
|
9
9
|
before do
|
|
10
|
-
FileUtils.rm_rf(
|
|
11
|
-
FileUtils.
|
|
10
|
+
FileUtils.rm_rf File.join(app_path, 'vendor/chili_template')
|
|
11
|
+
FileUtils.rm_rf File.join(app_path, 'Gemfile')
|
|
12
|
+
FileUtils.touch File.join(app_path, 'Gemfile')
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
it 'creates a new extension with a correct file structure' do
|
|
15
|
-
`cd #{
|
|
16
|
+
`cd #{app_path} && #{chili} template`
|
|
16
17
|
|
|
17
|
-
Dir.glob(File.join(
|
|
18
|
-
result = File.join(
|
|
19
|
-
File.open(
|
|
18
|
+
Dir.glob(File.join(template_path, "**/*")).reject { |f| File.directory?(f) }.each do |source|
|
|
19
|
+
result = File.join(app_path, 'vendor/chili_template', source.sub(template_path, ''))
|
|
20
|
+
File.open(result, 'rb').read.should == File.open(source, 'rb').read
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/spec/dummy/{chili_social/app/assets/images/chili_social → example/app/mailers}/.gitkeep
RENAMED
|
File without changes
|
data/spec/dummy/{chili_template/app/assets/images/chili_template → example/app/models}/.gitkeep
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/spec/dummy/{chili_social → example/vendor/chili_social}/app/models/chili_social/like.rb
RENAMED
|
File without changes
|
data/spec/dummy/{chili_social → example/vendor/chili_social}/app/models/chili_social/post.rb
RENAMED
|
File without changes
|