quartz 0.0.3 → 0.1.0

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: a5b00701c21ace8ff2baa69984aef6e95e9ef6d3
4
- data.tar.gz: b39120a6543122754b3fb5143b3b3643df25b237
3
+ metadata.gz: 05b5dae726bdb30517440604cef9323e3f603977
4
+ data.tar.gz: 0b29eb3c722db7dd97b38807b0801914c6bb7bbd
5
5
  SHA512:
6
- metadata.gz: 400e7c1be36e50c6eb1f7ee13c2697455c429a858a3bfb39830001abd35fb5c87841cf239529acb7528d1e43e9b000f3619471cbead3163b527708f622ca2713
7
- data.tar.gz: 28a34b4c6d77ceabf714273a5087f6fd45e0452d703c13e62fef4dd53fe018af847d476aecd6c9d4cae46ebb11f24fb1e4f5f79ed34ca346db6f403b998cf5f4
6
+ metadata.gz: 46f9a875047aeb19208991da607f1bfd21e2e747a660137aa9c75627e11ac0ced0b31d91faab36d565c19caa2c22fdd958c797e1136af5615e572c043fbc0c69
7
+ data.tar.gz: 41b49e461b6859c33b4ab87bb6d8f7ff0ef483cacb83ea7317824b49f8b8c6bdd307535d73fd188db3d6db167d1944013eac6b5c5dad36b99446757ba78a524c
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: go
2
+
3
+ go: 1.2.1
4
+
5
+ before_script: bundle install
6
+
7
+ script: bundle exec rake
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # quartz
2
2
 
3
+ [![Build Status](https://travis-ci.org/DavidHuie/quartz.svg?branch=travis-ci-test)](https://travis-ci.org/DavidHuie/quartz)
4
+
3
5
  Quartz enables you to call Go code from within your
4
6
  Ruby code. This is accomplished by running a Go program
5
7
  as a child process of your Ruby application and using UNIX domain sockets
@@ -41,7 +43,7 @@ func (t *Adder) Add(args Args, response *Response) error {
41
43
  ## Preparing a Quartz RPC server in Go
42
44
 
43
45
  Instead of integrating Quartz into an existing Go application,
44
- it is recommended that a new `go run`-able file is created
46
+ it is recommended to create a new `go run`-able file
45
47
  that explicitly defines the structs that should be available
46
48
  to Ruby.
47
49
 
@@ -75,26 +77,32 @@ Naturally:
75
77
  $ gem install quartz
76
78
  ```
77
79
 
78
- After you've found created a `go run`-able file, create a Go process wrapper that
80
+ After you've found created a `go run`-able file, create a Go client that
79
81
  points to that file:
80
82
 
81
83
  ```ruby
82
- require 'quartz'
84
+ client = Quartz::Client.new(file_path: 'spec/test.go')
85
+ ```
83
86
 
84
- go_process = Quartz::GoProcess.new(file_path: 'spec/test.go')
87
+ To list exported structs:
88
+
89
+ ```ruby
90
+ client.structs
91
+ => [:my_adder]
85
92
  ```
86
93
 
87
- Now, you can create a client:
94
+ To list a struct's exported methods:
88
95
 
89
96
  ```ruby
90
- client = Quartz::Client.new(go_process)
97
+ client[:my_adder].struct_methods
98
+ => ["Add"]
91
99
  ```
92
100
 
93
101
  To call a method on a struct:
94
102
 
95
103
  ```ruby
96
104
  client[:my_adder].call('Add', 'A' => 2, 'B' => 5)
97
- # => { 'Sum' => 7 }
105
+ => { 'Sum' => 7 }
98
106
  ```
99
107
 
100
108
  ## Copyright
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
@@ -1,11 +1,10 @@
1
1
  require 'quartz'
2
2
 
3
- go_process = Quartz::GoProcess.new(file_path: 'lookup_dns.go')
4
- client = Quartz::Client.new(go_process)
3
+ client = Quartz::Client.new(file_path: 'lookup_dns.go')
5
4
 
6
5
  puts "Structs: #{client.structs}"
7
6
  puts "Struct methods for #{client[:resolver].struct_name}: #{client[:resolver].struct_methods}"
8
-
7
+ puts "Response from FindIPs:"
9
8
  puts client[:resolver].call('FindIPs',
10
9
  'Hostnames' => ['www.google.com',
11
10
  'www.facebook.com',
data/lib/quartz/client.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  class Quartz::Client
2
2
 
3
- def initialize(go_process)
4
- @process = go_process
3
+ def initialize(opts)
4
+ @process = Quartz::GoProcess.new(file_path: opts[:file_path])
5
5
  @structs = {}
6
-
7
6
  @process.get_metadata.each do |struct_name, metadata|
8
7
  @structs[struct_name.to_sym] = Quartz::GoStruct.new(struct_name, metadata, @process)
9
8
  end
data/quartz.gemspec CHANGED
@@ -2,11 +2,11 @@
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.0.3 ruby lib
5
+ # stub: quartz 0.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "quartz"
9
- s.version = "0.0.3"
9
+ s.version = "0.1.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["David Huie"]
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.files = [
21
21
  ".document",
22
22
  ".rspec",
23
+ ".travis.yml",
23
24
  "Gemfile",
24
25
  "Gemfile.lock",
25
26
  "LICENSE.txt",
data/spec/client_spec.rb CHANGED
@@ -2,11 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe Quartz::Client do
4
4
 
5
- let(:process) { Quartz::GoProcess.new(file_path: 'spec/test.go') }
5
+ let(:client) { Quartz::Client.new(file_path: 'spec/test.go') }
6
6
 
7
7
  it 'creates structs internally' do
8
- c = Quartz::Client.new process
9
- result = c[:adder].call('Add', 'A' => 2, 'B' => 5)
8
+ result = client[:adder].call('Add', 'A' => 2, 'B' => 5)
10
9
  result.should eq({'X' => 7})
11
10
  end
12
11
 
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.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Huie
@@ -90,6 +90,7 @@ extra_rdoc_files:
90
90
  files:
91
91
  - .document
92
92
  - .rspec
93
+ - .travis.yml
93
94
  - Gemfile
94
95
  - Gemfile.lock
95
96
  - LICENSE.txt