sprockets-dart 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +4 -0
- data/lib/sprockets-dart.rb +4 -0
- data/lib/sprockets_dart.rb +43 -0
- data/sprockets-dart.gemspec +26 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTcyMGIwM2NlZWMwMDcyNWE5ZjZlOTM0MWMxOWIxZjA3ZWM0ODRhMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2IyNzIwYzliMGZlNDc4MDgwMDY5NjQ4YzM2YzI4MjIwMTlmYjI1YQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OWRiMjkxMjk1NzUzZjgzMjNkNDcxYjhlN2U1YWE1ZWRlYjA2MGE5NjllYjg1
|
10
|
+
ZWNiMjZiMmY3OWM2OTdjNzdjY2M0M2I0N2JiMWU1NzBhZTA3MTM0MjBmOTIy
|
11
|
+
NDk2MGMyOWQ5NmExYzI1ZmQyM2E3MjUzYzBjN2U2YjE3NGMyYTI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODkzZDMwZDRkOWQwZWJiZjA0OGQ3MTAwMTM4NzcxZjY4NWNlNDM0ZjdlMGE3
|
14
|
+
MDFmMGRjMTU0ODc1ZDQ2YzI4YjJjZjhmMDdmZTljMzY3MTIyOTYzM2JhZTQ3
|
15
|
+
MjVjNThiZmU0NTQ0ZWNiY2Q4MGY4ODIzOWM1M2FmMTQyY2RkODY=
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Michael
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require "tilt"
|
2
|
+
|
3
|
+
module Sprockets
|
4
|
+
class DartTemplate < Tilt::Template
|
5
|
+
self.default_mime_type = "application/javascript"
|
6
|
+
|
7
|
+
module Dart
|
8
|
+
module Dart2Js
|
9
|
+
def self.command; "dart2js" end
|
10
|
+
def self.exec(input_path, output_path)
|
11
|
+
stdout = `#{command} --out=#{output_path} #{input_path}`
|
12
|
+
return stdout, $?.success?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Dart2JsError < Exception; end
|
17
|
+
|
18
|
+
def self.compile(path)
|
19
|
+
dartfile = File.open(path)
|
20
|
+
dartpath = dartfile.path
|
21
|
+
jspath = "#{dartpath}.js"
|
22
|
+
|
23
|
+
msg, success = Dart2Js.exec(dartpath, jspath)
|
24
|
+
|
25
|
+
if !success
|
26
|
+
raise Dart2JsError, msg
|
27
|
+
end
|
28
|
+
|
29
|
+
result = IO.read(jspath)
|
30
|
+
result
|
31
|
+
ensure
|
32
|
+
dartfile.close
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def prepare
|
37
|
+
end
|
38
|
+
|
39
|
+
def evaluate(context, locals, &block)
|
40
|
+
@output ||= Dart.compile(file)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'sprockets-dart'
|
3
|
+
s.version = '0.1'
|
4
|
+
s.date = '2013-11-20'
|
5
|
+
|
6
|
+
s.description = "DartEngine for sprockets"
|
7
|
+
s.summary = s.description
|
8
|
+
s.license = "MIT"
|
9
|
+
|
10
|
+
s.authors = ["Michael Lutsiuk"]
|
11
|
+
s.email = "mmaccoffe@gmail.com"
|
12
|
+
|
13
|
+
s.files = %w[
|
14
|
+
lib/sprockets-dart.rb
|
15
|
+
lib/sprockets_dart.rb
|
16
|
+
Gemfile
|
17
|
+
README.md
|
18
|
+
LICENSE
|
19
|
+
sprockets-dart.gemspec
|
20
|
+
]
|
21
|
+
|
22
|
+
s.add_dependency 'sprockets', '>= 2.0'
|
23
|
+
|
24
|
+
s.homepage = "http://github.com/mediaslave24/sprockets-dart/"
|
25
|
+
s.require_paths = %w[lib]
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sprockets-dart
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Lutsiuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sprockets
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description: DartEngine for sprockets
|
28
|
+
email: mmaccoffe@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/sprockets-dart.rb
|
34
|
+
- lib/sprockets_dart.rb
|
35
|
+
- Gemfile
|
36
|
+
- README.md
|
37
|
+
- LICENSE
|
38
|
+
- sprockets-dart.gemspec
|
39
|
+
homepage: http://github.com/mediaslave24/sprockets-dart/
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 2.1.5
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: DartEngine for sprockets
|
63
|
+
test_files: []
|