quartz 0.2.3 → 0.2.4
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/README.md +6 -2
- data/VERSION +1 -1
- data/examples/lookup_dns.go +2 -0
- data/go/quartz/quartz.go +1 -1
- data/lib/quartz.rb +3 -6
- data/lib/quartz/validations.rb +25 -0
- data/quartz.gemspec +5 -4
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91e68a31484058746ae143cb282f937a99b10b63
|
4
|
+
data.tar.gz: c7b3119b2f4628dbcdc7888d478d8e6f533778e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 090d499ed69646a90a667f09b4d8bfc27cb9fbfab492943dcc8bb76da79ed28b799022457b57a0165defe8a3b587988e304f92050d15e855668c69f38408a691
|
7
|
+
data.tar.gz: 53b8de60e6f2acc60c5af92e130b70ac3405a49f72633c426c44d97bd02bd654c59577c6320ba28212da39ecd122b37b350383d2d7584e6439692e6a8711ac7b
|
data/README.md
CHANGED
@@ -17,9 +17,9 @@ the `examples/` directory.
|
|
17
17
|
|
18
18
|
Quartz shares Go code by exporting methods on a struct to Ruby.
|
19
19
|
|
20
|
-
Quartz requires that all arguments to exported struct methods be JSON
|
20
|
+
Quartz requires that all arguments to exported struct methods be JSON serializable
|
21
21
|
types. Additionally, the arguments to an exported method should be of the form
|
22
|
-
`(A, *B)`, where `A` and `B` are JSON
|
22
|
+
`(A, *B)`, where `A` and `B` are JSON serializable types. The method should also
|
23
23
|
return an error. Here's an example of an exportable struct and method:
|
24
24
|
|
25
25
|
```go
|
@@ -40,6 +40,10 @@ func (t *Adder) Add(args Args, response *Response) error {
|
|
40
40
|
}
|
41
41
|
```
|
42
42
|
|
43
|
+
For more information regarding Go's RPC rules, which must still be followed
|
44
|
+
when using quartz, please examine the official documentation for
|
45
|
+
the `net/rpc` package [here](http://golang.org/pkg/net/rpc/).
|
46
|
+
|
43
47
|
## Preparing a Quartz RPC server in Go
|
44
48
|
|
45
49
|
Instead of integrating Quartz into an existing Go application,
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/examples/lookup_dns.go
CHANGED
@@ -16,6 +16,8 @@ type FindIPsResponse struct {
|
|
16
16
|
HostnameToIPs map[string][]net.IP
|
17
17
|
}
|
18
18
|
|
19
|
+
// Concurrently resolves all hostnames in the input struct
|
20
|
+
// to IPs.
|
19
21
|
func (r *Resolver) FindIPs(args FindIPsArgs, response *FindIPsResponse) error {
|
20
22
|
*response = FindIPsResponse{}
|
21
23
|
response.HostnameToIPs = make(map[string][]net.IP)
|
data/go/quartz/quartz.go
CHANGED
@@ -15,7 +15,7 @@ type Quartz struct {
|
|
15
15
|
Registry map[string]*StructMetadata
|
16
16
|
}
|
17
17
|
|
18
|
-
//
|
18
|
+
// Returns the struct registry. This method is exported via RPC
|
19
19
|
// so that the Ruby client can have knowledge about which structs and
|
20
20
|
// which methods are exported.
|
21
21
|
func (q *Quartz) GetMetadata(_ interface{}, value *map[string]*StructMetadata) error {
|
data/lib/quartz.rb
CHANGED
@@ -8,10 +8,7 @@ end
|
|
8
8
|
require 'quartz/go_process'
|
9
9
|
require 'quartz/go_struct'
|
10
10
|
require 'quartz/client'
|
11
|
+
require 'quartz/validations'
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
File.exist?(File.join(directory, 'go'))
|
15
|
-
end
|
16
|
-
|
17
|
-
raise 'Go not installed' unless go_exists
|
13
|
+
Quartz::Validations.check_for_go
|
14
|
+
Quartz::Validations.check_go_quartz_version
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Quartz::Validations
|
2
|
+
|
3
|
+
def self.check_for_go
|
4
|
+
go_exists = ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
|
5
|
+
File.exist?(File.join(directory, 'go'))
|
6
|
+
end
|
7
|
+
|
8
|
+
raise 'Go not installed' unless go_exists
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.check_go_quartz_version
|
12
|
+
current_pulse = File.read(File.join(File.dirname(__FILE__), '../../go/quartz/quartz.go'))
|
13
|
+
installed_pulse = File.read(File.join(ENV['GOPATH'],
|
14
|
+
'src/github.com/DavidHuie/quartz/go/quartz/quartz.go'))
|
15
|
+
|
16
|
+
if current_pulse != installed_pulse
|
17
|
+
STDERR.write <<-EOS
|
18
|
+
Warning: the version of Quartz in $GOPATH does not match
|
19
|
+
the version packaged with the gem. Please update the Go
|
20
|
+
Quartz package.
|
21
|
+
EOS
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/quartz.gemspec
CHANGED
@@ -2,14 +2,13 @@
|
|
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.4 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.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
12
|
s.authors = ["David Huie"]
|
14
13
|
s.date = "2014-06-23"
|
15
14
|
s.description = "A gem for calling Go code from Ruby"
|
@@ -34,6 +33,7 @@ Gem::Specification.new do |s|
|
|
34
33
|
"lib/quartz/client.rb",
|
35
34
|
"lib/quartz/go_process.rb",
|
36
35
|
"lib/quartz/go_struct.rb",
|
36
|
+
"lib/quartz/validations.rb",
|
37
37
|
"quartz.gemspec",
|
38
38
|
"spec/client_spec.rb",
|
39
39
|
"spec/go_process_spec.rb",
|
@@ -43,7 +43,8 @@ Gem::Specification.new do |s|
|
|
43
43
|
]
|
44
44
|
s.homepage = "http://github.com/DavidHuie/quartz"
|
45
45
|
s.licenses = ["MIT"]
|
46
|
-
s.
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubygems_version = "2.1.11"
|
47
48
|
s.summary = "A gem for calling Go code from Ruby"
|
48
49
|
|
49
50
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Huie
|
@@ -14,42 +14,42 @@ dependencies:
|
|
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
|
-
-
|
64
|
-
-
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
65
65
|
- Gemfile
|
66
66
|
- Gemfile.lock
|
67
67
|
- LICENSE.txt
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/quartz/client.rb
|
76
76
|
- lib/quartz/go_process.rb
|
77
77
|
- lib/quartz/go_struct.rb
|
78
|
+
- lib/quartz/validations.rb
|
78
79
|
- quartz.gemspec
|
79
80
|
- spec/client_spec.rb
|
80
81
|
- spec/go_process_spec.rb
|
@@ -91,17 +92,17 @@ require_paths:
|
|
91
92
|
- lib
|
92
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
|
-
- -
|
95
|
+
- - '>='
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: '0'
|
97
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
99
|
requirements:
|
99
|
-
- -
|
100
|
+
- - '>='
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
104
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.1.11
|
105
106
|
signing_key:
|
106
107
|
specification_version: 4
|
107
108
|
summary: A gem for calling Go code from Ruby
|