firespring_dev_commands 2.0.0 → 2.0.1.pre.alpha.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: 52fab6ead6110ad2641d13003b16757be66c3928545d8185c4db3eed806d2443
4
- data.tar.gz: '0892d45189fef73d8b20364d696bbd853c635096848e04c8ade75e46f6ba8d2b'
3
+ metadata.gz: 74827accfb664c9f4170d5e6f0daa426963d0ae1aed9ebccae0b2d971c34923a
4
+ data.tar.gz: 4dc09342dd87e31c76b68675b910787f6f4a23752a0a9546d15b80e67befdee3
5
5
  SHA512:
6
- metadata.gz: c8e557565fd8478b0a8d55d3415290871c00201aed6030bbc95ccccddc36d399b47ec58933a8cc915e350ebf3fcfaa7c7066551509bd17705d33aa36b4dd1fb9
7
- data.tar.gz: a3449ac14b161ff2dc385f1b68ab0a6362a8bfab21b4c964b2a04db90740b5c866f22b3fda1e4b8e3f1ce9b89711f1c5e759405dcd411851a9a31de42fc549ad
6
+ metadata.gz: ae83b7b87ab131bca8958bd6c2e84e5a14bda7b0588f107d8199d93684fe47146683c3097f6d5add843db1caa1c7f511d321916dac9142528fd22a7326962f5d
7
+ data.tar.gz: da782857eb8a4a06b0468e66bf3565a908961bd18fe7e9d3b12779feab97d2f5b4fa53997d3fad169c9c99e46a777707619616c188353d77888517906107befc
@@ -8,8 +8,9 @@ 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(:project_dir, :project_name, :compose_files, :min_version, :max_version) do
11
+ Config = Struct.new(:executable_name, :project_dir, :project_name, :compose_files, :min_version, :max_version) do
12
12
  def initialize
13
+ self.executable_name = EXECUTABLE_NAME
13
14
  self.project_dir = DEV_COMMANDS_ROOT_DIR
14
15
  self.project_name = DEV_COMMANDS_PROJECT_NAME
15
16
  self.compose_files = ["#{DEV_COMMANDS_ROOT_DIR}/docker-compose.yml"]
@@ -69,12 +70,12 @@ module Dev
69
70
  # Checks the min and max version against the current docker version if they have been configured
70
71
  def check_version
71
72
  min_version = self.class.config.min_version
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)
73
+ version_too_low = min_version && !Dev::Common.new.version_greater_than(min_version, self.class.version)
74
+ raise "requires #{self.class.config.executable_name} version >= #{min_version} (found #{self.class.version})" if version_too_low
74
75
 
75
76
  max_version = self.class.config.max_version
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)
77
+ version_too_high = max_version && Dev::Common.new.version_greater_than(max_version, self.class.version)
78
+ raise "requires #{self.class.config.executable_name} version < #{max_version} (found #{self.class.version})" if version_too_high
78
79
  end
79
80
 
80
81
  # Pull in supported env settings and call build
@@ -83,6 +84,7 @@ module Dev
83
84
  def build
84
85
  merge_options('--parallel')
85
86
  merge_env_pull_option
87
+ merge_env_push_option
86
88
  merge_env_cache_option
87
89
  execute_command(build_command('build'))
88
90
  end
@@ -181,6 +183,13 @@ module Dev
181
183
  merge_options('--pull') if ENV['PULL'].to_s.strip == 'true'
182
184
  end
183
185
 
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
+
184
193
  # Merge --no-build option unless BUILD is set to true and no existing build options are present
185
194
  private def merge_env_build_option
186
195
  return if @options.any? { |it| it.include?('build') }
@@ -230,7 +239,7 @@ module Dev
230
239
 
231
240
  # Build the compose command with the given inputs
232
241
  private def build_command(action, *cmd)
233
- command = [EXECUTABLE_NAME]
242
+ command = self.class.config.executable_name.split(/\s+/)
234
243
  command << '--project-directory' << project_dir
235
244
  command << '-p' << project_name if project_name
236
245
  Array(compose_files).compact.each { |file| command << '-f' << file }
@@ -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 = '2.0.0'.freeze
9
+ VERSION = '2.0.1.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: 2.0.0
4
+ version: 2.0.1.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-07-06 00:00:00.000000000 Z
11
+ date: 2023-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -313,9 +313,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
313
313
  version: '3.2'
314
314
  required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  requirements:
316
- - - ">="
316
+ - - ">"
317
317
  - !ruby/object:Gem::Version
318
- version: '0'
318
+ version: 1.3.1
319
319
  requirements: []
320
320
  rubygems_version: 3.4.10
321
321
  signing_key: