slim_assets 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +119 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/lib/slim_assets.rb +11 -0
- data/lib/slim_assets/engine.rb +17 -0
- data/lib/slim_assets/slim_sprockets_engine.rb +57 -0
- data/lib/slim_assets/version.rb +3 -0
- data/slim_assets.gemspec +29 -0
- data/spec/rails_app/.gitignore +5 -0
- data/spec/rails_app/Rakefile +7 -0
- data/spec/rails_app/app/assets/javascripts/empty.jst.ejs.slim +0 -0
- data/spec/rails_app/app/assets/javascripts/link_to.jst.ejs.slim +3 -0
- data/spec/rails_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +50 -0
- data/spec/rails_app/config/boot.rb +6 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/test.rb +37 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/initializers/wrap_parameters.rb +10 -0
- data/spec/rails_app/config/routes.rb +58 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/render_spec.rb +7 -0
- data/spec/spec_helper.rb +8 -0
- metadata +174 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use default@handlebars_assets
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
slim_assets (0.0.1)
|
5
|
+
slim
|
6
|
+
tilt
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (3.1.0)
|
12
|
+
actionpack (= 3.1.0)
|
13
|
+
mail (~> 2.3.0)
|
14
|
+
actionpack (3.1.0)
|
15
|
+
activemodel (= 3.1.0)
|
16
|
+
activesupport (= 3.1.0)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
rack (~> 1.3.2)
|
21
|
+
rack-cache (~> 1.0.3)
|
22
|
+
rack-mount (~> 0.8.2)
|
23
|
+
rack-test (~> 0.6.1)
|
24
|
+
sprockets (~> 2.0.0)
|
25
|
+
activemodel (3.1.0)
|
26
|
+
activesupport (= 3.1.0)
|
27
|
+
bcrypt-ruby (~> 3.0.0)
|
28
|
+
builder (~> 3.0.0)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
activerecord (3.1.0)
|
31
|
+
activemodel (= 3.1.0)
|
32
|
+
activesupport (= 3.1.0)
|
33
|
+
arel (~> 2.2.1)
|
34
|
+
tzinfo (~> 0.3.29)
|
35
|
+
activeresource (3.1.0)
|
36
|
+
activemodel (= 3.1.0)
|
37
|
+
activesupport (= 3.1.0)
|
38
|
+
activesupport (3.1.0)
|
39
|
+
multi_json (~> 1.0)
|
40
|
+
arel (2.2.1)
|
41
|
+
bcrypt-ruby (3.0.1)
|
42
|
+
builder (3.0.0)
|
43
|
+
diff-lcs (1.1.3)
|
44
|
+
ejs (1.0.0)
|
45
|
+
erubis (2.7.0)
|
46
|
+
hike (1.2.1)
|
47
|
+
i18n (0.6.0)
|
48
|
+
mail (2.3.0)
|
49
|
+
i18n (>= 0.4.0)
|
50
|
+
mime-types (~> 1.16)
|
51
|
+
treetop (~> 1.4.8)
|
52
|
+
mime-types (1.16)
|
53
|
+
multi_json (1.0.3)
|
54
|
+
polyglot (0.3.2)
|
55
|
+
psych (1.2.2)
|
56
|
+
rack (1.3.3)
|
57
|
+
rack-cache (1.0.3)
|
58
|
+
rack (>= 0.4)
|
59
|
+
rack-mount (0.8.3)
|
60
|
+
rack (>= 1.0.0)
|
61
|
+
rack-ssl (1.3.2)
|
62
|
+
rack
|
63
|
+
rack-test (0.6.1)
|
64
|
+
rack (>= 1.0)
|
65
|
+
rails (3.1.0)
|
66
|
+
actionmailer (= 3.1.0)
|
67
|
+
actionpack (= 3.1.0)
|
68
|
+
activerecord (= 3.1.0)
|
69
|
+
activeresource (= 3.1.0)
|
70
|
+
activesupport (= 3.1.0)
|
71
|
+
bundler (~> 1.0)
|
72
|
+
railties (= 3.1.0)
|
73
|
+
railties (3.1.0)
|
74
|
+
actionpack (= 3.1.0)
|
75
|
+
activesupport (= 3.1.0)
|
76
|
+
rack-ssl (~> 1.3.2)
|
77
|
+
rake (>= 0.8.7)
|
78
|
+
rdoc (~> 3.4)
|
79
|
+
thor (~> 0.14.6)
|
80
|
+
rake (0.9.2)
|
81
|
+
rdoc (3.9.4)
|
82
|
+
rspec (2.6.0)
|
83
|
+
rspec-core (~> 2.6.0)
|
84
|
+
rspec-expectations (~> 2.6.0)
|
85
|
+
rspec-mocks (~> 2.6.0)
|
86
|
+
rspec-core (2.6.4)
|
87
|
+
rspec-expectations (2.6.0)
|
88
|
+
diff-lcs (~> 1.1.2)
|
89
|
+
rspec-mocks (2.6.0)
|
90
|
+
rspec-rails (2.6.1)
|
91
|
+
actionpack (~> 3.0)
|
92
|
+
activesupport (~> 3.0)
|
93
|
+
railties (~> 3.0)
|
94
|
+
rspec (~> 2.6.0)
|
95
|
+
slim (1.1.0)
|
96
|
+
temple (~> 0.3.5)
|
97
|
+
tilt (~> 1.3.2)
|
98
|
+
sprockets (2.0.0)
|
99
|
+
hike (~> 1.2)
|
100
|
+
rack (~> 1.0)
|
101
|
+
tilt (~> 1.1, != 1.3.0)
|
102
|
+
temple (0.3.5)
|
103
|
+
thor (0.14.6)
|
104
|
+
tilt (1.3.3)
|
105
|
+
treetop (1.4.10)
|
106
|
+
polyglot
|
107
|
+
polyglot (>= 0.3.1)
|
108
|
+
tzinfo (0.3.29)
|
109
|
+
|
110
|
+
PLATFORMS
|
111
|
+
ruby
|
112
|
+
|
113
|
+
DEPENDENCIES
|
114
|
+
ejs
|
115
|
+
psych
|
116
|
+
rails (~> 3.1.0)
|
117
|
+
rspec
|
118
|
+
rspec-rails
|
119
|
+
slim_assets!
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Use slim to write your Javascript templates
|
2
|
+
|
3
|
+
*ALPHA*
|
4
|
+
|
5
|
+
Writing Javascript templates for Backbone.js (or other frameworks) in your app? Would you like to use slim and the asset pipeline?
|
6
|
+
|
7
|
+
This gem adds slim templating support to the Rails 3.1 asset pipeline. This gem works with the EJS gem and JST asset engine to make your slim available as a compiled Javascript template.
|
8
|
+
|
9
|
+
## Installing
|
10
|
+
|
11
|
+
Add this to your `Gemfile`
|
12
|
+
|
13
|
+
gem 'slim_assets'
|
14
|
+
gem 'ejs'
|
15
|
+
gem 'slim'
|
16
|
+
|
17
|
+
# Using slim for your Javascript templates
|
18
|
+
|
19
|
+
|
20
|
+
## Templates directory
|
21
|
+
|
22
|
+
You should located your templates under `app/assets`; we suggest `app/assets/templates`. In your Javascript manifest file (for example `application.js`), use `require_tree`
|
23
|
+
|
24
|
+
//= require_tree ../templates
|
25
|
+
|
26
|
+
## The template file
|
27
|
+
|
28
|
+
Inside your templates directory, add your template file. The file should be named as follows
|
29
|
+
|
30
|
+
your_template_name.jst.ejs.slim
|
31
|
+
|
32
|
+
The asset pipeline will then generate the actual Javascript asset
|
33
|
+
|
34
|
+
1. Convert your slim to HTML
|
35
|
+
1. Compile the HTML to an EJS Javascript template
|
36
|
+
1. Add the template to the JST global under the templates name
|
37
|
+
|
38
|
+
**Important!** The asset pipeline is not invoking a controller to generate the templates. If you are using existing view templates, you may have to edit templates to remove some references to controller helpers.
|
39
|
+
|
40
|
+
## EJS
|
41
|
+
|
42
|
+
In your template file you can use the EJS delimiters as you would normally. If you want to use them in attributes mark the attribute html_safe.
|
43
|
+
|
44
|
+
= f.text_field :email, class: 'text', value: '<%= email %>'.html_safe
|
45
|
+
|
46
|
+
### Helpers
|
47
|
+
|
48
|
+
All the ActionView and route helpers are available in your template. If you use `form_for` and the related helpers, you should use the *new* object form, even if you are writing an *edit* form, for example
|
49
|
+
|
50
|
+
= form_for :contact, url: "javascript_not_working", html: {:class => :edit_contact, :method => :put} do |f|
|
51
|
+
%p
|
52
|
+
= f.label :name, "Name"
|
53
|
+
= f.text_field :name, class: 'text required', autofocus: true, value: '<%= name %>'.html_safe
|
54
|
+
|
55
|
+
# Credits
|
56
|
+
|
57
|
+
* Les Hill : @leshill
|
58
|
+
* Wes Gibbs : @wgibbs
|
59
|
+
|
60
|
+
This gem is heavily based on their [haml_assets gem](https://github.com/infbio/haml_assets)
|
data/Rakefile
ADDED
data/lib/slim_assets.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module SlimAssets
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
initializer "sprockets.slim", :after => "sprockets.environment", :group => :all do |app|
|
4
|
+
next unless app.assets
|
5
|
+
|
6
|
+
app.assets.register_engine('.slim', SlimSprocketsEngine)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module SlimAssets
|
12
|
+
class Railtie < ::Rails::Railtie
|
13
|
+
if ::Rails.version.to_f >= 3.1
|
14
|
+
config.app_generators.javascript_template_engine :slim
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'slim'
|
2
|
+
require 'tilt'
|
3
|
+
|
4
|
+
module SlimAssets
|
5
|
+
class SlimSprocketsEngine < Tilt::Template
|
6
|
+
def self.default_mime_type
|
7
|
+
'application/javascript'
|
8
|
+
end
|
9
|
+
|
10
|
+
module ViewContext
|
11
|
+
attr_accessor :output_buffer
|
12
|
+
|
13
|
+
def self.included(klass)
|
14
|
+
klass.instance_eval do
|
15
|
+
include Rails.application.routes.url_helpers
|
16
|
+
include Rails.application.routes.mounted_helpers
|
17
|
+
include ActionView::Helpers
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def protect_against_forgery?
|
22
|
+
false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def evaluate(scope, locals, &block)
|
27
|
+
begin
|
28
|
+
"" + render_slim(view_context(scope), locals)
|
29
|
+
rescue Exception => e
|
30
|
+
Rails.logger.error "ERROR: compiling #{file} RAISED #{e}"
|
31
|
+
Rails.logger.error "Backtrace: #{e.backtrace.join("\n")}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def context_class(scope)
|
38
|
+
@context_class ||= Class.new(scope.environment.context_class)
|
39
|
+
end
|
40
|
+
|
41
|
+
def prepare; end
|
42
|
+
|
43
|
+
def render_slim(context, locals)
|
44
|
+
Slim::Template.new {|t| data }.render(context)
|
45
|
+
end
|
46
|
+
|
47
|
+
# The Sprockets context is shared among all the processors, give Slim its
|
48
|
+
# own context
|
49
|
+
def view_context(scope)
|
50
|
+
@view_context ||=
|
51
|
+
context_class(scope).new(
|
52
|
+
scope.environment,
|
53
|
+
scope.logical_path.to_s,
|
54
|
+
scope.pathname).tap { |ctx| ctx.class.send(:include, ViewContext) }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/slim_assets.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "slim_assets/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "slim_assets"
|
7
|
+
s.version = SlimAssets::VERSION
|
8
|
+
s.authors = ["David Padilla"]
|
9
|
+
s.email = ["david@crowdint.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Use Slim with Rails helpers in the asset pipeline}
|
12
|
+
s.description = %q{Use Slim with Rails helpers in the asset pipeline}
|
13
|
+
|
14
|
+
s.rubyforge_project = "slim_assets"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency "slim"
|
22
|
+
s.add_runtime_dependency "tilt"
|
23
|
+
|
24
|
+
s.add_development_dependency 'rails', '~> 3.1.0'
|
25
|
+
s.add_development_dependency 'rspec'
|
26
|
+
s.add_development_dependency 'rspec-rails'
|
27
|
+
s.add_development_dependency 'ejs'
|
28
|
+
s.add_development_dependency 'psych'
|
29
|
+
end
|
@@ -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
|
+
RailsApp::Application.load_tasks
|
File without changes
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "active_resource/railtie"
|
5
|
+
require "sprockets/railtie"
|
6
|
+
|
7
|
+
if defined?(Bundler)
|
8
|
+
# If you precompile assets before deploying to production, use this line
|
9
|
+
Bundler.require *Rails.groups(:assets => %w(development test))
|
10
|
+
# If you want your assets lazily compiled in production, use this line
|
11
|
+
# Bundler.require(:default, :assets, Rails.env)
|
12
|
+
end
|
13
|
+
|
14
|
+
module RailsApp
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Activate observers that should always be running.
|
28
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
29
|
+
|
30
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
31
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
32
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
33
|
+
|
34
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
35
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
36
|
+
# config.i18n.default_locale = :de
|
37
|
+
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
+
config.encoding = "utf-8"
|
40
|
+
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
42
|
+
config.filter_parameters += [:password]
|
43
|
+
|
44
|
+
# Enable the asset pipeline
|
45
|
+
config.assets.enabled = true
|
46
|
+
|
47
|
+
# Version of your assets, change this if you want to expire all your assets
|
48
|
+
config.assets.version = '1.0'
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
28
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
29
|
+
# like if you have constraints or database-specific column types
|
30
|
+
# config.active_record.schema_format = :sql
|
31
|
+
|
32
|
+
# Print deprecation notices to the stderr
|
33
|
+
config.active_support.deprecation = :stderr
|
34
|
+
|
35
|
+
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
|
36
|
+
config.assets.allow_debugging = true
|
37
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
RailsApp::Application.config.secret_token = 'e787a489c02bab15e4be9b57d8e5e9737667a04b839e6ccb06fe7a837808ed18baba96c7c18a39faaa33a3bd633211c7f2c79bbf4354a227cfa2ed4859fb3553'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# RailsApp::Application.config.session_store :active_record_store
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
10
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
RailsApp::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get 'short'
|
20
|
+
# post 'toggle'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get 'sold'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get 'recent', :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => 'welcome#index'
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
end
|
@@ -0,0 +1,6 @@
|
|
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
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
data/spec/render_spec.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SlimAssets do
|
4
|
+
it "should have the proper format" do
|
5
|
+
RailsApp::Application.assets['link_to.jst.ejs.slim'].to_s.should == "(function() {\n this.JST || (this.JST = {});\n this.JST[\"link_to\"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<h1><div class=\"text\">Render works</div></h1>');}return __p.join('');};\n}).call(this);\n"
|
6
|
+
end
|
7
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slim_assets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- David Padilla
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: slim
|
16
|
+
requirement: &70112614945300 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70112614945300
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: tilt
|
27
|
+
requirement: &70112614943720 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70112614943720
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rails
|
38
|
+
requirement: &70112614942600 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.1.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70112614942600
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &70112614942020 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70112614942020
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec-rails
|
60
|
+
requirement: &70112614957320 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70112614957320
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ejs
|
71
|
+
requirement: &70112614956140 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70112614956140
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: psych
|
82
|
+
requirement: &70112614954960 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70112614954960
|
91
|
+
description: Use Slim with Rails helpers in the asset pipeline
|
92
|
+
email:
|
93
|
+
- david@crowdint.com
|
94
|
+
executables: []
|
95
|
+
extensions: []
|
96
|
+
extra_rdoc_files: []
|
97
|
+
files:
|
98
|
+
- .gitignore
|
99
|
+
- .rspec
|
100
|
+
- .rvmrc
|
101
|
+
- Gemfile
|
102
|
+
- Gemfile.lock
|
103
|
+
- README.md
|
104
|
+
- Rakefile
|
105
|
+
- lib/slim_assets.rb
|
106
|
+
- lib/slim_assets/engine.rb
|
107
|
+
- lib/slim_assets/slim_sprockets_engine.rb
|
108
|
+
- lib/slim_assets/version.rb
|
109
|
+
- slim_assets.gemspec
|
110
|
+
- spec/rails_app/.gitignore
|
111
|
+
- spec/rails_app/Rakefile
|
112
|
+
- spec/rails_app/app/assets/javascripts/empty.jst.ejs.slim
|
113
|
+
- spec/rails_app/app/assets/javascripts/link_to.jst.ejs.slim
|
114
|
+
- spec/rails_app/app/controllers/application_controller.rb
|
115
|
+
- spec/rails_app/config.ru
|
116
|
+
- spec/rails_app/config/application.rb
|
117
|
+
- spec/rails_app/config/boot.rb
|
118
|
+
- spec/rails_app/config/environment.rb
|
119
|
+
- spec/rails_app/config/environments/test.rb
|
120
|
+
- spec/rails_app/config/initializers/secret_token.rb
|
121
|
+
- spec/rails_app/config/initializers/session_store.rb
|
122
|
+
- spec/rails_app/config/initializers/wrap_parameters.rb
|
123
|
+
- spec/rails_app/config/routes.rb
|
124
|
+
- spec/rails_app/script/rails
|
125
|
+
- spec/render_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
homepage: ''
|
128
|
+
licenses: []
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
hash: 1628496805334381705
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
hash: 1628496805334381705
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project: slim_assets
|
153
|
+
rubygems_version: 1.8.11
|
154
|
+
signing_key:
|
155
|
+
specification_version: 3
|
156
|
+
summary: Use Slim with Rails helpers in the asset pipeline
|
157
|
+
test_files:
|
158
|
+
- spec/rails_app/.gitignore
|
159
|
+
- spec/rails_app/Rakefile
|
160
|
+
- spec/rails_app/app/assets/javascripts/empty.jst.ejs.slim
|
161
|
+
- spec/rails_app/app/assets/javascripts/link_to.jst.ejs.slim
|
162
|
+
- spec/rails_app/app/controllers/application_controller.rb
|
163
|
+
- spec/rails_app/config.ru
|
164
|
+
- spec/rails_app/config/application.rb
|
165
|
+
- spec/rails_app/config/boot.rb
|
166
|
+
- spec/rails_app/config/environment.rb
|
167
|
+
- spec/rails_app/config/environments/test.rb
|
168
|
+
- spec/rails_app/config/initializers/secret_token.rb
|
169
|
+
- spec/rails_app/config/initializers/session_store.rb
|
170
|
+
- spec/rails_app/config/initializers/wrap_parameters.rb
|
171
|
+
- spec/rails_app/config/routes.rb
|
172
|
+
- spec/rails_app/script/rails
|
173
|
+
- spec/render_spec.rb
|
174
|
+
- spec/spec_helper.rb
|