mrsk 0.13.0 → 0.13.1

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
  SHA256:
3
- metadata.gz: 6b258a4c44d5b010d6ab4004d0e051f9378dd4511203020a8fed2dc639527d9f
4
- data.tar.gz: 702b1c42fc0b095d18c37baa1811186ece2267b3d49067648129b76bef284be1
3
+ metadata.gz: 4f798abc56a655b00c23b0967edc93b3c420b71b50c92e28b986b35c6934ad91
4
+ data.tar.gz: b0606bf3e0874b765fbe6c5b17d941b326fc2da802a5fdf04f456547a2542fc2
5
5
  SHA512:
6
- metadata.gz: 60163759e4097ea91df33411e7dc32261c0bc82f609bc1f54308f4111e3f0efe4d9731b234175e293f5c8a6aef9e1a88156be88260fc0a545b4d276ddb4e753b
7
- data.tar.gz: 882d09991704e45f3c377dfafa0b15f2c6f1421085e5ca8096855bb03b109c6a91e4e47b7ec9270cdb31f7e43b3a18b23576fb0b2faa6367c82d9b3748550201
6
+ metadata.gz: 8528839c8f62dbfb766c670d30915f7ea8680a8f4c4b4bfc7bfffb3227a017c856b3dfbfb4df6fe6ab2c78371cd73e6d53f51ba01cdf998aeacbbf64cca73fdc
7
+ data.tar.gz: 47fd8f783ad74b2c4c518854f91a9b3ffb8db9d3f7fb929ee05e4e79f8995f3c831077dcbda116ea179201cbf8e8180af3b5cab8c5970acc9a4e81c31b188baa
@@ -1,4 +1,6 @@
1
1
  class Mrsk::Commands::App < Mrsk::Commands::Base
2
+ ACTIVE_DOCKER_STATUSES = [ :running, :restarting ]
3
+
2
4
  attr_reader :role
3
5
 
4
6
  def initialize(config, role: nil)
@@ -92,7 +94,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
92
94
 
93
95
 
94
96
  def current_running_container_id
95
- docker :ps, "--quiet", *filter_args(status: :running), "--latest"
97
+ docker :ps, "--quiet", *filter_args(statuses: ACTIVE_DOCKER_STATUSES), "--latest"
96
98
  end
97
99
 
98
100
  def container_id_for_version(version, only_running: false)
@@ -100,12 +102,12 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
100
102
  end
101
103
 
102
104
  def current_running_version
103
- list_versions("--latest", status: :running)
105
+ list_versions("--latest", statuses: ACTIVE_DOCKER_STATUSES)
104
106
  end
105
107
 
106
- def list_versions(*docker_args, status: nil)
108
+ def list_versions(*docker_args, statuses: nil)
107
109
  pipe \
108
- docker(:ps, *filter_args(status: status), *docker_args, "--format", '"{{.Names}}"'),
110
+ docker(:ps, *filter_args(statuses: statuses), *docker_args, "--format", '"{{.Names}}"'),
109
111
  %(grep -oE "\\-[^-]+$"), # Extract SHA from "service-role-dest-SHA"
110
112
  %(cut -c 2-)
111
113
  end
@@ -150,15 +152,17 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
150
152
  [ config.service, role, config.destination, version || config.version ].compact.join("-")
151
153
  end
152
154
 
153
- def filter_args(status: nil)
154
- argumentize "--filter", filters(status: status)
155
+ def filter_args(statuses: nil)
156
+ argumentize "--filter", filters(statuses: statuses)
155
157
  end
156
158
 
157
- def filters(status: nil)
159
+ def filters(statuses: nil)
158
160
  [ "label=service=#{config.service}" ].tap do |filters|
159
161
  filters << "label=destination=#{config.destination}" if config.destination
160
162
  filters << "label=role=#{role}" if role
161
- filters << "status=#{status}" if status
163
+ statuses&.each do |status|
164
+ filters << "status=#{status}"
165
+ end
162
166
  end
163
167
  end
164
168
  end
data/lib/mrsk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mrsk
2
- VERSION = "0.13.0"
2
+ VERSION = "0.13.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrsk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson