ruby-await-node 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 450ba09014e24cfd92d646e03dbdaa4b3bc4f867
4
- data.tar.gz: f9b9a15aa7d56aedd26af82650f574fc53b9e947
3
+ metadata.gz: 403ac9706145f1e9f6cbc13864251c46b2373362
4
+ data.tar.gz: f17935185a4aa8b138d7308a4cac54dfb4469974
5
5
  SHA512:
6
- metadata.gz: 0cb5c3440f8bfeca49eeab6021b8aeb1efc82450cf2039c4c700921ee6fc09624f99742372b0cc8c3f4d2d25f845d9831838655026d87e9d31d6928bdeb0fdc8
7
- data.tar.gz: c2fd46e29a35ec2bcad25b6bb3a5e9ac0e4611266bea5a51837477c9038312f2207910562fed723260826a32f741725739257efd783270e75f4fe179840211f8
6
+ metadata.gz: 05425ac33627f0f30a7aa417113662c7738196005d04219be447afa09bcd35855e0042d01692d1a2c51dac4a027e6a5cb944539b394f152bb803045a98d7dd9d
7
+ data.tar.gz: 379139489c13779ae81134136d56abcc5d5bfc1057ade548e20de3ba2d5210e5f495defa7532b379c5fc57400075486c7e855f0e438d419b3fc34f5c12a9f14c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-await-node (1.2.2)
4
+ ruby-await-node (0.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -21,13 +21,12 @@ where ruby fall short
21
21
 
22
22
  - [x] Execute any javascript from ruby
23
23
  - [x] Pass all test
24
- - [ ] Execute await/async method
25
- - [ ] Use zeromq instead of http webserver to design away port conflicting
24
+ - [x] Execute await/async method
26
25
 
27
26
  # Getting Started
28
27
 
29
28
  ```ruby
30
- gem 'ruby-await-node', '~> 1.0'
29
+ gem 'ruby-await-node'
31
30
  ```
32
31
 
33
32
  Or if you want to run the latest version
@@ -23,6 +23,10 @@ module RubyAwaitNode
23
23
  end
24
24
  end
25
25
 
26
+ def load(path)
27
+ exec("require(#{path.to_json})")
28
+ end
29
+
26
30
  def exec(src)
27
31
  return "" unless src.length > 0
28
32
 
@@ -1,3 +1,3 @@
1
1
  module RubyAwaitNode
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -18,10 +18,10 @@ describe RubyAwaitNode do
18
18
  end
19
19
 
20
20
  context "simple javascript" do
21
- it "returns desired value" do
22
- js_result = create_ruby_await_node_context.eval(return_42)
23
- expect(js_result).to eq 42
24
- end
21
+ it "returns desired value" do
22
+ js_result = create_ruby_await_node_context.eval(return_42)
23
+ expect(js_result).to eq 42
24
+ end
25
25
  end
26
26
 
27
27
  context "await javascript" do
@@ -31,6 +31,16 @@ describe RubyAwaitNode do
31
31
  end
32
32
  end
33
33
 
34
+ describe "load an entry file" do
35
+ it "loads correctly" do
36
+ path = File.expand_path("sample_entry.js", __dir__)
37
+ context = create_ruby_await_node_context
38
+ context.load(path)
39
+ js_result = context.eval("global.entryName")
40
+ expect(js_result).to eq "sample"
41
+ end
42
+ end
43
+
34
44
  it "raises an RubyAwaitNode::ProgramError on error" do
35
45
  expect {
36
46
  create_ruby_await_node_context.eval("(function() { throw new Error('foo\\nbar', 0, 'test.js'); })()")
@@ -0,0 +1 @@
1
+ global.entryName = "sample"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-await-node
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phuong Nguyen
@@ -64,6 +64,7 @@ files:
64
64
  - ruby-await-node.js
65
65
  - spec/fork_test_harness.rb
66
66
  - spec/ruby_await_node_spec.rb
67
+ - spec/sample_entry.js
67
68
  - spec/spec_helper.rb
68
69
  homepage: https://github.com/remitano/ruby-await-node
69
70
  licenses: