firespring_dev_commands 1.5.1 → 1.5.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a83daa9c15548e199bf57ec8cfed9db0ed5d5d0e9ee976eebbbe23b9dd5db9b
|
4
|
+
data.tar.gz: 4ac6c93ae0b63b8a96dfda76983b6dee876b09c2cf38d4a07a612ad81954f841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 318a99c838156a2ab894ff0ab36c48d4a8f23abc6aa8a0d226916ed9cb189a56dd5d76d07d3efe5b38d569e4c09bae6cd1a9d08566c6068d6280bb94c8b3f19f
|
7
|
+
data.tar.gz: e99947b292755ec515504c42a4df4bfc8193c84455433073f4074c1ff25e10258cd03f6f8dec11c3f856c48e373a2c1b83cf2917e55b8231f4414abe6eb3677a
|
@@ -170,33 +170,37 @@ module Dev
|
|
170
170
|
Dev::Tar.new(tar).unpack(source_path, dest_path)
|
171
171
|
end
|
172
172
|
|
173
|
+
# rubocop:disable Metrics/ParameterLists
|
173
174
|
# Display a nicely formatted table of images and their associated information
|
174
175
|
def print_images
|
175
176
|
reposize = 70
|
176
|
-
tagsize =
|
177
|
+
tagsize = 70
|
178
|
+
archsize = 9
|
177
179
|
imagesize = 15
|
178
180
|
createsize = 20
|
179
181
|
sizesize = 10
|
180
|
-
total = reposize + tagsize + imagesize + createsize + sizesize
|
182
|
+
total = reposize + tagsize + archsize + imagesize + createsize + sizesize
|
181
183
|
|
182
184
|
# If there is additional width available, add it to the repo and tag columns
|
183
185
|
additional = [((Rake.application.terminal_width - total) / 2).floor, 0].max
|
184
186
|
reposize += additional
|
185
187
|
tagsize += additional
|
186
188
|
|
187
|
-
format = "%-#{reposize}s%-#{tagsize}s%-#{imagesize}s%-#{createsize}s%s"
|
188
|
-
puts format(format, :REPOSITORY, :TAG, :'IMAGE ID', :CREATED, :SIZE)
|
189
|
+
format = "%-#{reposize}s%-#{tagsize}s%-#{archsize}s%-#{imagesize}s%-#{createsize}s%s"
|
190
|
+
puts format(format, :REPOSITORY, :TAG, :ARCH, :'IMAGE ID', :CREATED, :SIZE)
|
189
191
|
::Docker::Image.all.each do |image|
|
190
|
-
image_info(image).each do |repo, tag, id, created, size|
|
191
|
-
puts format(format, repo, tag, id, created, size)
|
192
|
+
image_info(image).each do |repo, tag, arch, id, created, size|
|
193
|
+
puts format(format, repo, tag, arch, id, created, size)
|
192
194
|
end
|
193
195
|
end
|
194
196
|
end
|
197
|
+
# rubocop:enable Metrics/ParameterLists
|
195
198
|
|
196
199
|
# rubocop:disable Metrics/CyclomaticComplexity
|
197
200
|
# Take the given image and grab all of the parts of it which will be used to display the image info
|
198
201
|
private def image_info(image)
|
199
202
|
[].tap do |ary|
|
203
|
+
arch = image.json&.dig('Architecture')
|
200
204
|
id = image.info&.dig('id')&.split(':')&.last&.slice(0..11)
|
201
205
|
created = timesince(Time.at(image.info&.dig('Created')))
|
202
206
|
size = filesize(image.info&.dig('Size'))
|
@@ -206,7 +210,7 @@ module Dev
|
|
206
210
|
repo_urls.each do |repo_url|
|
207
211
|
repo, tag = repo_url.split(':')
|
208
212
|
tag ||= '<none>'
|
209
|
-
ary << [repo, tag, id, created, size]
|
213
|
+
ary << [repo, tag, arch, id, created, size]
|
210
214
|
end
|
211
215
|
end
|
212
216
|
end
|
@@ -215,24 +219,32 @@ module Dev
|
|
215
219
|
# Display a nicely formatted table of containers and their associated information
|
216
220
|
def print_containers
|
217
221
|
idsize = 15
|
218
|
-
imagesize =
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
222
|
+
imagesize = 20
|
223
|
+
archsize = 7
|
224
|
+
commandsize = 20
|
225
|
+
createsize = 15
|
226
|
+
statussize = 15
|
227
|
+
portsize = 20
|
228
|
+
namesize = 16
|
229
|
+
total = idsize + imagesize + archsize + commandsize + createsize + statussize + portsize + namesize
|
225
230
|
|
226
231
|
# If there is additional width available, add it to the repo and tag columns
|
227
|
-
additional = [((Rake.application.terminal_width - total) /
|
232
|
+
additional = [((Rake.application.terminal_width - total) / 3).floor, 0].max
|
233
|
+
|
234
|
+
# If there's enough extra, give some to the name as well
|
235
|
+
if additional > 40
|
236
|
+
namesize += 15
|
237
|
+
additional -= 5
|
238
|
+
end
|
228
239
|
imagesize += additional
|
240
|
+
commandsize += additional
|
229
241
|
portsize += additional
|
230
242
|
|
231
|
-
format = "%-#{idsize}s%-#{imagesize}s%-#{commandsize}s%-#{createsize}s%-#{statussize}s%-#{portsize}s
|
232
|
-
puts format(format, :'CONTAINER ID', :IMAGE, :COMMAND, :CREATED, :STATUS, :PORTS, :NAMES)
|
243
|
+
format = "%-#{idsize}s%-#{imagesize}s%-#{archsize}s%-#{commandsize}s%-#{createsize}s%-#{statussize}s%-#{portsize}s%-#{namesize}s"
|
244
|
+
puts format(format, :'CONTAINER ID', :IMAGE, :ARCH, :COMMAND, :CREATED, :STATUS, :PORTS, :NAMES)
|
233
245
|
::Docker::Container.all.each do |container|
|
234
|
-
id, image, command, created, status, ports, names = container_info(container)
|
235
|
-
puts format(format, id, image, command, created, status, ports, names)
|
246
|
+
id, image, arch, command, created, status, ports, names = container_info(container)
|
247
|
+
puts format(format, id, image.truncate(imagesize - 5), arch, command.truncate(commandsize - 5), created, status, ports.truncate(portsize - 5), names)
|
236
248
|
end
|
237
249
|
end
|
238
250
|
|
@@ -241,8 +253,8 @@ module Dev
|
|
241
253
|
private def container_info(container)
|
242
254
|
id = container.id&.slice(0..11)
|
243
255
|
image = container.info&.dig('Image')
|
244
|
-
|
245
|
-
command = container.info&.dig('Command')
|
256
|
+
arch = ::Docker::Image.get(image).json&.dig('Architecture')
|
257
|
+
command = container.info&.dig('Command')
|
246
258
|
created = timesince(Time.at(container.info&.dig('Created')))
|
247
259
|
status = container.info&.dig('Status')
|
248
260
|
|
@@ -257,7 +269,7 @@ module Dev
|
|
257
269
|
end&.join(', ')
|
258
270
|
names = container.info&.dig('Names')&.map { |name| name.split('/').last }&.join(', ')
|
259
271
|
|
260
|
-
[id, image, command, created, status, ports, names]
|
272
|
+
[id, image, arch, command, created, status, ports, names]
|
261
273
|
end
|
262
274
|
# rubocop:enable Metrics/CyclomaticComplexity
|
263
275
|
|
@@ -4,7 +4,8 @@ module Dev
|
|
4
4
|
module Template
|
5
5
|
# Module containing all default docker rake tasks
|
6
6
|
module Docker
|
7
|
-
# Class containing default rake tasks which are application agnostic
|
7
|
+
# Class containing default rake tasks which are application agnostic
|
8
|
+
# This means the commands will be run against all containers in the docker compose file (no service specified)
|
8
9
|
class Default < Dev::Template::BaseInterface
|
9
10
|
# Create the rake task which runs a docker compose build
|
10
11
|
def create_build_task!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firespring_dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -457,7 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
457
457
|
- !ruby/object:Gem::Version
|
458
458
|
version: '0'
|
459
459
|
requirements: []
|
460
|
-
rubygems_version: 3.
|
460
|
+
rubygems_version: 3.1.6
|
461
461
|
signing_key:
|
462
462
|
specification_version: 4
|
463
463
|
summary: Development environment maintenance command library
|