firespring_dev_commands 1.5.1 → 1.5.2.pre.alpha.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3c168777840a74d673865425bb46fc40829a400da55eaf02ff41ed49ea313d6
4
- data.tar.gz: bdd2000d78e663d5bd2b1cfe2cf0c0f343eed6041bdb38cf3936939b64a93c85
3
+ metadata.gz: 25122e7d7a7eb50aff267813f1331a063f2d9a236f2ab36a97ac8d480b30393c
4
+ data.tar.gz: 94cd0be8b52b37c9c621d81ce5f6e99bdfc479c7160e07f391a586d62280078e
5
5
  SHA512:
6
- metadata.gz: cfa2fc2f86ec206c038883915b483a52608d020b9ad1251b22c8a76aa2704c98417f6a13f1528a4d66d412233d533333b6aebad3a6a136ea362f0d7cd600ef3a
7
- data.tar.gz: 4c08e59208aa3298b04ee2dcb7367fcfd66192bbb5adad7644fa7dd34be197541badbfab8c16c16fea3476fad60d27ec5491fc787e373811df8daae6b3e53355
6
+ metadata.gz: cce2ac75453d81e00e6ded5e4d0cd9dd1eedf4221b74b12bc2d9f9cae3b31d96321b553a3b93fefd6b2d8d4f0496f2a013225e6d2b38c477b1e0247031e1ce30
7
+ data.tar.gz: 2b34bf1d37005e14f0868dace08ad41d0c6fccfee2fac6ab9f18354eb2f46993dcd6fa08253339b54cb45381b17d25e1d03bbdfbff2a266e67dd2c6a43074e7a
@@ -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 = 79
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 = 25
219
- commandsize = 25
220
- createsize = 17
221
- statussize = 16
222
- portsize = 25
223
- namesize = 10
224
- total = idsize + imagesize + commandsize + createsize + statussize + portsize + namesize
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) / 2).floor, 0].max
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%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')&.truncate(20)
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 (run against all containers)
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!
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '1.5.1'.freeze
9
+ VERSION = '1.5.2.pre.alpha.1'.freeze
10
10
  end
11
11
  end
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.1
4
+ version: 1.5.2.pre.alpha.1
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-06 00:00:00.000000000 Z
11
+ date: 2023-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -453,11 +453,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
453
453
  version: '2.7'
454
454
  required_rubygems_version: !ruby/object:Gem::Requirement
455
455
  requirements:
456
- - - ">="
456
+ - - ">"
457
457
  - !ruby/object:Gem::Version
458
- version: '0'
458
+ version: 1.3.1
459
459
  requirements: []
460
- rubygems_version: 3.3.25
460
+ rubygems_version: 3.1.6
461
461
  signing_key:
462
462
  specification_version: 4
463
463
  summary: Development environment maintenance command library