quartz 0.2.1 → 0.2.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 +4 -4
- data/VERSION +1 -1
- data/go/quartz/quartz.go +4 -2
- data/lib/quartz/go_process.rb +11 -5
- data/lib/quartz/go_struct.rb +1 -1
- data/lib/quartz.rb +8 -1
- data/quartz.gemspec +5 -5
- data/spec/go_process_spec.rb +2 -2
- data/spec/go_struct_spec.rb +9 -1
- data/spec/test.go +6 -0
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9b32688049786025781cf7243a2cab933d83d0d
|
4
|
+
data.tar.gz: ca72a56ea8e7098daf9a05560353e0982c3c67b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 979ad4c2465c424464c0f40ac89f0671959ec27f6d91cbfe45099b409fa9d95ae45a325d5a3a230c69066d203a29f5d0281e85747f639539c1b74846dceec52d
|
7
|
+
data.tar.gz: 86fad9d659b2912ba1bab12afe798f7eb44477062737a770e69db3865ad5351428da0bbf1c00edb2f09b71dac4d5bf772a45747991c607ca9a0cad05af2b2e28
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/go/quartz/quartz.go
CHANGED
@@ -102,8 +102,10 @@ func (q *Quartz) Call(args *CallArgs, response *interface{}) error {
|
|
102
102
|
unmarshallerValue.Call([]reflect.Value{methodArgsValue, argStructPointer})
|
103
103
|
|
104
104
|
// Call the method
|
105
|
-
|
106
|
-
|
105
|
+
err := method.Func.Call([]reflect.Value{structValue, argStruct, responseValuePointer})
|
106
|
+
if !err[0].IsNil() {
|
107
|
+
return err[0].Interface().(error)
|
108
|
+
}
|
107
109
|
|
108
110
|
// Set this method's response value
|
109
111
|
rpcResponse := reflect.Indirect(responseValuePointer)
|
data/lib/quartz/go_process.rb
CHANGED
@@ -92,14 +92,20 @@ class Quartz::GoProcess
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def cleanup
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
unless @killed_go_process
|
96
|
+
Process.kill('SIGTERM', pid)
|
97
|
+
Process.wait(pid)
|
98
|
+
@killed_go_process = true
|
99
|
+
end
|
100
|
+
|
101
|
+
if @temp_file_path && File.exists?(@temp_file_path)
|
102
|
+
File.delete(@temp_file_path)
|
103
|
+
end
|
99
104
|
end
|
100
105
|
|
101
106
|
def self.cleanup
|
102
|
-
processes.each
|
107
|
+
@processes.each(&:cleanup)
|
108
|
+
@processes = []
|
103
109
|
end
|
104
110
|
|
105
111
|
end
|
data/lib/quartz/go_struct.rb
CHANGED
data/lib/quartz.rb
CHANGED
@@ -2,9 +2,16 @@ require 'json'
|
|
2
2
|
require 'socket'
|
3
3
|
|
4
4
|
module Quartz
|
5
|
-
|
5
|
+
class ResponseError < StandardError; end
|
6
6
|
end
|
7
7
|
|
8
8
|
require 'quartz/go_process'
|
9
9
|
require 'quartz/go_struct'
|
10
10
|
require 'quartz/client'
|
11
|
+
|
12
|
+
# Check if go is installed
|
13
|
+
go_exists = ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
|
14
|
+
File.exist?(File.join(directory, 'go'))
|
15
|
+
end
|
16
|
+
|
17
|
+
raise 'Go not installed' unless go_exists
|
data/quartz.gemspec
CHANGED
@@ -2,15 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: quartz 0.2.
|
5
|
+
# stub: quartz 0.2.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "quartz"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
12
13
|
s.authors = ["David Huie"]
|
13
|
-
s.date = "2014-06-
|
14
|
+
s.date = "2014-06-23"
|
14
15
|
s.description = "A gem for calling Go code from Ruby"
|
15
16
|
s.email = "dahuie@gmail.com"
|
16
17
|
s.extra_rdoc_files = [
|
@@ -42,8 +43,7 @@ Gem::Specification.new do |s|
|
|
42
43
|
]
|
43
44
|
s.homepage = "http://github.com/DavidHuie/quartz"
|
44
45
|
s.licenses = ["MIT"]
|
45
|
-
s.
|
46
|
-
s.rubygems_version = "2.1.11"
|
46
|
+
s.rubygems_version = "2.2.2"
|
47
47
|
s.summary = "A gem for calling Go code from Ruby"
|
48
48
|
|
49
49
|
if s.respond_to? :specification_version then
|
data/spec/go_process_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Quartz::GoProcess do
|
|
9
9
|
context 'with a go file' do
|
10
10
|
|
11
11
|
it 'pulls metadata' do
|
12
|
-
process.get_metadata.should eq(
|
12
|
+
process.get_metadata.should eq("adder" => {"NameToMethodMetadata"=>{"Add"=>{"ArgumentToType"=>{"A"=>"int", "B"=>"int"}}, "AddError"=>{"ArgumentToType"=>{"A"=>"int", "B"=>"int"}}}})
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
@@ -51,7 +51,7 @@ describe Quartz::GoProcess do
|
|
51
51
|
it "it kills child processes" do
|
52
52
|
File.exists?(process.temp_file_path).should be_true
|
53
53
|
process.cleanup
|
54
|
-
|
54
|
+
$?.exited?.should be_true
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
data/spec/go_struct_spec.rb
CHANGED
@@ -8,7 +8,9 @@ describe Quartz::GoStruct do
|
|
8
8
|
|
9
9
|
let(:struct) do
|
10
10
|
Quartz::GoStruct.new("adder",
|
11
|
-
{"NameToMethodMetadata"=>{"Add"=>{"ArgumentToType"=>{"A"=>"int", "B"=>"int"}}
|
11
|
+
{"NameToMethodMetadata"=>{"Add"=>{"ArgumentToType"=>{"A"=>"int", "B"=>"int"}},
|
12
|
+
"AddError"=>{"ArgumentToType"=>{"A"=>"int", "B"=>"int"}}
|
13
|
+
}}, process)
|
12
14
|
end
|
13
15
|
|
14
16
|
it 'is able to call a struct' do
|
@@ -16,6 +18,12 @@ describe Quartz::GoStruct do
|
|
16
18
|
response.should eq({'X' => 6})
|
17
19
|
end
|
18
20
|
|
21
|
+
it 'raises an exception when an error is returned' do
|
22
|
+
expect do
|
23
|
+
struct.call('AddError', { 'A' => 5, 'B' => 6 })
|
24
|
+
end.to raise_error(Quartz::ResponseError)
|
25
|
+
end
|
26
|
+
|
19
27
|
end
|
20
28
|
|
21
29
|
end
|
data/spec/test.go
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
package main
|
2
2
|
|
3
3
|
import (
|
4
|
+
"errors"
|
5
|
+
|
4
6
|
"github.com/DavidHuie/quartz/go/quartz"
|
5
7
|
)
|
6
8
|
|
@@ -20,6 +22,10 @@ func (t *Test) Add(args Args, response *Response) error {
|
|
20
22
|
return nil
|
21
23
|
}
|
22
24
|
|
25
|
+
func (t *Test) AddError(args Args, response *Response) error {
|
26
|
+
return errors.New("Adding error")
|
27
|
+
}
|
28
|
+
|
23
29
|
func main() {
|
24
30
|
a := &Test{}
|
25
31
|
quartz.RegisterName("adder", a)
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quartz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Huie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.8.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jeweler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.0.1
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.0.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.8.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.8.2
|
55
55
|
description: A gem for calling Go code from Ruby
|
@@ -60,8 +60,8 @@ extra_rdoc_files:
|
|
60
60
|
- LICENSE.txt
|
61
61
|
- README.md
|
62
62
|
files:
|
63
|
-
- .rspec
|
64
|
-
- .travis.yml
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
65
|
- Gemfile
|
66
66
|
- Gemfile.lock
|
67
67
|
- LICENSE.txt
|
@@ -91,17 +91,17 @@ require_paths:
|
|
91
91
|
- lib
|
92
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.2.2
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: A gem for calling Go code from Ruby
|