flock-sandbox 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c29cff7f948a5080873cdb848f06533fe6090f00
4
- data.tar.gz: 1ebd6c0a57260a9198da72a3ccb1c8c308168408
3
+ metadata.gz: 8084b68a2683319e8d2c158aee9e4085445fd0e4
4
+ data.tar.gz: 083606bfaa2944b79d9b49e49c57830106acd681
5
5
  SHA512:
6
- metadata.gz: 1732a3c29bb947ff766d2dac9428bbc2d1d2ca092514221c57ecde582f3c84e6235b6bd7537f4efda4e82633a076d48876d55e76fa6543f8108d45c5566009fb
7
- data.tar.gz: 2c8355233392da3f0777a2da970127929c3c259629d7be040385ccc022677db3bf9b0766267be7189f96810c0aeac2fec5fe243cb1208a628330dbac15127dc5
6
+ metadata.gz: 64a741c23bd4d0c76247ec1ac5317b38f6c8517e43eef88ad7f280b13713c625d8420fcfad2c48549010e1256e316127700c3e31453c1b352ae4b5f8c38c7ace
7
+ data.tar.gz: 342fbc2dcfd3c3e9bb30f15f199c965cca21fa14d8f3d016fc35f4cc3e05b575d2ee50c239a3dc4642bdea5fb91f9fd98f0995e904bf5ecd0c8d602f32dbac35
data/lib/flock/sandbox.rb CHANGED
@@ -38,12 +38,14 @@ module Flock
38
38
  end
39
39
  class Definition
40
40
  attr_accessor :config, :containers, :scripts
41
+ def initialize
42
+ @scripts = []
43
+ @containers = []
44
+ end
41
45
  def container(name, params = {})
42
- @containers ||= []
43
46
  @containers << params.merge(name: name)
44
47
  end
45
48
  def script(name, params = {})
46
- @scripts ||= []
47
49
  @scripts << params.merge(name: name)
48
50
  end
49
51
  end
@@ -69,8 +71,7 @@ module Flock
69
71
  class Docker
70
72
  def initialize(definition)
71
73
  @definition = definition
72
- ::Docker.options = {
73
- }
74
+ ::Docker.options = {}
74
75
  end
75
76
 
76
77
  def run
@@ -80,26 +81,30 @@ module Flock
80
81
  @definition.containers.each do |c|
81
82
  puts "Start container #{c[:name]} (#{c[:image]})"
82
83
  ::Docker::Image.create('fromImage' => c[:image])
83
- container = ::Docker::Container.create('Image' => c[:image],
84
- 'name' => c[:name],
85
- 'Env' => c[:envs],
86
- 'HostConfig' => {'Links' => c[:links]})
84
+ container = ::Docker::Container.create(
85
+ 'Image' => c[:image],
86
+ 'name' => c[:name],
87
+ 'Env' => c[:envs],
88
+ 'HostConfig' => { 'Links' => c[:links] })
87
89
  containers << container
88
90
  container.start
89
91
  end
90
92
  end
91
93
  if ENV['MANUAL_SCRIPTS']
92
94
  @definition.scripts.each do |c|
93
- puts "docker run #{(c[:links] || []).map { |v| "--link #{v}" } * " " } #{(c[:envs] || []).map { |e| "-e #{e}" } * " " } #{c[:image]} #{c[:cmd] * ' '}"
95
+ puts "docker run #{(c[:links] || [])
96
+ .map { |v| "--link #{v}" } * ' ' } #{(c[:envs] || [])
97
+ .map { |e| "-e #{e}" } * ' ' } #{c[:image]} #{c[:cmd] * ' '}"
94
98
  end
95
99
  else
96
100
  @definition.scripts.each do |c|
97
101
  puts "Run script #{c[:name]} (#{c[:image]} #{c[:cmd].inspect})"
98
102
  ::Docker::Image.create('fromImage' => c[:image])
99
- container = ::Docker::Container.create('Cmd' => c[:cmd],
100
- 'Image' => c[:image],
101
- 'Env' => c[:envs],
102
- 'HostConfig' => {'Links' => c[:links]})
103
+ container = ::Docker::Container.create(
104
+ 'Cmd' => c[:cmd],
105
+ 'Image' => c[:image],
106
+ 'Env' => c[:envs],
107
+ 'HostConfig' => { 'Links' => c[:links] })
103
108
  containers << container
104
109
  container.start
105
110
  res = container.wait(1200)
@@ -1,5 +1,5 @@
1
1
  module Flock
2
2
  module Sandbox
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flock-sandbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Rudenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-26 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api
@@ -92,8 +92,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.2.2
95
+ rubygems_version: 2.4.3
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Write a short summary. Required.
99
99
  test_files: []
100
+ has_rdoc: