chili 0.0.9 → 0.1.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 CHANGED
@@ -16,5 +16,6 @@ spec/dummy/main_app/db/*.sqlite3
16
16
  spec/dummy/main_app/log/*.log
17
17
  spec/dummy/main_app/tmp/
18
18
  spec/dummy/main_app/.sass-cache
19
+ spec/result
19
20
  tmp
20
21
  .DS_Store
data/README.md CHANGED
@@ -9,7 +9,7 @@ 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 (no need to add it to your app's gemfile):
13
13
 
14
14
  $ gem install chili
15
15
 
@@ -19,9 +19,10 @@ Just like engines chili extensions are like mini apps that are created separatel
19
19
 
20
20
  ### Creating a new chili extension
21
21
 
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:
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:
23
24
 
24
- $ chili social # social is the name of the extension
25
+ $ chili social
25
26
 
26
27
  This is basically a shortcut for running the `rails plugin new` engine generator with a custom template and will:
27
28
 
@@ -16,7 +16,7 @@ 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"
19
+ gem.add_dependency "deface", "~> 0.9.1"
20
20
 
21
21
  gem.add_development_dependency 'rspec', '~> 2.9.0'
22
22
  gem.add_development_dependency 'rspec-rails', '~> 2.9.0'
@@ -8,7 +8,7 @@ module Chili
8
8
  module InstanceMethods
9
9
  def activate_overrides
10
10
  Deface::Override.all.values.map(&:values).flatten.each do |override|
11
- override.args[:disabled] = !override.railtie.class.parent.active?(self)
11
+ override.args[:disabled] = !override.railtie_class.constantize.parent.active?(self)
12
12
  end
13
13
  end
14
14
  end
@@ -9,14 +9,15 @@ gsub_file gemspec, 'Dir["test/**/*"]', 's.files.grep(%r{^(test|spec|features)/})
9
9
 
10
10
  # Add main app as submodule
11
11
  # For some reason root when using git method is test/dummy so doing this manually
12
- main_app_git_repo = ask("Where is the main app you are extending located? (ie git://github.com/myname/myapp.git)")
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
13
  if main_app_git_repo.present?
14
14
  run "cd #{destination_root} && git init"
15
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: '...'"
16
19
  end
17
20
 
18
- # Add gem to main app Gemfile
19
- append_to_file "main_app/Gemfile", "gem '#{app_path}', path: '../' # git: '...'"
20
21
 
21
22
  # Uses Chili::ApplicationController and the layout from the main app
22
23
  remove_dir "app/controllers/#{app_path}"
@@ -1,3 +1,3 @@
1
1
  module Chili
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Chili Binary' do
4
+ describe 'chili EXTENSION_NAME' do
5
+ let(:chili) { File.expand_path("../../../bin/chili", __FILE__) }
6
+ let(:result_path) { File.expand_path("../../result/", __FILE__) }
7
+ let(:source_path) { File.expand_path("../../dummy/chili_template", __FILE__) }
8
+
9
+ before do
10
+ FileUtils.rm_rf(result_path)
11
+ FileUtils.mkdir(result_path)
12
+ end
13
+
14
+ it 'creates a new extension with a correct file structure' do
15
+ `cd #{result_path} && MAIN_APP= #{chili} template`
16
+
17
+ Dir.glob(File.join(source_path, "**/*")).reject { |f| File.directory?(f) }.each do |source|
18
+ result = File.join(result_path, 'chili_template', source.sub(source_path, ''))
19
+ File.open(source, 'rb').read.should == File.open(result, 'rb').read
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = ChiliTemplate
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env rake
2
+ APP_RAKEFILE = File.expand_path("../main_app/Rakefile", __FILE__)
3
+ require 'chili/tasks'
4
+
5
+ # Default rake task to rspec
6
+ task default: 'app:spec'
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require_tree .
@@ -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,6 @@
1
+ <!-- insert_bottom 'body' -->
2
+ <div style='background: #FFF;text-align: center; padding: 4px 0;position: fixed;width: 100%;z-index: 9999;top: 0;'>
3
+ chili_template active - edit/remove this file:<br/>
4
+ <strong>app/overrides/layouts/application/example.html.erb.deface</strong><br/>
5
+ <%= link_to 'deface docs', 'https://github.com/railsdog/deface', target: '_blank' %>
6
+ </div>
@@ -0,0 +1,23 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "chili_template/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "chili_template"
9
+ s.version = ChiliTemplate::VERSION
10
+ s.authors = [""]
11
+ s.email = ["jens@balvig.com"]
12
+ s.homepage = ""
13
+ s.summary = "Summary of ChiliTemplate."
14
+ s.description = "Description of ChiliTemplate."
15
+
16
+ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+
19
+ s.add_dependency "rails", "~> 3.2.3"
20
+ s.add_dependency 'chili', '~> 0.1.0'
21
+
22
+ s.add_development_dependency "sqlite3"
23
+ end
@@ -0,0 +1,3 @@
1
+ ChiliTemplate::Engine.automount!
2
+ ChiliTemplate::Engine.routes.draw do
3
+ end
@@ -0,0 +1,7 @@
1
+ require "chili"
2
+ require "chili_template/engine"
3
+
4
+ module ChiliTemplate
5
+ extend Chili::Activatable
6
+ active_if { logged_in? }
7
+ end
@@ -0,0 +1,10 @@
1
+ module ChiliTemplate
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ChiliTemplate
4
+ config.generators do |g|
5
+ g.scaffold_controller :chili
6
+ g.test_framework :rspec, view_specs: false, routing_specs: false, controller_specs: false
7
+ g.integration_tool :rspec
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module ChiliTemplate
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :chili_template do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/chili_template/engine', __FILE__)
6
+
7
+ require 'rails/all'
8
+ require 'rails/engine/commands'
@@ -0,0 +1,11 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ require File.expand_path("../../main_app/config/environment", __FILE__)
3
+ require 'rspec/rails'
4
+ require 'rspec/autorun'
5
+
6
+ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
7
+
8
+ # Requires supporting ruby files with custom matchers and macros, etc,
9
+ # in spec/support/ and its subdirectories in both main app and the extension.
10
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f }
11
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
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.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70174608984020 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,21 +21,31 @@ dependencies:
21
21
  version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70174608984020
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: deface
27
- requirement: &70174608983520 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
31
36
  - !ruby/object:Gem::Version
32
- version: '0.9'
37
+ version: 0.9.1
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70174608983520
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.9.1
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &70174608983040 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 2.9.0
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70174608983040
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.9.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rspec-rails
49
- requirement: &70174608982540 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 2.9.0
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70174608982540
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.9.0
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: jquery-rails
60
- requirement: &70174608982160 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70174608982160
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: capybara
71
- requirement: &70174608981700 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70174608981700
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: sqlite3
82
- requirement: &70174608981260 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,7 +117,12 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70174608981260
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  description: The spicy extension framework
92
127
  email:
93
128
  - jens@balvig.com
@@ -114,6 +149,7 @@ files:
114
149
  - lib/chili/version.rb
115
150
  - lib/generators/rails/chili_generator.rb
116
151
  - lib/generators/rails/templates/controller.rb
152
+ - spec/bin/chili_spec.rb
117
153
  - spec/dummy/chili_social/app/assets/images/chili_social/.gitkeep
118
154
  - spec/dummy/chili_social/app/assets/javascripts/chili_social/application.js
119
155
  - spec/dummy/chili_social/app/assets/stylesheets/chili_social/application.css.scss
@@ -130,6 +166,21 @@ files:
130
166
  - spec/dummy/chili_social/db/migrate/20120513031021_create_chili_likes_likes.rb
131
167
  - spec/dummy/chili_social/lib/chili_social.rb
132
168
  - spec/dummy/chili_social/lib/chili_social/engine.rb
169
+ - spec/dummy/chili_template/MIT-LICENSE
170
+ - spec/dummy/chili_template/README.rdoc
171
+ - spec/dummy/chili_template/Rakefile
172
+ - spec/dummy/chili_template/app/assets/images/chili_template/.gitkeep
173
+ - spec/dummy/chili_template/app/assets/javascripts/chili_template/application.js
174
+ - spec/dummy/chili_template/app/assets/stylesheets/chili_template/application.css
175
+ - spec/dummy/chili_template/app/overrides/layouts/application/example.html.erb.deface
176
+ - spec/dummy/chili_template/chili_template.gemspec
177
+ - spec/dummy/chili_template/config/routes.rb
178
+ - spec/dummy/chili_template/lib/chili_template.rb
179
+ - spec/dummy/chili_template/lib/chili_template/engine.rb
180
+ - spec/dummy/chili_template/lib/chili_template/version.rb
181
+ - spec/dummy/chili_template/lib/tasks/chili_template_tasks.rake
182
+ - spec/dummy/chili_template/script/rails
183
+ - spec/dummy/chili_template/spec/spec_helper.rb
133
184
  - spec/dummy/main_app/README.rdoc
134
185
  - spec/dummy/main_app/Rakefile
135
186
  - spec/dummy/main_app/app/assets/javascripts/application.js
@@ -203,7 +254,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
254
  version: '0'
204
255
  segments:
205
256
  - 0
206
- hash: 4513349709949091825
257
+ hash: 2244926333438002551
207
258
  required_rubygems_version: !ruby/object:Gem::Requirement
208
259
  none: false
209
260
  requirements:
@@ -212,14 +263,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
263
  version: '0'
213
264
  segments:
214
265
  - 0
215
- hash: 4513349709949091825
266
+ hash: 2244926333438002551
216
267
  requirements: []
217
268
  rubyforge_project:
218
- rubygems_version: 1.8.11
269
+ rubygems_version: 1.8.23
219
270
  signing_key:
220
271
  specification_version: 3
221
272
  summary: The spicy extension framework
222
273
  test_files:
274
+ - spec/bin/chili_spec.rb
223
275
  - spec/dummy/chili_social/app/assets/images/chili_social/.gitkeep
224
276
  - spec/dummy/chili_social/app/assets/javascripts/chili_social/application.js
225
277
  - spec/dummy/chili_social/app/assets/stylesheets/chili_social/application.css.scss
@@ -236,6 +288,21 @@ test_files:
236
288
  - spec/dummy/chili_social/db/migrate/20120513031021_create_chili_likes_likes.rb
237
289
  - spec/dummy/chili_social/lib/chili_social.rb
238
290
  - spec/dummy/chili_social/lib/chili_social/engine.rb
291
+ - spec/dummy/chili_template/MIT-LICENSE
292
+ - spec/dummy/chili_template/README.rdoc
293
+ - spec/dummy/chili_template/Rakefile
294
+ - spec/dummy/chili_template/app/assets/images/chili_template/.gitkeep
295
+ - spec/dummy/chili_template/app/assets/javascripts/chili_template/application.js
296
+ - spec/dummy/chili_template/app/assets/stylesheets/chili_template/application.css
297
+ - spec/dummy/chili_template/app/overrides/layouts/application/example.html.erb.deface
298
+ - spec/dummy/chili_template/chili_template.gemspec
299
+ - spec/dummy/chili_template/config/routes.rb
300
+ - spec/dummy/chili_template/lib/chili_template.rb
301
+ - spec/dummy/chili_template/lib/chili_template/engine.rb
302
+ - spec/dummy/chili_template/lib/chili_template/version.rb
303
+ - spec/dummy/chili_template/lib/tasks/chili_template_tasks.rake
304
+ - spec/dummy/chili_template/script/rails
305
+ - spec/dummy/chili_template/spec/spec_helper.rb
239
306
  - spec/dummy/main_app/README.rdoc
240
307
  - spec/dummy/main_app/Rakefile
241
308
  - spec/dummy/main_app/app/assets/javascripts/application.js