on_container 0.0.16 → 0.0.17

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: de09d3647113016448d9e6a404de9a51eeb765f63ae25865ccbcfa0ab0d51715
4
- data.tar.gz: 809874753f0c96632637e5f1427aca262695dc027bae68369541e9e835c096b1
3
+ metadata.gz: eed50e20955f44cedd05bbe573a86af912f532c709b947c08830f7accb9fec87
4
+ data.tar.gz: 736ca61c1c66875fa3873432fa8e5c9d452a15f9ae3ce4deef051914a4b838e0
5
5
  SHA512:
6
- metadata.gz: c477f9274afcf3600a6e6a1e1570cc977ecee690ae0e85ceeefe13e131e305fc539f3b931dcfd03a06a9df2b30516047e7a46f226532a37d347c82ba0bd6c273
7
- data.tar.gz: cee733d1fc26f46c113ec389efb8477a342303624c09f22eea6a604d34280e6bdc4cbeb2197ea80affeb8cd8892d4ee7db9790cf104fa2e2ad5280f880b7b350
6
+ metadata.gz: 24bb727cfe9cd0c052befbda70a4979c2f2d38e26268480eb62c12638b7911e76a98e11873d3479551098705ee369493123869aa31d2cd8b69c4f53852f89182
7
+ data.tar.gz: c7b5fcb41cf3415183c237ab68a155e4f4dcf3f5c75dc2276f536a31cb7c64cb90520666ba630b212295e5b02bd842a46d6065a52220593e19ecdfcfa2aa36b7
@@ -4,25 +4,37 @@ module OnContainer
4
4
  module Dev
5
5
  module SetupOps
6
6
  APP_PATH = File.expand_path '.'
7
-
8
- def app_temp_path; "#{APP_PATH}/tmp"; end
9
- def app_setup_wait; ENV.fetch('APP_SETUP_WAIT', '5').to_i; end
10
- def app_setup_lock_path; "#{app_temp_path}/setup.lock"; end
11
-
7
+ TRUEISH_VALUES = %w[true True TRUE yes Yes YES].freeze
8
+ SKIP_SETUP_ENV_VAR = 'ON_CONTAINER_SKIP_SETUP_LOCK'.freeze
9
+
10
+ def app_temp_path
11
+ "#{APP_PATH}/tmp"
12
+ end
13
+
14
+ def app_setup_wait
15
+ ENV.fetch('APP_SETUP_WAIT', '5').to_i
16
+ end
17
+
18
+ def app_setup_lock_path
19
+ "#{app_temp_path}/setup.lock"
20
+ end
21
+
12
22
  def lock_setup
13
23
  system "mkdir -p #{app_temp_path} && touch #{app_setup_lock_path};"
14
24
  end
15
-
25
+
16
26
  def unlock_setup
17
27
  system "rm -rf #{app_setup_lock_path}"
18
28
  end
19
-
29
+
20
30
  def wait_setup
21
31
  puts 'Waiting for app setup to finish...'
22
32
  sleep app_setup_wait
23
33
  end
24
34
 
25
35
  def on_setup_lock_acquired
36
+ return yield if TRUEISH_VALUES.include? ENV[SKIP_SETUP_ENV_VAR]
37
+
26
38
  wait_setup while File.exist?(app_setup_lock_path)
27
39
 
28
40
  lock_setup
@@ -32,7 +44,6 @@ module OnContainer
32
44
  end
33
45
 
34
46
  yield
35
-
36
47
  ensure
37
48
  unlock_setup
38
49
  end
@@ -42,7 +53,7 @@ module OnContainer
42
53
  rails rspec sidekiq hutch puma rake webpack webpack-dev-server
43
54
  ].include?(ARGV[0])
44
55
  end
45
-
56
+
46
57
  def command_might_require_database?
47
58
  %w[
48
59
  rails rspec sidekiq hutch puma rake
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnContainer
4
- VERSION = '0.0.16'
4
+ VERSION = '0.0.17'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport