emblem-rails 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +15 -0
- data/Rakefile +1 -0
- data/emblem-rails.gemspec +21 -0
- data/lib/emblem/rails.rb +9 -0
- data/lib/emblem/rails/engine.rb +16 -0
- data/lib/emblem/rails/template.rb +52 -0
- data/lib/emblem/rails/version.rb +5 -0
- metadata +89 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 A. Speller
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Emblem::Rails
|
2
|
+
|
3
|
+
Integrate [Emblem.js](https://github.com/machty/emblem.js) with ember-rails
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add `gem 'emblem-rails'` to your application's Gemfile after `ember-rails`:
|
8
|
+
|
9
|
+
gem 'ember-rails'
|
10
|
+
gem 'emblem-rails'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'emblem/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "emblem-rails"
|
8
|
+
gem.version = Emblem::Rails::VERSION
|
9
|
+
gem.authors = ["Alex Speller", "Alex Matchneer"]
|
10
|
+
gem.email = ["alex@alexspeller.com"]
|
11
|
+
gem.description = %q{Use emblem.js with ember-rails - see https://github.com/machty/emblem.js}
|
12
|
+
gem.summary = %q{Use emblem.js with ember-rails}
|
13
|
+
gem.homepage = "http://github.com/alexspeller/emblem-rails"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.add_dependency "barber-emblem", ">= 0.0.3"
|
20
|
+
gem.add_dependency "ember-rails", ">= 0.9.2"
|
21
|
+
end
|
data/lib/emblem/rails.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'emblem/rails/template'
|
2
|
+
|
3
|
+
module Emblem
|
4
|
+
module Rails
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
initializer "ember_rails.setup", :after => :append_assets_path, :group => :all do |app|
|
7
|
+
sprockets = if ::Rails::VERSION::MAJOR == 4
|
8
|
+
Sprockets.respond_to?('register_engine') ? Sprockets : app.assets
|
9
|
+
else
|
10
|
+
app.assets
|
11
|
+
end
|
12
|
+
sprockets.register_engine '.emblem', Emblem::Rails::Template
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'sprockets'
|
2
|
+
require 'sprockets/engines'
|
3
|
+
require 'ember/handlebars/template'
|
4
|
+
require 'barber-emblem'
|
5
|
+
|
6
|
+
module Emblem
|
7
|
+
module Rails
|
8
|
+
class Template < Ember::Handlebars::Template
|
9
|
+
|
10
|
+
def evaluate(scope, locals, &block)
|
11
|
+
target = template_target(scope)
|
12
|
+
raw = handlebars?(scope)
|
13
|
+
|
14
|
+
template = data
|
15
|
+
|
16
|
+
if configuration.precompile
|
17
|
+
if raw
|
18
|
+
template = precompile_emblem(template)
|
19
|
+
else
|
20
|
+
template = precompile_ember_emblem(template)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
if raw
|
24
|
+
template = compile_emblem(data)
|
25
|
+
else
|
26
|
+
template = compile_ember_emblem(template)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
"#{target} = #{template}\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def compile_emblem(string)
|
36
|
+
"Handlebars.compile(#{indent(string).inspect});"
|
37
|
+
end
|
38
|
+
|
39
|
+
def precompile_emblem(string)
|
40
|
+
Barber::Emblem::FilePrecompiler.call(string)
|
41
|
+
end
|
42
|
+
|
43
|
+
def compile_ember_emblem(string)
|
44
|
+
"Emblem.compile(Ember.Handlebars, #{indent(string).inspect});"
|
45
|
+
end
|
46
|
+
|
47
|
+
def precompile_ember_emblem(string)
|
48
|
+
Barber::Emblem::EmberFilePrecompiler.call(string)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: emblem-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alex Speller
|
9
|
+
- Alex Matchneer
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-02-16 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: barber-emblem
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.0.3
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.0.3
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: ember-rails
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.9.2
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.9.2
|
47
|
+
description: Use emblem.js with ember-rails - see https://github.com/machty/emblem.js
|
48
|
+
email:
|
49
|
+
- alex@alexspeller.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- LICENSE.txt
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- emblem-rails.gemspec
|
60
|
+
- lib/emblem/rails.rb
|
61
|
+
- lib/emblem/rails/engine.rb
|
62
|
+
- lib/emblem/rails/template.rb
|
63
|
+
- lib/emblem/rails/version.rb
|
64
|
+
homepage: http://github.com/alexspeller/emblem-rails
|
65
|
+
licenses: []
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.8.24
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Use emblem.js with ember-rails
|
88
|
+
test_files: []
|
89
|
+
has_rdoc:
|