livescript-rails 1.0.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 +2 -0
- data/Gemfile +11 -0
- data/MIT-LICENSE +22 -0
- data/README.markdown +17 -0
- data/Rakefile +12 -0
- data/lib/assets/javascripts/livescript.js.erb +1 -0
- data/lib/livescript-rails.rb +3 -0
- data/lib/livescript/rails/engine.rb +18 -0
- data/lib/livescript/rails/template_handler.rb +54 -0
- data/lib/livescript/rails/version.rb +5 -0
- data/lib/rails/generators/livescript/assets/assets_generator.rb +13 -0
- data/lib/rails/generators/livescript/assets/templates/javascript.js.ls +3 -0
- data/livescript-rails.gemspec +23 -0
- metadata +122 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in coffee-rails.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
#gem "rails", :git => "git://github.com/rails/rails"
|
7
|
+
#gem 'activerecord-deprecated_finders', :git => 'git://github.com/rails/activerecord-deprecated_finders'
|
8
|
+
|
9
|
+
|
10
|
+
# To use debugger
|
11
|
+
# gem 'debugger'
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Victor Hugo Borja
|
2
|
+
Copyright (c) 2011 Santiago Pastorino
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
data/README.markdown
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# LiveScript-Rails
|
2
|
+
|
3
|
+
LiveScript adapter for the Rails asset pipeline. Also adds support to use LiveScript to respond to JavaScript requests (use .js.ls views).
|
4
|
+
This project is essentially a fork of `coffee-rails` adapted to compile LiveScript.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Since Rails 3.1 Live-Rails is included in the default Gemfile when you create a new application. If you are upgrading to Rails 3.1 you must add the livescript-rails to your Gemfile:
|
9
|
+
|
10
|
+
gem 'livescript-rails'
|
11
|
+
|
12
|
+
If you are precompiling your assets (with rake assets:precompile) before run your application in production, you might want add it to the assets group to prevent the gem being required in the production environment.
|
13
|
+
|
14
|
+
group :assets do
|
15
|
+
gem 'livescript-rails'
|
16
|
+
end
|
17
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<%= LiveScript::Source.contents %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails/engine'
|
2
|
+
|
3
|
+
module LiveScript
|
4
|
+
module Rails
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
if ::Rails.version.to_f >= 3.1
|
7
|
+
config.app_generators.template_engine :ls
|
8
|
+
else
|
9
|
+
config.generators.template_engine :ls
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer :register_livescript do |app|
|
13
|
+
app.assets.register_engine '.ls', TiltTemplate
|
14
|
+
app.assets.register_engine '.livescript', TiltTemplate
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'tilt/template'
|
2
|
+
require 'livescript'
|
3
|
+
|
4
|
+
module LiveScript
|
5
|
+
# LiveScript template implementation. See:
|
6
|
+
# http://gkz.github.com/LiveScript/
|
7
|
+
#
|
8
|
+
# LiveScript templates do not support object scopes, locals, or yield.
|
9
|
+
class TiltTemplate < Tilt::Template
|
10
|
+
self.default_mime_type = 'application/javascript'
|
11
|
+
|
12
|
+
@@default_bare = false
|
13
|
+
|
14
|
+
def self.default_bare
|
15
|
+
@@default_bare
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.default_bare=(value)
|
19
|
+
@@default_bare = value
|
20
|
+
end
|
21
|
+
|
22
|
+
# DEPRECATED
|
23
|
+
def self.default_no_wrap
|
24
|
+
@@default_bare
|
25
|
+
end
|
26
|
+
|
27
|
+
# DEPRECATED
|
28
|
+
def self.default_no_wrap=(value)
|
29
|
+
@@default_bare = value
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.engine_initialized?
|
33
|
+
defined? ::LiveScript && ::LiveScript.respond_to?('compile')
|
34
|
+
end
|
35
|
+
|
36
|
+
def initialize_engine
|
37
|
+
end
|
38
|
+
|
39
|
+
def prepare
|
40
|
+
if !options.key?(:bare) and !options.key?(:no_wrap)
|
41
|
+
options[:bare] = self.class.default_bare
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def evaluate(scope, locals, &block)
|
46
|
+
@output ||= LiveScript.compile(data, options)
|
47
|
+
end
|
48
|
+
|
49
|
+
def allows_script?
|
50
|
+
false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "rails/generators/named_base"
|
2
|
+
|
3
|
+
module LiveScript
|
4
|
+
module Generators
|
5
|
+
class AssetsGenerator < ::Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def copy_livescript
|
9
|
+
template "javascript.js.ls", File.join('app/assets/javascripts', class_path, "#{file_name}.js.ls")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "livescript/rails/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "livescript-rails"
|
6
|
+
s.version = LiveScript::Rails::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Victor Hugo Borja"]
|
9
|
+
s.email = ["vic.borja@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/Roonin-mx/livescript-rails"
|
11
|
+
s.summary = %q{LiveScript adapter for the Rails asset pipeline.}
|
12
|
+
s.description = %q{LiveScript adapter for the Rails asset pipeline.}
|
13
|
+
|
14
|
+
s.add_runtime_dependency 'execjs'
|
15
|
+
s.add_runtime_dependency 'livescript'
|
16
|
+
s.add_runtime_dependency 'railties'
|
17
|
+
s.add_runtime_dependency 'tilt'
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: livescript-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Victor Hugo Borja
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: execjs
|
16
|
+
requirement: !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: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: livescript
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: railties
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: tilt
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: LiveScript adapter for the Rails asset pipeline.
|
79
|
+
email:
|
80
|
+
- vic.borja@gmail.com
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- .gitignore
|
86
|
+
- Gemfile
|
87
|
+
- MIT-LICENSE
|
88
|
+
- README.markdown
|
89
|
+
- Rakefile
|
90
|
+
- lib/assets/javascripts/livescript.js.erb
|
91
|
+
- lib/livescript-rails.rb
|
92
|
+
- lib/livescript/rails/engine.rb
|
93
|
+
- lib/livescript/rails/template_handler.rb
|
94
|
+
- lib/livescript/rails/version.rb
|
95
|
+
- lib/rails/generators/livescript/assets/assets_generator.rb
|
96
|
+
- lib/rails/generators/livescript/assets/templates/javascript.js.ls
|
97
|
+
- livescript-rails.gemspec
|
98
|
+
homepage: https://github.com/Roonin-mx/livescript-rails
|
99
|
+
licenses: []
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 1.8.24
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: LiveScript adapter for the Rails asset pipeline.
|
122
|
+
test_files: []
|