minke 1.5.9 → 1.6.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzM4YjVmNTJmNWFhOWQ0MmM1Njc2NzNiYjE5ZDc3NTMyYjdlMWU5OA==
4
+ MDVmMTZmNmE1ODBkMzQ4ZmFkMThlZjYzZmNkOGVmN2IwZTQwZjM5NA==
5
5
  data.tar.gz: !binary |-
6
- NjBhYTA3ZWQzN2Q3MWZhZjM4ZmE3Yjk3MGY5MzYyN2I3NDk4Zjk0NA==
6
+ OGYyOTU4MDNkMjUyMGQxZDA0ZmQ1OGM2NTk3NmYwNzEyYTkxZWUxMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGEwODA3ZjExZWU0Nzg1ZDljMmJjNGZiMTJiMTRlYjAxYjA2ODYxMTBiYjZh
10
- MTcwZTdhYmIwODc4ZjRlODRjNDI3NDUxYjNlZWM0MWFiMmU5YWI1ZmJhMzM4
11
- MDdiMTlmYzI0M2U4NjM1YmRhZmE2ZWViN2FlMzE4OWNjNjRhMzc=
9
+ NDNiODFjYjQ0ZDczYTA1MTEwNTQ2YjM1ZGEwZjNjZmI2NWU2NTk2MjU0N2Rk
10
+ MWYyNWUxYzJjODE5MWQyYTkxMDIxNjQ3MTc4NGI1ODlmMmQ5NTFkMWNjZGZm
11
+ NTU1Mjc4ODU0MTI2MjQwZmJmYjM0OTgyYmMxMzNhODcxOGJjOGE=
12
12
  data.tar.gz: !binary |-
13
- NzUxNzE5MDhjODZhNGZlNWZkOTU5NzhmZTk3YzhjNmI1OGU1MDk3OGVmMDM3
14
- NDQ2YjA2MzQ0ZGVkNTBiOGE3OGFmM2FiMjExNDc3MWVlYmI5NWI5NDFkYTA0
15
- OWU3ZTM5Y2Y1ZWFkYmYyMmVhOTkyMWRmYjhlNDkwMmE5MTQwNjk=
13
+ YzkwODViOGYyYzU5MDVjMTNlN2M3Mjc0ODg0YTliOTllZmYwMTkwNDE2YmNh
14
+ ZmU2YTEwMDIxMDZjYjYzNDBlNTdjZDcyNzBhODNjM2ZlZmJhNTlhYWFmNDAw
15
+ NmY3OTViZGQwZDU1MTQ2NWY0ODI4MmZmYjk4YWJmOTM0MmIzMTM=
@@ -21,14 +21,29 @@ module Minke
21
21
  ##
22
22
  # start the containers in a stack defined by the docker compose file
23
23
  def up
24
- @system_runner.execute "docker-compose -f #{@compose_file} up -d"
24
+ unless ENV['DOCKER_NETWORK'].to_s.empty?
25
+ directory = create_compose_network_file
26
+
27
+ @system_runner.execute "docker-compose -f #{@compose_file} -f #{directory + '/docker-compose.yml'} up -d"
28
+ @system_runner.remove_entry_secure directory
29
+ else
30
+ @system_runner.execute "docker-compose -f #{@compose_file} up -d"
31
+ end
32
+
25
33
  sleep 2
26
34
  end
27
35
 
28
36
  ##
29
- # stop the containers in a stack defined by the docker compose file
30
- def stop
31
- @system_runner.execute "docker-compose -f #{@compose_file} stop"
37
+ # stop the containers in a stack and removes them as defined by the docker compose file
38
+ def down
39
+ unless ENV['DOCKER_NETWORK'].to_s.empty?
40
+ directory = create_compose_network_file
41
+
42
+ @system_runner.execute "docker-compose -f #{@compose_file} -f #{directory + '/docker-compose.yml'} down"
43
+ @system_runner.remove_entry_secure directory
44
+ else
45
+ @system_runner.execute "docker-compose -f #{@compose_file} down -d"
46
+ end
32
47
  end
33
48
 
34
49
  ##
@@ -48,6 +63,17 @@ module Minke
48
63
  def public_address container, private_port
49
64
  @system_runner.execute_and_return "docker-compose -f #{@compose_file} port #{container} #{private_port}"
50
65
  end
66
+
67
+ def create_compose_network_file
68
+ content = { 'version' => '2'.to_s, 'networks' => {'default' => { 'external' => { 'name' => ENV['DOCKER_NETWORK'] } } } }
69
+
70
+ directory = @system_runner.mktmpdir
71
+
72
+ temp_file = directory + '/docker-compose.yml'
73
+ @system_runner.write_file temp_file, YAML.dump(content)
74
+
75
+ directory
76
+ end
51
77
  end
52
78
  end
53
79
  end
@@ -11,6 +11,18 @@ module Minke
11
11
  return log.strip
12
12
  end
13
13
 
14
+ def mktmpdir
15
+ Dir.mktmpdir
16
+ end
17
+
18
+ def remove_entry_secure dir
19
+ FileUtils.remove_entry_secure dir
20
+ end
21
+
22
+ def write_file filename, data
23
+ File.open(filename, 'w') { |file| file.write(data) }
24
+ end
25
+
14
26
  end
15
27
  end
16
28
  end
@@ -14,8 +14,7 @@ module Minke
14
14
  end
15
15
 
16
16
  ensure
17
- @compose.stop
18
- @compose.rm
17
+ @compose.down
19
18
 
20
19
  @helper.fatal_error "Cucumber steps failed" unless status == 0
21
20
  end
@@ -13,8 +13,7 @@ module Minke
13
13
  end
14
14
 
15
15
  ensure
16
- @compose.stop
17
- @compose.rm
16
+ @compose.down
18
17
  end
19
18
  end
20
19
 
data/lib/minke/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Minke
2
- VERSION = "1.5.9"
2
+ VERSION = "1.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minke
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.9
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Jackson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-09 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler