execjs-runtimes-jxa 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 +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +27 -0
- data/Rakefile +1 -0
- data/bin/console +9 -0
- data/bin/setup +7 -0
- data/execjs-runtimes-jxa.gemspec +26 -0
- data/lib/execjs/runtimes/jxa.rb +17 -0
- data/lib/execjs/runtimes_jxa_version.rb +3 -0
- data/lib/execjs/support/jxa_runner.js +21 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cac5c6dd647725ccb4811c1f90b15760e06484c3
|
4
|
+
data.tar.gz: 24f10bd3e62a03e3f713b8de267ada6cb4727503
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f1ec631e162d6fef7347fa3bd75c865fa34ddc1c865a440ec56f1b9fed59629a25d46939a5ee5a46f1ee3895e41a3266ea2d9a93135e1cc4f512b27fe0c52fa
|
7
|
+
data.tar.gz: ea30659bec3c09105c1563da1d7105146869ecc5818e156a9a7570f3e4c7aec156b12c5facf23488fa09c27597623f6fd13d2b8f1e734d52f286eed70876dba8
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 meganemura
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# ExecJS::Runtimes::JXA
|
2
|
+
|
3
|
+
[ExecJS](https://github.com/rails/execjs) Runtime for JXA (JavaScript for Automation) using `osascript -l JavaScript`.
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
gem 'execjs-runtimes-jxa'
|
7
|
+
```
|
8
|
+
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'execjs/runtimes/jxa'
|
14
|
+
ExecJS.runtime = ExecJS::Runtimes::JXA # Set JXA as a runtime for ExecJS
|
15
|
+
ExecJS.exec('var app = Application("iTunes"); app.activate()')
|
16
|
+
ExecJS.eval('1 + 1') # => 2
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/meganemura/execjs-runtimes-jxa.
|
23
|
+
|
24
|
+
|
25
|
+
## License
|
26
|
+
|
27
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'execjs/runtimes_jxa_version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "execjs-runtimes-jxa"
|
8
|
+
spec.version = ExecJS::RUNTIMES_JXA_VERSION
|
9
|
+
spec.authors = ["meganemura"]
|
10
|
+
spec.email = ["meganemura@users.noreply.github.com"]
|
11
|
+
|
12
|
+
spec.summary = "ExecJS Runtime for JXA (JavaScript for Automation)"
|
13
|
+
spec.homepage = "https://github.com/meganemura/execjs-runtimes-jxa"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "execjs"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "pry"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "execjs/runtimes"
|
2
|
+
require "execjs/runtimes_jxa_version"
|
3
|
+
|
4
|
+
module ExecJS
|
5
|
+
module Runtimes
|
6
|
+
JXA = ExternalRuntime.new(
|
7
|
+
name: "JXA",
|
8
|
+
command: "/usr/bin/osascript -l JavaScript",
|
9
|
+
runner_path: File.expand_path("../..", __FILE__) + "/support/jxa_runner.js"
|
10
|
+
)
|
11
|
+
|
12
|
+
# Call self.runtimes once to set built-in runtimes into @runtimes
|
13
|
+
self.runtimes
|
14
|
+
|
15
|
+
@runtimes << JXA
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
(function(program, execJS) { execJS(program) })(function() { #{source}
|
2
|
+
}, function(program) {
|
3
|
+
var output;
|
4
|
+
var print = function (string) {
|
5
|
+
console.log(string);
|
6
|
+
};
|
7
|
+
try {
|
8
|
+
result = program();
|
9
|
+
if (typeof result == 'undefined' && result !== null) {
|
10
|
+
print('["ok"]');
|
11
|
+
} else {
|
12
|
+
try {
|
13
|
+
print(JSON.stringify(['ok', result]));
|
14
|
+
} catch (err) {
|
15
|
+
print(JSON.stringify(['err', '' + err, err.stack]));
|
16
|
+
}
|
17
|
+
}
|
18
|
+
} catch (err) {
|
19
|
+
print(JSON.stringify(['err', '' + err, err.stack]));
|
20
|
+
}
|
21
|
+
});
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: execjs-runtimes-jxa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- meganemura
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: execjs
|
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: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- meganemura@users.noreply.github.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- execjs-runtimes-jxa.gemspec
|
86
|
+
- lib/execjs/runtimes/jxa.rb
|
87
|
+
- lib/execjs/runtimes_jxa_version.rb
|
88
|
+
- lib/execjs/support/jxa_runner.js
|
89
|
+
homepage: https://github.com/meganemura/execjs-runtimes-jxa
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.2.2
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: ExecJS Runtime for JXA (JavaScript for Automation)
|
113
|
+
test_files: []
|