libroute 0.1.2 → 0.1.3

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: 3619eadb613000ca9748fa59c25871efbdeb40c6
4
- data.tar.gz: 564775bde9740736930524039852544c1d151c52
3
+ metadata.gz: bafb0113b18998549c1efe458b3f5b735de3b3c4
4
+ data.tar.gz: a55703d7e20895ca2d267dee8db8a301eabbc009
5
5
  SHA512:
6
- metadata.gz: 9bc6ed51812ca827cc933ea2cf173a3e1dce1b26bb9fa593506bb16f17d2c007134f7cc9458f71960967aece7d9ec39d2b6894b7539afa8caeaff5c0b7d368c3
7
- data.tar.gz: aab7b857c8895c375819e4bdf7c9af075331c4ab34164e604bab90d90f24438c26b65dd97456c84c82e2dcc5bc1ebb5d7bf00bbe04f25df7c41db4a0104fe765
6
+ metadata.gz: ae98d328b4b782f7fdd3e4eabe42d891f98b7bfe47c20e16d69abf4d1c5a905f9e6b5e3f4016ecbae8a98a3746d671e34b0e91d2cc566c94d1a19a00ced560ab
7
+ data.tar.gz: d8e1ab31186919ad737c0e2b568bb8f8747438740d28333dca1966338fc0f5177248485424a62f7905e4ba468a3172122fd337e62b395a13cee97c648a10c262
data/exe/libroute CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'libroute'
4
-
4
+ require 'bson'
5
5
 
6
6
  options = Libroute.parse(ARGV)
7
7
 
@@ -11,22 +11,37 @@ require 'libroute'
11
11
  end
12
12
 
13
13
  if !options.build.empty?
14
- puts "Building #{options.library} library... (todo)"
14
+ puts "Building #{options.library} library..."
15
15
  Libroute.build(options)
16
16
  exit 0
17
17
  end
18
18
 
19
- params = options.params.split(",")
19
+ # Populate params
20
20
  paramshash = Hash.new
21
- params.each do |p|
22
- key,val = p.split("=",2)
23
- paramshash[key]=val
21
+ if !options.params.empty?
22
+ params = options.params.split(",")
23
+ params.each do |p|
24
+ key,val = p.split("=",2)
25
+ paramshash[key]=val
26
+ end
27
+ end
28
+
29
+ # Populate stdin
30
+ if !$stdin.tty?
31
+ data = $stdin.read
32
+ if !data.nil?
33
+ paramshash['stdin'] = BSON::Binary.new(data)
34
+ end
24
35
  end
25
36
 
26
37
  result = Libroute.exec(options.library, paramshash)
27
38
  if !result['stdout'].nil?
28
- bb = result['stdout'].data
29
- puts bb.to_s
39
+ if result['stdout'].is_a?(String)
40
+ puts result['stdout']
41
+ else
42
+ bb = result['stdout'].data
43
+ puts bb.to_s
44
+ end
30
45
  else
31
46
  result.each do |k,v|
32
47
  if v.length < 100
@@ -50,7 +50,8 @@ module Libroute
50
50
  #s.close
51
51
 
52
52
  s = TCPSocket.new(ip_address, 2000)
53
- s.write(params.to_bson.to_s)
53
+ bb = params.to_bson
54
+ s.write(bb.get_bytes(bb.length))
54
55
  s.close_write
55
56
  data = s.read
56
57
  bb = BSON::ByteBuffer.new(data)
@@ -1,3 +1,3 @@
1
1
  module Libroute
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libroute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lisk (XS Research Ltd)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2016-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api