firespring_dev_commands 2.0.1.pre.alpha.1 → 2.0.1.pre.alpha.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f20a3e8cf4609a9d757ff0c9ff233406ced80baecd6edcd78e5ed9a4edd0ce
|
4
|
+
data.tar.gz: 1cee96ca926be8b395a9975aabdeae1296f0f64a7072de2372b83d9c5e2f2cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f62564f2e7455095a02d747231fc144b5f10ddd154fc7344adc0364e0f2019cc930c17c29a99dd21fa13ed59843ed9891120ec73e41e79de3309c36ca943932c
|
7
|
+
data.tar.gz: d7d55469c2750efa3f61afa18a71e542b5575d71997b15f9ed36173c60b1bb2c8430dc4feb61aea03f0edbeacd2d6635cf407457826dd72a40a5a0cb9fe213fe
|
@@ -7,14 +7,16 @@ module Dev
|
|
7
7
|
class Docker
|
8
8
|
# Class containing methods for interfacing with the docker compose cli
|
9
9
|
class Compose
|
10
|
+
# The name of the docker compose executable
|
11
|
+
EXECUTABLE_NAME = %w(docker compose).freeze
|
12
|
+
|
10
13
|
# Config object for setting top level docker compose config options
|
11
|
-
Config = Struct.new(:
|
14
|
+
Config = Struct.new(:project_dir, :project_name, :compose_files, :min_version, :max_version) do
|
12
15
|
def initialize
|
13
|
-
self.executable_name = EXECUTABLE_NAME
|
14
16
|
self.project_dir = DEV_COMMANDS_ROOT_DIR
|
15
17
|
self.project_name = DEV_COMMANDS_PROJECT_NAME
|
16
18
|
self.compose_files = ["#{DEV_COMMANDS_ROOT_DIR}/docker-compose.yml"]
|
17
|
-
self.min_version =
|
19
|
+
self.min_version = '2.0.0'
|
18
20
|
self.max_version = nil
|
19
21
|
end
|
20
22
|
end
|
@@ -34,14 +36,11 @@ module Dev
|
|
34
36
|
|
35
37
|
# Returns the version of the docker-compose executable on the system
|
36
38
|
def version
|
37
|
-
|
39
|
+
version_cmd = EXECUTABLE_NAME.dup << 'version'
|
40
|
+
@version ||= `#{version_cmd.join(' ')}`.match(/version v?([0-9.]+)/)[1]
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
41
|
-
# @todo Change this to "docker compose" when everyone is off v1
|
42
|
-
# The name of the docker compose executable
|
43
|
-
EXECUTABLE_NAME = 'docker-compose'.freeze
|
44
|
-
|
45
44
|
attr_accessor :capture, :compose_files, :environment, :options, :project_dir, :project_name, :services, :user, :volumes
|
46
45
|
|
47
46
|
def initialize(
|
@@ -71,11 +70,11 @@ module Dev
|
|
71
70
|
def check_version
|
72
71
|
min_version = self.class.config.min_version
|
73
72
|
version_too_low = min_version && !Dev::Common.new.version_greater_than(min_version, self.class.version)
|
74
|
-
raise "requires
|
73
|
+
raise "requires docker compose version >= #{min_version} (found #{self.class.version})" if version_too_low
|
75
74
|
|
76
75
|
max_version = self.class.config.max_version
|
77
76
|
version_too_high = max_version && Dev::Common.new.version_greater_than(max_version, self.class.version)
|
78
|
-
raise "requires
|
77
|
+
raise "requires docker compose version < #{max_version} (found #{self.class.version})" if version_too_high
|
79
78
|
end
|
80
79
|
|
81
80
|
# Pull in supported env settings and call build
|
@@ -239,7 +238,7 @@ module Dev
|
|
239
238
|
|
240
239
|
# Build the compose command with the given inputs
|
241
240
|
private def build_command(action, *cmd)
|
242
|
-
command =
|
241
|
+
command = EXECUTABLE_NAME.dup
|
243
242
|
command << '--project-directory' << project_dir
|
244
243
|
command << '-p' << project_name if project_name
|
245
244
|
Array(compose_files).compact.each { |file| command << '-f' << file }
|
@@ -201,6 +201,8 @@ module Dev
|
|
201
201
|
private def image_info(image)
|
202
202
|
[].tap do |ary|
|
203
203
|
arch = image.json&.dig('Architecture')
|
204
|
+
variant = image.json&.dig('Variant')
|
205
|
+
arch = "#{arch}/#{variant}" if variant
|
204
206
|
id = image.info&.dig('id')&.split(':')&.last&.slice(0..11)
|
205
207
|
created = timesince(Time.at(image.info&.dig('Created')))
|
206
208
|
size = filesize(image.info&.dig('Size'))
|
@@ -253,7 +255,10 @@ module Dev
|
|
253
255
|
private def container_info(container)
|
254
256
|
id = container.id&.slice(0..11)
|
255
257
|
image = container.info&.dig('Image')
|
256
|
-
|
258
|
+
image_json = ::Docker::Image.get(image).json
|
259
|
+
arch = image_json&.dig('Architecture')
|
260
|
+
variant = image_json&.dig('Variant')
|
261
|
+
arch = "#{arch}/#{variant}" if variant
|
257
262
|
command = container.info&.dig('Command')
|
258
263
|
created = timesince(Time.at(container.info&.dig('Created')))
|
259
264
|
status = container.info&.dig('Status')
|
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: 2.0.1.pre.alpha.
|
4
|
+
version: 2.0.1.pre.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|