firespring_dev_commands 2.0.0.pre.alpha.1 → 2.0.0.pre.alpha.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: b97b8fe818682f14cecce80fc27d89db4ba7f72b0ca0d89eb642b2484dc8ab67
|
4
|
+
data.tar.gz: be5348cbf8241cb5fc35001adb4847acb5f0da5869a3bbb94ec2780bc1cdf28b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df84349976775661f229060bb7a45450b956c4122553f56d16ff60978ad1ee3b8258155ef61422515dbc6c32bef97160e4d66abeb0bb0d14550c6af7c569a128
|
7
|
+
data.tar.gz: f81d3319f36fdc423aabf89083a6811b355b30ea815ee9ac85d36702e5c99496898bbe1313822e57ffba709d1d918993a61649626e7d90ec681add431a9494c1
|
@@ -8,9 +8,8 @@ module Dev
|
|
8
8
|
# Class containing methods for interfacing with the docker compose cli
|
9
9
|
class Compose
|
10
10
|
# Config object for setting top level docker compose config options
|
11
|
-
Config = Struct.new(:
|
11
|
+
Config = Struct.new(:project_dir, :project_name, :compose_files, :min_version, :max_version) do
|
12
12
|
def initialize
|
13
|
-
self.executable_name = EXECUTABLE_NAME
|
14
13
|
self.project_dir = DEV_COMMANDS_ROOT_DIR
|
15
14
|
self.project_name = DEV_COMMANDS_PROJECT_NAME
|
16
15
|
self.compose_files = ["#{DEV_COMMANDS_ROOT_DIR}/docker-compose.yml"]
|
@@ -70,12 +69,12 @@ module Dev
|
|
70
69
|
# Checks the min and max version against the current docker version if they have been configured
|
71
70
|
def check_version
|
72
71
|
min_version = self.class.config.min_version
|
73
|
-
|
74
|
-
|
72
|
+
raise "requires #{EXECUTABLE_NAME} version >= #{min_version} (found #{self.class.version})" if min_version &&
|
73
|
+
!Dev::Common.new.version_greater_than(min_version, self.class.version)
|
75
74
|
|
76
75
|
max_version = self.class.config.max_version
|
77
|
-
|
78
|
-
|
76
|
+
raise "requires #{EXECUTABLE_NAME} version < #{max_version} (found #{self.class.version})" if max_version &&
|
77
|
+
Dev::Common.new.version_greater_than(max_version, self.class.version)
|
79
78
|
end
|
80
79
|
|
81
80
|
# Pull in supported env settings and call build
|
@@ -84,7 +83,6 @@ module Dev
|
|
84
83
|
def build
|
85
84
|
merge_options('--parallel')
|
86
85
|
merge_env_pull_option
|
87
|
-
merge_env_push_option
|
88
86
|
merge_env_cache_option
|
89
87
|
execute_command(build_command('build'))
|
90
88
|
end
|
@@ -183,13 +181,6 @@ module Dev
|
|
183
181
|
merge_options('--pull') if ENV['PULL'].to_s.strip == 'true'
|
184
182
|
end
|
185
183
|
|
186
|
-
# Merge --push option if PUSH is set to true and no existing push options are present
|
187
|
-
private def merge_env_push_option
|
188
|
-
return if @options.any? { |it| it.include?('push') }
|
189
|
-
|
190
|
-
merge_options('--push') if ENV['PUSH'].to_s.strip == 'true'
|
191
|
-
end
|
192
|
-
|
193
184
|
# Merge --no-build option unless BUILD is set to true and no existing build options are present
|
194
185
|
private def merge_env_build_option
|
195
186
|
return if @options.any? { |it| it.include?('build') }
|
@@ -239,7 +230,7 @@ module Dev
|
|
239
230
|
|
240
231
|
# Build the compose command with the given inputs
|
241
232
|
private def build_command(action, *cmd)
|
242
|
-
command =
|
233
|
+
command = [EXECUTABLE_NAME]
|
243
234
|
command << '--project-directory' << project_dir
|
244
235
|
command << '-p' << project_name if project_name
|
245
236
|
Array(compose_files).compact.each { |file| command << '-f' << file }
|