livescript-rails 1.1.0 → 2.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.
- checksums.yaml +7 -0
- data/LICENSE +23 -0
- data/README.md +40 -0
- data/Rakefile +3 -7
- data/lib/livescript-rails.rb +3 -2
- data/lib/livescript/rails/processor.rb +33 -0
- data/lib/livescript/rails/railtie.rb +14 -0
- data/lib/livescript/rails/version.rb +1 -1
- data/lib/rails/generators/ls/assets/assets_generator.rb +3 -3
- data/lib/rails/generators/ls/assets/templates/javascript.ls +1 -0
- data/test/files/assets/javascripts/hello.ls +1 -0
- data/test/test_assets.rb +39 -0
- data/test/test_helper.rb +8 -0
- metadata +118 -46
- data/.gitignore +0 -2
- data/Gemfile +0 -11
- data/MIT-LICENSE +0 -22
- data/README.markdown +0 -20
- data/lib/assets/javascripts/livescript.js.erb +0 -1
- data/lib/assets/javascripts/prelude.js +0 -5
- data/lib/livescript/rails/engine.rb +0 -13
- data/lib/livescript/rails/template_handler.rb +0 -54
- data/lib/rails/generators/ls/assets/templates/javascript.js.ls +0 -3
- data/livescript-rails.gemspec +0 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 89baac6284e00ae511d5b6fa28e8a97e73cda85c
|
4
|
+
data.tar.gz: c78807f6abf85b513636da24a19f9d366b9221c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b6074ef31f06526bd6e034bbdf290d89f716a39dda69d8d7b6668c1f6f828b66a3a0c6594e1005d4e045c961ecbbd96e9494a3d251af1ea7117ec3be8d06dff
|
7
|
+
data.tar.gz: dae5afe948f9c04a09c06e5bdf18bebc1475e76c64e41c8ae5ccc5051c4b8fd7ebee45b9939ecbd636d640f50abd65042f096b95d62df7c0097a38976af2b36a
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Bian Jiaping
|
4
|
+
Copyright (c) 2012 Victor Hugo Borja
|
5
|
+
Copyright (c) 2011 Santiago Pastorino
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
15
|
+
copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# LiveScript-Rails
|
2
|
+
|
3
|
+
LiveScript adapter for the Rails asset pipeline.
|
4
|
+
|
5
|
+
Depends on [Roonin-mx/livescript-ruby](https://github.com/Roonin-mx/livescript-ruby) to compile LiveScript to javascript.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add the following lines to your `Gemfile`:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem 'livescript-rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
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.
|
16
|
+
|
17
|
+
```
|
18
|
+
group :assets do
|
19
|
+
gem 'livescript-rails'
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
You can set compile options in `config/initializers/assets.rb`:
|
26
|
+
|
27
|
+
```
|
28
|
+
# These are default options. User set options will override default options
|
29
|
+
Rails.application.config.assets.livescript = {
|
30
|
+
bare: true,
|
31
|
+
header: false,
|
32
|
+
map: 'linked-src',
|
33
|
+
}
|
34
|
+
```
|
35
|
+
|
36
|
+
See [Roonin-mx/livescript-ruby](https://github.com/Roonin-mx/livescript-ruby) for more options.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
MIT
|
data/Rakefile
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
|
4
1
|
require 'rake/testtask'
|
5
2
|
|
6
|
-
Rake::TestTask.new
|
7
|
-
t.libs << 'lib'
|
3
|
+
Rake::TestTask.new do |t|
|
8
4
|
t.libs << 'test'
|
9
|
-
t.pattern = 'test/**/*_test.rb'
|
10
|
-
t.verbose = false
|
11
5
|
end
|
12
6
|
|
7
|
+
desc 'Run tests'
|
8
|
+
task :default => :test
|
data/lib/livescript-rails.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module LiveScript
|
2
|
+
module Rails
|
3
|
+
module SprocketsProcessor
|
4
|
+
def self.cache_key
|
5
|
+
@cache_key ||= "#{name}:#{LiveScript::Source::VERSION}:#{LiveScript::VERSION}:#{LiveScript::Rails::VERSION}".freeze
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.call(input)
|
9
|
+
data = input[:data]
|
10
|
+
options = {
|
11
|
+
bare: true,
|
12
|
+
header: false,
|
13
|
+
map: 'linked-src',
|
14
|
+
filename: input[:source_path] || input[:filename],
|
15
|
+
}.merge(::Rails.application.config.assets.livescript || {})
|
16
|
+
|
17
|
+
result = input[:cache].fetch([self.cache_key, data]) do
|
18
|
+
LiveScript.compile(data, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# when map: none, result is String; otherwise, result is Hash
|
22
|
+
if result.kind_of? Hash
|
23
|
+
{
|
24
|
+
data: result['code'],
|
25
|
+
map: result['map'],
|
26
|
+
}
|
27
|
+
else
|
28
|
+
result
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'sprockets'
|
2
|
+
|
3
|
+
module LiveScript
|
4
|
+
module Rails
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
config.app_generators.javascript_engine :ls
|
7
|
+
|
8
|
+
initializer :register_livescript do |app|
|
9
|
+
Sprockets.register_mime_type 'text/livescript', extensions: ['.ls', '.js.ls']
|
10
|
+
Sprockets.register_transformer 'text/livescript', 'application/javascript', LiveScript::Rails::SprocketsProcessor
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require 'rails/generators/named_base'
|
2
2
|
|
3
3
|
module Ls
|
4
4
|
module Generators
|
5
5
|
class AssetsGenerator < ::Rails::Generators::NamedBase
|
6
|
-
source_root File.expand_path(
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
7
|
|
8
8
|
def copy_livescript
|
9
|
-
template
|
9
|
+
template 'javascript.ls', File.join('app/assets/javascripts', class_path, "#{file_name}.ls")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# You can use LiveScript (http://livescript.net/) in this file
|
@@ -0,0 +1 @@
|
|
1
|
+
alert 'hello'
|
data/test/test_assets.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'action_controller/railtie'
|
2
|
+
require 'sprockets/railtie'
|
3
|
+
|
4
|
+
class TestApp < Rails::Application
|
5
|
+
end
|
6
|
+
|
7
|
+
class AssetsTest < ActiveSupport::TestCase
|
8
|
+
def setup
|
9
|
+
FileUtils.mkdir_p tmp_path
|
10
|
+
|
11
|
+
@app = TestApp.new
|
12
|
+
|
13
|
+
@app.config.eager_load = false
|
14
|
+
@app.config.active_support.deprecation = :stderr
|
15
|
+
@app.config.assets.configure do |env|
|
16
|
+
env.cache = ActiveSupport::Cache.lookup_store(:memory_store)
|
17
|
+
end
|
18
|
+
@app.config.assets.paths << File.expand_path('../files/assets', __FILE__)
|
19
|
+
@app.paths['log'] = "#{tmp_path}/log/test.log"
|
20
|
+
@app.initialize!
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
FileUtils.rm_rf tmp_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def tmp_path
|
28
|
+
"#{File.expand_path('../tmp', __FILE__)}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def assets
|
32
|
+
@app.assets
|
33
|
+
end
|
34
|
+
|
35
|
+
test 'LiveScript is compiled to javascript correctlly' do
|
36
|
+
refute_nil assets['javascripts/hello.js']
|
37
|
+
assert_match "alert('hello')", assets['javascripts/hello.js'].source
|
38
|
+
end
|
39
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,105 +1,177 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: livescript-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Victor Hugo Borja
|
8
|
+
- Bian Jiaping
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2016-04-23 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: execjs
|
17
|
-
requirement:
|
18
|
-
none: false
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - "~>"
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version: '0'
|
20
|
+
version: '2.0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '2.0'
|
26
28
|
- !ruby/object:Gem::Dependency
|
27
29
|
name: livescript
|
28
|
-
requirement:
|
29
|
-
none: false
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- -
|
32
|
+
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
+
version: '2.3'
|
34
35
|
type: :runtime
|
35
36
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '2.3'
|
37
42
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
39
|
-
requirement:
|
40
|
-
none: false
|
43
|
+
name: sprockets
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
41
45
|
requirements:
|
42
|
-
- -
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.0'
|
49
|
+
- - "<="
|
43
50
|
- !ruby/object:Gem::Version
|
44
|
-
version: '0'
|
51
|
+
version: '5.0'
|
45
52
|
type: :runtime
|
46
53
|
prerelease: false
|
47
|
-
version_requirements:
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '3.0'
|
59
|
+
- - "<="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
48
62
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
50
|
-
requirement:
|
51
|
-
none: false
|
63
|
+
name: bundler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
52
65
|
requirements:
|
53
|
-
- -
|
66
|
+
- - "~>"
|
54
67
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
56
|
-
type: :
|
68
|
+
version: '1.11'
|
69
|
+
type: :development
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.11'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rake
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '11.1'
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '11.1'
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: minitest
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.8'
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '5.8'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: execjs
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.6'
|
111
|
+
type: :development
|
57
112
|
prerelease: false
|
58
|
-
version_requirements:
|
59
|
-
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.6'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rails
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.2'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.2'
|
132
|
+
description: Add LiveScript support to the Rails asset pipeline.
|
60
133
|
email:
|
61
134
|
- vic.borja@gmail.com
|
135
|
+
- ssbianjp@gmail.com
|
62
136
|
executables: []
|
63
137
|
extensions: []
|
64
138
|
extra_rdoc_files: []
|
65
139
|
files:
|
66
|
-
-
|
67
|
-
-
|
68
|
-
- MIT-LICENSE
|
69
|
-
- README.markdown
|
140
|
+
- LICENSE
|
141
|
+
- README.md
|
70
142
|
- Rakefile
|
71
|
-
- lib/assets/javascripts/livescript.js.erb
|
72
|
-
- lib/assets/javascripts/prelude.js
|
73
143
|
- lib/livescript-rails.rb
|
74
|
-
- lib/livescript/rails/
|
75
|
-
- lib/livescript/rails/
|
144
|
+
- lib/livescript/rails/processor.rb
|
145
|
+
- lib/livescript/rails/railtie.rb
|
76
146
|
- lib/livescript/rails/version.rb
|
77
147
|
- lib/rails/generators/ls/assets/assets_generator.rb
|
78
|
-
- lib/rails/generators/ls/assets/templates/javascript.
|
79
|
-
-
|
80
|
-
|
148
|
+
- lib/rails/generators/ls/assets/templates/javascript.ls
|
149
|
+
- test/files/assets/javascripts/hello.ls
|
150
|
+
- test/test_assets.rb
|
151
|
+
- test/test_helper.rb
|
81
152
|
homepage: https://github.com/Roonin-mx/livescript-rails
|
82
|
-
licenses:
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata: {}
|
83
156
|
post_install_message:
|
84
157
|
rdoc_options: []
|
85
158
|
require_paths:
|
86
159
|
- lib
|
87
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
161
|
requirements:
|
90
|
-
- -
|
162
|
+
- - ">="
|
91
163
|
- !ruby/object:Gem::Version
|
92
164
|
version: '0'
|
93
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
166
|
requirements:
|
96
|
-
- -
|
167
|
+
- - ">="
|
97
168
|
- !ruby/object:Gem::Version
|
98
169
|
version: '0'
|
99
170
|
requirements: []
|
100
171
|
rubyforge_project:
|
101
|
-
rubygems_version:
|
172
|
+
rubygems_version: 2.5.1
|
102
173
|
signing_key:
|
103
|
-
specification_version:
|
174
|
+
specification_version: 4
|
104
175
|
summary: LiveScript adapter for the Rails asset pipeline.
|
105
176
|
test_files: []
|
177
|
+
has_rdoc:
|
data/.gitignore
DELETED
data/Gemfile
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,20 +0,0 @@
|
|
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
|
-
|
18
|
-
### Prelude
|
19
|
-
LiveScript-Rails also includes prelude-ls (0.6).
|
20
|
-
Just use `//= require prelude` in your `application.js`.
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= LiveScript::Source.contents %>
|
@@ -1,5 +0,0 @@
|
|
1
|
-
// prelude.ls 0.6.0
|
2
|
-
// Copyright (c) 2012 George Zahariev
|
3
|
-
// Released under the MIT License
|
4
|
-
// raw.github.com/gkz/prelude-ls/master/LICNSE
|
5
|
-
this.prelude=function(){function Gt(e,t){return e.length>1?function(){var n=t?t.concat():[];return n.push.apply(n,arguments)<e.length&&arguments.length?Gt.call(this,e,n):e.apply(this,n)}:e}function Yt(e,t){var n=0,r=t.length>>>0;while(n<r)if(e===t[n++])return!0;return!1}function Zt(e){return function(){var t,n=arguments;for(t=e.length;t>0;--t)n=[e[t-1].apply(this,n)];return n[0]}}function en(e){return!e}function tn(e,t){var n={}.hasOwnProperty;for(var r in t)n.call(t,r)&&(e[r]=t[r]);return e}exports={};var e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K,Q,G,Y,Z,et,tt,nt,rt,it,st,ot,ut,at,ft,lt,ct,ht,pt,dt,vt,mt,gt,yt,bt,wt,Et,St,xt,Tt,Nt,Ct,kt,Lt,At,Ot,Mt,_t,Dt,Pt,Ht,Bt,jt,Ft,It,qt,Rt,Ut,zt,Wt,Xt,Vt,$t,Jt,Kt={}.toString,Qt=[].slice;return exports.objToFunc=e=function(e){return function(t){return e[t]}},exports.each=t=Gt(function(e,t){var n,r,i;if(Kt.call(t).slice(8,-1)==="Object")for(n in t)r=t[n],e(r);else for(n=0,i=t.length;n<i;++n)r=t[n],e(r);return t}),exports.map=n=Gt(function(t,n){var r,i,s,o,u,a,f,l={};Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){for(i in n)s=n[i],l[i]=t(s);return l}o=[];for(u=0,a=n.length;u<a;++u)s=n[u],o.push(t(s));return f=o,r==="String"?f.join(""):f}),exports.filter=r=Gt(function(t,n){var r,i,s,o,u,a,f,l={};Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){for(i in n)s=n[i],t(s)&&(l[i]=s);return l}o=[];for(u=0,a=n.length;u<a;++u)s=n[u],t(s)&&o.push(s);return f=o,r==="String"?f.join(""):f}),exports.reject=i=Gt(function(t,n){var r,i,s,o,u,a,f,l={};Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){for(i in n)s=n[i],t(s)||(l[i]=s);return l}o=[];for(u=0,a=n.length;u<a;++u)s=n[u],t(s)||o.push(s);return f=o,r==="String"?f.join(""):f}),exports.partition=s=Gt(function(t,n){var r,i,s,o,u,a,f;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){i={},s={};for(o in n)u=n[o],(t(u)?i:s)[o]=u}else{i=[],s=[];for(a=0,f=n.length;a<f;++a)u=n[a],(t(u)?i:s).push(u);r==="String"&&(i=i.join(""),s=s.join(""))}return[i,s]}),exports.find=o=Gt(function(t,n){var r,i,s;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t));if(Kt.call(n).slice(8,-1)==="Object")for(r in n){i=n[r];if(t(i))return i}else for(r=0,s=n.length;r<s;++r){i=n[r];if(t(i))return i}}),exports.head=a=exports.first=u=function(e){if(!e.length)return;return e[0]},exports.tail=f=function(e){if(!e.length)return;return e.slice(1)},exports.last=l=function(e){if(!e.length)return;return e[e.length-1]},exports.initial=c=function(e){if(!e.length)return;return e.slice(0,e.length-1)},exports.empty=h=function(e){var t;if(Kt.call(e).slice(8,-1)==="Object"){for(t in e)return!1;return!0}return!e.length},exports.values=p=function(e){var t,n,r=[];for(t in e)n=e[t],r.push(n);return r},exports.keys=d=function(e){var t,n=[];for(t in e)n.push(t);return n},exports.length=v=function(e){return Kt.call(e).slice(8,-1)==="Object"&&(e=p(e)),e.length},exports.cons=m=Gt(function(e,t){return Kt.call(t).slice(8,-1)==="String"?e+t:[e].concat(t)}),exports.append=g=Gt(function(e,t){return Kt.call(t).slice(8,-1)==="String"?e+t:e.concat(t)}),exports.join=y=Gt(function(e,t){return Kt.call(t).slice(8,-1)==="Object"&&(t=p(t)),t.join(e)}),exports.reverse=b=function(e){return Kt.call(e).slice(8,-1)==="String"?e.split("").reverse().join(""):e.slice().reverse()},exports.fold=E=exports.foldl=w=Gt(function(e,t,n){var r,i,s;if(Kt.call(n).slice(8,-1)==="Object")for(r in n)i=n[r],t=e(t,i);else for(r=0,s=n.length;r<s;++r)i=n[r],t=e(t,i);return t}),exports.fold1=x=exports.foldl1=S=Gt(function(e,t){return E(e,t[0],t.slice(1))}),exports.foldr=T=Gt(function(e,t,n){return E(e,t,n.reverse())}),exports.foldr1=N=Gt(function(e,t){return t.reverse(),E(e,t[0],t.slice(1))}),exports.unfoldr=exports.unfold=C=Gt(function(e,t){var n;return(n=e(t))!=null?[n[0]].concat(C(e,n[1])):[]}),exports.andList=k=function(e){return E(function(e,t){return e&&t},!0,e)},exports.orList=L=function(e){return E(function(e,t){return e||t},!1,e)},exports.any=A=Gt(function(t,n){return Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),E(function(e,n){return e||t(n)},!1,n)}),exports.all=O=Gt(function(t,n){return Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),E(function(e,n){return e&&t(n)},!0,n)}),exports.unique=M=function(e){var t,n,r,i;t=[];if(Kt.call(e).slice(8,-1)==="Object")for(n in e)r=e[n],Yt(r,t)||t.push(r);else for(n=0,i=e.length;n<i;++n)r=e[n],Yt(r,t)||t.push(r);return Kt.call(e).slice(8,-1)==="String"?t.join(""):t},exports.sort=_=function(e){return e.concat().sort(function(e,t){switch(!1){case!(e>t):return 1;case!(e<t):return-1;default:return 0}})},exports.sortBy=D=Gt(function(e,t){return t.length?t.concat().sort(e):[]}),exports.compare=P=Gt(function(e,t,n){switch(!1){case!(e(t)>e(n)):return 1;case!(e(t)<e(n)):return-1;default:return 0}}),exports.sum=H=function(e){var t,n,r,i;t=0;if(Kt.call(e).slice(8,-1)==="Object")for(n in e)r=e[n],t+=r;else for(n=0,i=e.length;n<i;++n)r=e[n],t+=r;return t},exports.product=B=function(e){var t,n,r,i;t=1;if(Kt.call(e).slice(8,-1)==="Object")for(n in e)r=e[n],t*=r;else for(n=0,i=e.length;n<i;++n)r=e[n],t*=r;return t},exports.mean=F=exports.average=j=function(e){return H(e)/v(e)},exports.concat=I=function(e){return E(g,[],e)},exports.concatMap=q=Gt(function(e,t){return I(n(e,t))}),exports.listToObj=R=function(e){var t,n,r,i;t={};for(n=0,r=e.length;n<r;++n)i=e[n],t[i[0]]=i[1];return t},exports.maximum=U=function(e){return x(gt,e)},exports.minimum=z=function(e){return x(yt,e)},exports.scan=X=exports.scanl=W=Gt(function(e,t,n){var r,i;return r=t,Kt.call(n).slice(8,-1)==="Object"?[t].concat(function(){var t,s,o=[];for(t in s=n)i=s[t],o.push(r=e(r,i));return o}()):[t].concat(function(){var t,s,o,u=[];for(t=0,o=(s=n).length;t<o;++t)i=s[t],u.push(r=e(r,i));return u}())}),exports.scan1=$=exports.scanl1=V=Gt(function(e,t){return X(e,t[0],t.slice(1))}),exports.scanr=J=Gt(function(e,t,n){return n.reverse(),X(e,t,n).reverse()}),exports.scanr1=K=Gt(function(e,t){return t.reverse(),X(e,t[0],t.slice(1)).reverse()}),exports.replicate=Q=Gt(function(e,t){var n,r;n=[],r=0;for(;r<e;++r)n.push(t);return n}),exports.take=G=Gt(function(e,t){switch(!1){case!(e<=0):return Kt.call(t).slice(8,-1)==="String"?"":[];case!!t.length:return t;default:return t.slice(0,e)}}),exports.drop=Y=Gt(function(e,t){switch(!1){case!(e<=0):return t;case!!t.length:return t;default:return t.slice(e)}}),exports.splitAt=Z=Gt(function(e,t){return[G(e,t),Y(e,t)]}),exports.takeWhile=et=Gt(function(t,n){var r,i,s,o;if(!n.length)return n;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=[];for(i=0,s=n.length;i<s;++i){o=n[i];if(!t(o))break;r.push(o)}return Kt.call(n).slice(8,-1)==="String"?r.join(""):r}),exports.dropWhile=tt=Gt(function(t,n){var r,i,s,o;if(!n.length)return n;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=0;for(i=0,s=n.length;i<s;++i){o=n[i];if(!t(o))break;++r}return Y(r,n)}),exports.span=nt=Gt(function(e,t){return[et(e,t),tt(e,t)]}),exports.breakIt=rt=Gt(function(e,t){return nt(Zt([en,e]),t)}),exports.zip=it=Gt(function(e,t){var n,r,i,s,o,u,a,f,l;n=[];for(r=0,s=(i=[e,t]).length;r<s;++r){o=i[r];for(u=0,a=o.length;u<a;++u)f=o[u],r===0&&n.push([]),(l=n[u])!=null&&l.push(f)}return n}),exports.zipWith=st=Gt(function(t,n,r){var i,s,o,u,a=[];Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t));if(!n.length||!r.length)return[];for(i=0,o=(s=it.call(this,n,r)).length;i<o;++i)u=s[i],a.push(t.apply(this,u));return a}),exports.zipAll=ot=function(){var e,t,n,r,i,s,o,u,a;e=Qt.call(arguments),t=[];for(n=0,r=e.length;n<r;++n){i=e[n];for(s=0,o=i.length;s<o;++s)u=i[s],n===0&&t.push([]),(a=t[s])!=null&&a.push(u)}return t},exports.zipAllWith=ut=function(t){var n,r,i,s,o,u=[];n=Qt.call(arguments,1),Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t));if(!n[0].length||!n[1].length)return[];for(r=0,s=(i=ot.apply(this,n)).length;r<s;++r)o=i[r],u.push(t.apply(this,o));return u},exports.compose=at=function(){var e;return e=Qt.call(arguments),function(){var t,n,r,i,s;t=arguments;for(n=0,i=(r=e).length;n<i;++n)s=r[n],t=[s.apply(this,t)];return t[0]}},exports.curry=ft=function(e){return Gt(e)},exports.id=lt=function(e){return e},exports.flip=ct=Gt(function(e,t,n){return e(n,t)}),exports.fix=ht=function(e){return function(t,n){return function(){return e(t(t)).apply(null,arguments)}}(function(t,n){return function(){return e(t(t)).apply(null,arguments)}})},exports.lines=pt=function(e){return e.length?e.split("\n"):[]},exports.unlines=dt=function(e){return e.join("\n")},exports.words=vt=function(e){return e.length?e.split(/[ ]+/):[]},exports.unwords=mt=function(e){return e.join(" ")},exports.max=gt=Gt(function(e,t){return e>t?e:t}),exports.min=yt=Gt(function(e,t){return e>t?t:e}),exports.negate=bt=function(e){return-e},exports.abs=wt=Math.abs,exports.signum=Et=function(e){switch(!1){case!(e<0):return-1;case!(e>0):return 1;default:return 0}},exports.quot=St=Gt(function(e,t){return~~(e/t)}),exports.rem=xt=Gt(function(e,t){return e%t}),exports.div=Tt=Gt(function(e,t){return Math.floor(e/t)}),exports.mod=Nt=Gt(function(e,t){var n;return(e%(n=t)+n)%n}),exports.recip=Ct=function(e){return 1/e},exports.pi=kt=Math.PI,exports.tau=Lt=kt*2,exports.exp=At=Math.exp,exports.sqrt=Ot=Math.sqrt,exports.ln=Mt=Math.log,exports.pow=_t=Gt(function(e,t){return Math.pow(e,t)}),exports.sin=Dt=Math.sin,exports.tan=Pt=Math.tan,exports.cos=Ht=Math.cos,exports.asin=Bt=Math.asin,exports.acos=jt=Math.acos,exports.atan=Ft=Math.atan,exports.atan2=It=Gt(function(e,t){return Math.atan2(e,t)}),exports.truncate=qt=function(e){return~~e},exports.round=Rt=Math.round,exports.ceiling=Ut=Math.ceil,exports.floor=zt=Math.floor,exports.isItNaN=Wt=function(e){return e!==e},exports.even=Xt=function(e){return e%2===0},exports.odd=Vt=function(e){return e%2!==0},exports.gcd=$t=Gt(function(e,t){var n;e=Math.abs(e),t=Math.abs(t);while(t!==0)n=e%t,e=t,t=n;return e}),exports.lcm=Jt=Gt(function(e,t){return Math.abs(Math.floor(e/$t(e,t)*t))}),exports.installPrelude=function(e){var t;if((t=e.prelude)==null||!t.isInstalled)tn(e,exports),e.prelude.isInstalled=!0},exports.prelude=exports,exports}()
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'rails/engine'
|
2
|
-
|
3
|
-
module LiveScript
|
4
|
-
module Rails
|
5
|
-
class Engine < ::Rails::Engine
|
6
|
-
config.app_generators.javascript_engine :ls
|
7
|
-
initializer :register_livescript do |app|
|
8
|
-
app.assets.register_engine '.ls', TiltTemplate
|
9
|
-
app.assets.register_engine '.livescript', TiltTemplate
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,54 +0,0 @@
|
|
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
|
-
|
data/livescript-rails.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
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
|