rat_deployer 0.1.11 → 0.1.12

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: 62f3865952fcdfe384e29675e293cf14c366cd0c
4
- data.tar.gz: ef8f40dfa437099645704bdeaceb3b35c2ab278e
3
+ metadata.gz: f3a34ca0a2412e7cf6180f7d7708f17d31759094
4
+ data.tar.gz: 0ed7f6722e96927da2ecb663ad0827234a9b28b0
5
5
  SHA512:
6
- metadata.gz: c91cfb7161d0c22b9e07f7c70e00e486e5ae068f31118d659184962c2a1196ca052930391b5014c586e1a9ddab36af827f2e92624683b2c7bba91e3e1e4907fa
7
- data.tar.gz: 919ff30c8c9a36e5580a6db8fb76f2dd40fba2071744673031f46847b6f555e6d4a18607c09787a01d5b230d0f19c4128becd8469ab75bb183504606c6dea1be
6
+ metadata.gz: d8c88b1943bb041fe61a9ff464bc7bc3fac32811aa90bfcb898dbbd8738af468dca82602aeadee09f59c91bc6356f1e087228e020af55c2aa619629894f42c37
7
+ data.tar.gz: 9e36e9bf273102ab126b474be995f4995075b4f7bac63ca9e2b2f0216df2954ce22d7971953fa25594d38bd583a0183accef374896f76ce40c3e94fcb3836c24
@@ -38,7 +38,8 @@ Reason:
38
38
  flags.unshift(RatDeployer::Config.remote_machine_flags)
39
39
  end
40
40
 
41
- run "docker-compose #{flags.join(' ')} #{cmd} #{cmd_flags.join(" ")}"
41
+ cmd = run "docker-compose #{flags.join(' ')} #{cmd} #{cmd_flags.join(" ")}"
42
+ cmd.fetch(:output)
42
43
  end
43
44
 
44
45
  desc "docker ARGS...", "runs docker command with default flags"
@@ -52,7 +53,8 @@ Reason:
52
53
  flags.unshift(RatDeployer::Config.remote_machine_flags)
53
54
  end
54
55
 
55
- run "docker #{flags.join(' ')} #{cmd} #{cmd_flags.join(" ")}"
56
+ cmd = run "docker #{flags.join(' ')} #{cmd} #{cmd_flags.join(" ")}"
57
+ cmd.fetch(:output)
56
58
  end
57
59
  end
58
60
  end
@@ -4,13 +4,30 @@ require 'rat_deployer/config'
4
4
 
5
5
  module RatDeployer
6
6
  module Command
7
- def run(cmd)
7
+ def run(cmd, silent: false)
8
8
  if RatDeployer::Config.prompt_enabled?
9
9
  msg = "||=> Running command ".colorize(:blue) + "`#{cmd.colorize(:white)}`"
10
10
  puts msg
11
11
  end
12
12
 
13
- exit 1 unless system(cmd)
13
+ command = do_run(cmd, silent: silent)
14
+ exit 1 unless command.fetch(:status).zero?
15
+ command
16
+ end
17
+
18
+ def do_run(cmd, silent: false)
19
+ output, status = '', 1
20
+
21
+ IO.popen(cmd) do |io|
22
+ while line = io.gets do
23
+ puts line unless silent
24
+ output << line
25
+ end
26
+ io.close
27
+ status = $?.to_i
28
+ end
29
+
30
+ {output: output, status: status}
14
31
  end
15
32
 
16
33
  def put_heading(str)
@@ -19,7 +19,11 @@ module RatDeployer
19
19
  attachments: [{
20
20
  title: title,
21
21
  fields: get_deploy_properties.map do |k,v|
22
- {title: k.to_s.titleize, value: v, short: true}
22
+ {
23
+ title: k.to_s.titleize,
24
+ value: k == :images ? v.join(' · ') : v,
25
+ short: k != :images
26
+ }
23
27
  end
24
28
  }]
25
29
  )
@@ -50,11 +54,15 @@ module RatDeployer
50
54
  def self.get_deploy_properties
51
55
  require 'socket'
52
56
 
57
+ docker_config = YAML.load(RatDeployer::Cli.new.compose('config'))
58
+ images = docker_config['services'].map { |s,c| c['image'] }.uniq.sort
59
+
53
60
  {
54
61
  env: ENV.fetch('RAT_ENV'),
55
62
  user: ENV.fetch('USER'),
56
63
  hostname: Socket.gethostname,
57
- started_at: Time.now.to_s
64
+ started_at: Time.now.to_s,
65
+ images: images
58
66
  }
59
67
  end
60
68
  end
@@ -1,3 +1,3 @@
1
1
  module RatDeployer
2
- VERSION = "0.1.11"
2
+ VERSION = "0.1.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rat_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Oga