sprockets-illusionist 0.0.1
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/.gitignore +17 -0
- data/Gemfile +2 -0
- data/LICENSE.md +26 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/lib/sprockets-illusionist.rb +12 -0
- data/lib/sprockets_illusionist/config.rb +11 -0
- data/lib/sprockets_illusionist/engine.rb +8 -0
- data/lib/sprockets_illusionist/illusionist_template.rb +35 -0
- data/lib/sprockets_illusionist/version.rb +3 -0
- data/sprockets-illusionist.gemspec +24 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7d686729c107a708076b8f9ade61d30477e4269a
|
4
|
+
data.tar.gz: 552271821ffa535d551da195fb841cb068b9c1b8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b2da32a23f87e767bf570f77d20bf0a5270f7058863674ad86e027c2a5bcef2955f1eb8cb3abacbc000d2d581ef91ec21268af92d354f228f0d4f82d95f6921
|
7
|
+
data.tar.gz: c5968a9e94ad652ac30d3732b80f4626d0bed6b2766968e9397c4eceba3ebbc050e5af8ba2ed4c87fc65642fd76209531754596967475876e1e36d2ca7e3cc48
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2014, Mirego
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
- Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
- Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
- Neither the name of the Mirego nor the names of its contributors may
|
13
|
+
be used to endorse or promote products derived from this software without
|
14
|
+
specific prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
19
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
20
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
21
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
22
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
23
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
24
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
25
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
26
|
+
POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# sprockets-illusionist
|
2
|
+
|
3
|
+
`sprockets-illusionist` makes it possible to transpile your ES6 files into ES5 using the [Illusionist node module](https://github.com/mirego/illusionist) and Sprockets.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
First, you will need the [Illusionist](https://github.com/mirego/illusionist) node package:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ npm install -g illusionist
|
11
|
+
```
|
12
|
+
|
13
|
+
Add this line to your application’s Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'sprockets-illusionist'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
$ bundle
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
### Setting the `base_path`
|
28
|
+
|
29
|
+
The `base_path` setting is used to name modules. Module names are relative paths to `base_path`, if you don’t set it, only the file name is used.
|
30
|
+
|
31
|
+
#### Using Rails
|
32
|
+
|
33
|
+
Create an initializer:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
SprocketsIllusionist::Config.configure do |config|
|
37
|
+
config.base_path = Rails.root.join('app', 'assets', 'javascripts')
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
With this configuration, a file named:
|
42
|
+
|
43
|
+
```
|
44
|
+
/projects/MyApp/app/assets/javascripts/controllers/foo_controller.js.es6
|
45
|
+
```
|
46
|
+
|
47
|
+
will yield a module named:
|
48
|
+
|
49
|
+
```
|
50
|
+
controllers/foo_controller
|
51
|
+
```
|
52
|
+
|
53
|
+
### Writing ES6 files
|
54
|
+
|
55
|
+
With `sprockets-illusionist` just write your JavaScript files with the extension `.js.es6` and everything will be transpiled for you.
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
`sprockets-illusionist` is © 2014 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause).
|
60
|
+
See the [`LICENSE.md`](https://github.com/mirego/sprockets-illusionist/blob/master/LICENSE.md) file.
|
61
|
+
|
62
|
+
## About Mirego
|
63
|
+
|
64
|
+
Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We proudly build mobile applications for [iPhone](http://mirego.com/en/iphone-app-development/ "iPhone application development"), [iPad](http://mirego.com/en/ipad-app-development/ "iPad application development"), [Android](http://mirego.com/en/android-app-development/ "Android application development"), [Blackberry](http://mirego.com/en/blackberry-app-development/ "Blackberry application development"), [Windows Phone](http://mirego.com/en/windows-phone-app-development/ "Windows Phone application development") and [Windows 8](http://mirego.com/en/windows-8-app-development/ "Windows 8 application development") in beautiful Quebec City.
|
65
|
+
|
66
|
+
We also love [open-source software](http://open.mirego.com/) and we try to extract as much code as possible from our projects to give back to the community.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'sprockets_illusionist/version'
|
2
|
+
require 'sprockets_illusionist/config'
|
3
|
+
require 'sprockets_illusionist/illusionist_template'
|
4
|
+
|
5
|
+
module SprocketsIllusionist
|
6
|
+
if defined?(Rails) && defined?(::Rails::Engine)
|
7
|
+
require 'sprockets_illusionist/engine'
|
8
|
+
else
|
9
|
+
require 'sprockets'
|
10
|
+
Sprockets.register_engine('.es6', IllusionistTemplate)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'open3'
|
3
|
+
require 'tilt'
|
4
|
+
|
5
|
+
module SprocketsIllusionist
|
6
|
+
class IllusionistTemplate < Tilt::Template
|
7
|
+
self.default_mime_type = 'application/javascript'
|
8
|
+
|
9
|
+
def amd_module_name
|
10
|
+
base_path = SprocketsIllusionist::Config.base_path
|
11
|
+
file_name = File.basename(file, '.js.es6')
|
12
|
+
|
13
|
+
if !base_path.nil?
|
14
|
+
path = Pathname.new(file)
|
15
|
+
dirname = File.dirname(path.relative_path_from(base_path))
|
16
|
+
|
17
|
+
if dirname == '.'
|
18
|
+
file_name
|
19
|
+
else
|
20
|
+
File.join(dirname, file_name)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
file_name
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def prepare
|
28
|
+
end
|
29
|
+
|
30
|
+
def evaluate(scope, locals, &block)
|
31
|
+
stdout, _stderr, _status = Open3.capture3("illusionist -p -m #{amd_module_name}", stdin_data: data)
|
32
|
+
stdout
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sprockets_illusionist/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'sprockets-illusionist'
|
8
|
+
spec.version = SprocketsIllusionist::VERSION
|
9
|
+
spec.authors = ['Charles Demers']
|
10
|
+
spec.email = ["cdemers@mirego.com"]
|
11
|
+
spec.summary = 'Transpile your ES6 files into ES5 using the Illusionist node module and Sprockets'
|
12
|
+
spec.description = 'Transpile your ES6 files into ES5 using the Illusionist node module and Sprockets'
|
13
|
+
spec.homepage = 'https://github.com/mirego/sprockets-illusionist'
|
14
|
+
spec.license = 'BSD 3-Clause'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_dependency 'sprockets', '~> 2.10.1'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sprockets-illusionist
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Charles Demers
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sprockets
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.10.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.10.1
|
55
|
+
description: Transpile your ES6 files into ES5 using the Illusionist node module and
|
56
|
+
Sprockets
|
57
|
+
email:
|
58
|
+
- cdemers@mirego.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.md
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/sprockets-illusionist.rb
|
69
|
+
- lib/sprockets_illusionist/config.rb
|
70
|
+
- lib/sprockets_illusionist/engine.rb
|
71
|
+
- lib/sprockets_illusionist/illusionist_template.rb
|
72
|
+
- lib/sprockets_illusionist/version.rb
|
73
|
+
- sprockets-illusionist.gemspec
|
74
|
+
homepage: https://github.com/mirego/sprockets-illusionist
|
75
|
+
licenses:
|
76
|
+
- BSD 3-Clause
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.2.1
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Transpile your ES6 files into ES5 using the Illusionist node module and Sprockets
|
98
|
+
test_files: []
|