libroute 0.1.4 → 0.1.5
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/exe/libroute +24 -12
- data/lib/libroute/librouteexec.rb +2 -2
- data/lib/libroute/librouteparse.rb +8 -3
- data/lib/libroute/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4a0c471f132928b944fdd4066cc1028b6ba253a
|
4
|
+
data.tar.gz: c117ec64d1ad11b257b7c3e83161957928143f27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad0517a721dd489df5ec509b614a17d3c82b60cf169f185cad39e268b468c50fdf07e0abbfb6223f0402df8ddd0fc11e448fbcac85517c4c6bd73d7e365efaf
|
7
|
+
data.tar.gz: 9721df9a9e336b25357941f2f4ac1f368f73420ccc39e963dcf6867c3de1d31c4db52fc3db287e9b1dceaecb6b7a5f059b3c5ca053e2a4ee86d0695049bcb230
|
data/exe/libroute
CHANGED
@@ -18,28 +18,40 @@ require 'bson'
|
|
18
18
|
|
19
19
|
# Populate params
|
20
20
|
paramshash = Hash.new
|
21
|
-
if !options.
|
22
|
-
|
23
|
-
params.each do |p|
|
21
|
+
if !options.param.empty?
|
22
|
+
options.param.each do |p|
|
24
23
|
key,val = p.split("=",2)
|
25
24
|
paramshash[key]=val
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
29
|
-
# Populate
|
30
|
-
if
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
# Populate files
|
29
|
+
if !options.file.empty?
|
30
|
+
options.file.each do |p|
|
31
|
+
key,val = p.split("=",2)
|
32
|
+
if val.eql?('-')
|
33
|
+
fileval = $stdin.read
|
34
|
+
else
|
35
|
+
begin
|
36
|
+
fileval = File.read(val)
|
37
|
+
rescue
|
38
|
+
fileval = nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
if fileval.nil?
|
42
|
+
puts "Failed to read file: #{val}"
|
43
|
+
exit 1
|
44
|
+
end
|
45
|
+
paramshash[key] = BSON::Binary.new(fileval)
|
34
46
|
end
|
35
47
|
end
|
36
48
|
|
37
49
|
result = Libroute.exec(options.library, paramshash)
|
38
|
-
if !result['
|
39
|
-
if result['
|
40
|
-
puts result['
|
50
|
+
if !result['output'].nil?
|
51
|
+
if result['output'].is_a?(String)
|
52
|
+
puts result['output']
|
41
53
|
else
|
42
|
-
bb = result['
|
54
|
+
bb = result['output'].data
|
43
55
|
puts bb.to_s
|
44
56
|
end
|
45
57
|
else
|
@@ -16,7 +16,7 @@ module Libroute
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def exec(library, params)
|
19
|
+
def exec(library, params, opts={})
|
20
20
|
|
21
21
|
# Check if existing container running
|
22
22
|
c = Docker::Container.all(all: true).select{|c| c.info['Names'][0].eql?('/libroute_instance-' + library)}
|
@@ -49,7 +49,7 @@ module Libroute
|
|
49
49
|
|
50
50
|
image = imagesel[0][1]
|
51
51
|
|
52
|
-
c = Docker::Container.create('Image' => image.id, 'name' => 'libroute_instance-' + library, 'Tty' => true)
|
52
|
+
c = Docker::Container.create({'Image' => image.id, 'name' => 'libroute_instance-' + library, 'Tty' => true}.merge(opts))
|
53
53
|
c.start
|
54
54
|
|
55
55
|
# Wait for container to start
|
@@ -14,7 +14,8 @@ module Libroute
|
|
14
14
|
options = OpenStruct.new
|
15
15
|
options.library = []
|
16
16
|
options.build = []
|
17
|
-
options.
|
17
|
+
options.param = []
|
18
|
+
options.file = []
|
18
19
|
options.showhelp = false
|
19
20
|
|
20
21
|
opt_parser = OptionParser.new do |opts|
|
@@ -40,8 +41,12 @@ module Libroute
|
|
40
41
|
options.build = o
|
41
42
|
end
|
42
43
|
|
43
|
-
opts.on("-p","--
|
44
|
-
options.
|
44
|
+
opts.on("-p","--param PARAMETER","Specify parameter in the form -p param=value") do |p|
|
45
|
+
options.param.push p
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on("-f","--file FILE","Specify parameter in the form -f param=file"," Use - for file to read from stdin") do |f|
|
49
|
+
options.file.push f
|
45
50
|
end
|
46
51
|
|
47
52
|
opts.on_tail("-h", "--help", "Show command options","Show library options (-l LIBRARY)") do |h|
|
data/lib/libroute/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.5
|
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-
|
11
|
+
date: 2016-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|