libroute 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libroute/librouteexec.rb +24 -5
- 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: ad13a88fd242b832ae6578c0e9d22bf980f88605
|
4
|
+
data.tar.gz: 57737b8b1bcdb6228ef9efdf5fbaf3d64d9baf6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09979b24df53b97125a59dffc306d8a99462bcad70519f5b720028794dc64e5bc9d55f480633ad0f9a7f6e6971c66d6a377ce9863a0cc29cb8ac26b46351bc2d
|
7
|
+
data.tar.gz: a2c7aa88c7e24a2e71959a04f2db41e2451e74d5bb827dbde5c1f7a0187f7d1b8fc2bceb2f65093926ac87c92f66a6317492e82f150a18101cd2908772b12868
|
@@ -4,12 +4,16 @@ module Libroute
|
|
4
4
|
|
5
5
|
def build(options)
|
6
6
|
puts "Building #{options.library} from directory #{options.build}"
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
begin
|
8
|
+
im = Docker::Image.build_from_dir(options.build) do |v|
|
9
|
+
if (log = JSON.parse(v)) && log.has_key?("stream")
|
10
|
+
puts log["stream"]
|
11
|
+
end
|
10
12
|
end
|
13
|
+
im.tag('repo' => 'libroute_image-'+options.library)
|
14
|
+
rescue
|
15
|
+
puts "Libroute: An error occurred during the build process.\n\n"
|
11
16
|
end
|
12
|
-
im.tag('repo' => 'libroute_image-'+options.library)
|
13
17
|
end
|
14
18
|
|
15
19
|
def exec(library, params)
|
@@ -29,7 +33,22 @@ module Libroute
|
|
29
33
|
if c.length == 0
|
30
34
|
|
31
35
|
# Launch container from image
|
32
|
-
|
36
|
+
|
37
|
+
imagemap = Docker::Image.all.flat_map{|x| x.info['RepoTags'].count == 1 ? [[x.info['RepoTags'][0],x]] : x.info['RepoTags'].map{|y| [y,x]} }
|
38
|
+
# This command splits multiple tags into a flat vector
|
39
|
+
# -> imagemap is a vector of length equal to the number of images
|
40
|
+
# => each elements is a vector of length 2: [tag, image]
|
41
|
+
|
42
|
+
imagesel = imagemap.select{|x| x[0].split(':')[0].include?('libroute_image-' + library)}
|
43
|
+
|
44
|
+
if imagesel.count == 0
|
45
|
+
h = Hash.new
|
46
|
+
h['stderr'] = 'Image not found'
|
47
|
+
return h
|
48
|
+
end
|
49
|
+
|
50
|
+
image = imagesel[0][1]
|
51
|
+
|
33
52
|
c = Docker::Container.create('Image' => image.id, 'name' => 'libroute_instance-' + library, 'Tty' => true)
|
34
53
|
c.start
|
35
54
|
|
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.4
|
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-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|