on_container 0.0.14 → 0.0.17

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: 9375ce2312b71fcf2711319eb18e58c1e08bfef053edd28bc05e22c9dfeba543
4
- data.tar.gz: '078fa6d17b8586ebdccdfd033983969a6818df32aedfb22d8a0c4d40dd6e274f'
3
+ metadata.gz: eed50e20955f44cedd05bbe573a86af912f532c709b947c08830f7accb9fec87
4
+ data.tar.gz: 736ca61c1c66875fa3873432fa8e5c9d452a15f9ae3ce4deef051914a4b838e0
5
5
  SHA512:
6
- metadata.gz: 6d76eb51ac0bfbfd78518c711cd627ee9c24b69b44995f4e2728268d12d414422bdbde4881bd95b0962b640d4a1d635cd141632cfa0d2130be3f5b47de57eb88
7
- data.tar.gz: f7b57e656c49b8435e4434156fee713cbc2af2fdc508371aa290276dd8e1511f50eefe077727a0648092e9f03e5e1fb63fbc2f1abb030bc7192e017d7c948ad9
6
+ metadata.gz: 24bb727cfe9cd0c052befbda70a4979c2f2d38e26268480eb62c12638b7911e76a98e11873d3479551098705ee369493123869aa31d2cd8b69c4f53852f89182
7
+ data.tar.gz: c7b5fcb41cf3415183c237ab68a155e4f4dcf3f5c75dc2276f536a31cb7c64cb90520666ba630b212295e5b02bd842a46d6065a52220593e19ecdfcfa2aa36b7
@@ -13,7 +13,8 @@ module OnContainer
13
13
  require 'yaml'
14
14
 
15
15
  database_yaml = Pathname.new File.expand_path('config/database.yml')
16
- loaded_yaml = YAML.load(ERB.new(database_yaml.read).result) || {}
16
+ database_config = ERB.new(database_yaml.read).result
17
+ loaded_yaml = YAML.safe_load(database_config, aliases: true) || {}
17
18
  shared = loaded_yaml.delete('shared')
18
19
 
19
20
  loaded_yaml.each { |_k, values| values.reverse_merge!(shared) } if shared
@@ -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.14'
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.14
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-03-05 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