ruby-wisp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/wisp.rb +23 -0
- data/lib/wisp/runtime.rb +35 -0
- data/lib/wisp/runtime/compiler.js +6 -0
- data/lib/wisp/runtime/runner.js +20 -0
- data/lib/wisp/version.rb +3 -0
- data/ruby-wisp.gemspec +19 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eb09d11913057e974e0115457cbaf81d210642d4
|
4
|
+
data.tar.gz: 452aeebd8ec60dbc42945316febf25c340ada1da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d0fcfd9bfd0d4a3dd1f372a2a64fc633ffc77dbb492026aaebdf011cab0acc6141cc490da27ae3d75cc368bafa608314d6d0fa533f6c6b5f266be86c7357bfb5
|
7
|
+
data.tar.gz: 7dff623e9eec19f5ef08fd1057cd3010ddb33e8e8a3aa416c45c6f30fa37da4df2f365cc479fd3f6f6fd49ed141c497a83ed3e42dca8be0802069ce353c2d944
|
data/.gitignore
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# OS files
|
2
|
+
.DS_Store
|
3
|
+
.DS_Store?
|
4
|
+
._*
|
5
|
+
.Spotlight-V100
|
6
|
+
.Trashes
|
7
|
+
Icon?
|
8
|
+
ehthumbs.db
|
9
|
+
Thumbs.db
|
10
|
+
|
11
|
+
*.gem
|
12
|
+
*.rbc
|
13
|
+
.bundle
|
14
|
+
.config
|
15
|
+
.yardoc
|
16
|
+
Gemfile.lock
|
17
|
+
InstalledFiles
|
18
|
+
_yardoc
|
19
|
+
coverage
|
20
|
+
doc/
|
21
|
+
lib/bundler/man
|
22
|
+
pkg
|
23
|
+
rdoc
|
24
|
+
spec/reports
|
25
|
+
test/tmp
|
26
|
+
test/version_tmp
|
27
|
+
tmp
|
28
|
+
vendor
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Yuri Artemev
|
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,29 @@
|
|
1
|
+
# Ruby::Wisp
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'ruby-wisp'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install ruby-wisp
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/wisp.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'execjs'
|
2
|
+
require 'wisp/source'
|
3
|
+
require 'wisp/runtime'
|
4
|
+
|
5
|
+
module Wisp
|
6
|
+
extend Runtime
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def compile source, options = {}
|
10
|
+
source = source.read if source.respond_to?(:read)
|
11
|
+
|
12
|
+
exec 'compile', source
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def bundled_path
|
18
|
+
File.dirname Wisp::Source.bundled_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
ENV['NODE_PATH'] = "#{File.expand_path('node_modules')}:#{File.expand_path('vendor/node_modules')}:#{bundled_path}:#{ENV['NODE_PATH']}"
|
23
|
+
end
|
data/lib/wisp/runtime.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Wisp
|
2
|
+
module Runtime
|
3
|
+
|
4
|
+
def exec *arguments
|
5
|
+
check_availability!
|
6
|
+
context.call *arguments
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def check_availability!
|
12
|
+
unless runtime.available?
|
13
|
+
message = "The Node.JS runtime isn't available to Stylus."
|
14
|
+
message << "Ensure that the 'node' (or 'nodejs') executable is present in your $PATH."
|
15
|
+
raise RuntimeError, message
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def context
|
20
|
+
@context ||= runtime.compile script
|
21
|
+
end
|
22
|
+
|
23
|
+
def script
|
24
|
+
File.read File.expand_path('../runtime/compiler.js',__FILE__)
|
25
|
+
end
|
26
|
+
|
27
|
+
def runtime
|
28
|
+
@runtime ||= ExecJS::ExternalRuntime.new(
|
29
|
+
:name => 'Node.js (V8)',
|
30
|
+
:command => ["nodejs", "node"],
|
31
|
+
:runner_path => File.expand_path("../runtime/runner.js", __FILE__)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
(function(program, execJS) { execJS(program) })(function() { #{source}
|
2
|
+
}, function(program) {
|
3
|
+
var output, print = function(string) {
|
4
|
+
process.stdout.write('' + string);
|
5
|
+
};
|
6
|
+
try {
|
7
|
+
result = program();
|
8
|
+
if (typeof result == 'undefined' && result !== null) {
|
9
|
+
print('["ok"]');
|
10
|
+
} else {
|
11
|
+
try {
|
12
|
+
print(JSON.stringify(['ok', result]));
|
13
|
+
} catch (err) {
|
14
|
+
print('["err"]');
|
15
|
+
}
|
16
|
+
}
|
17
|
+
} catch (err) {
|
18
|
+
print(JSON.stringify(['err', '' + err]));
|
19
|
+
}
|
20
|
+
});
|
data/lib/wisp/version.rb
ADDED
data/ruby-wisp.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "wisp/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ruby-wisp"
|
7
|
+
s.version = Wisp::VERSION
|
8
|
+
s.authors = ["Yuri Artemev"]
|
9
|
+
s.email = ["i@artemeff.com"]
|
10
|
+
s.description = %q{Ruby Wisp is a bridge to the JS Wisp compiler}
|
11
|
+
s.summary = %q{Ruby Wisp compiler}
|
12
|
+
s.homepage = "https://github.com/artemeff/ruby-wisp"
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split($/)
|
16
|
+
|
17
|
+
s.add_dependency "ruby-wisp-source"
|
18
|
+
s.add_dependency "execjs"
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-wisp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuri Artemev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby-wisp-source
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: execjs
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Ruby Wisp is a bridge to the JS Wisp compiler
|
42
|
+
email:
|
43
|
+
- i@artemeff.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/wisp.rb
|
54
|
+
- lib/wisp/runtime.rb
|
55
|
+
- lib/wisp/runtime/compiler.js
|
56
|
+
- lib/wisp/runtime/runner.js
|
57
|
+
- lib/wisp/version.rb
|
58
|
+
- ruby-wisp.gemspec
|
59
|
+
homepage: https://github.com/artemeff/ruby-wisp
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Ruby Wisp compiler
|
83
|
+
test_files: []
|
84
|
+
has_rdoc:
|