kamal-backup 0.2.2 → 0.2.4

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: 49afc009b695f3cf7f456e1b68b2b744f5adc7138f7ca4d0c84ffb1f0d3b766d
4
- data.tar.gz: fc0261dc6c744a19e02460f27aab7e8f7555de779ea1fe7827a2fdf077042071
3
+ metadata.gz: '009f30f01097f555a3406c2c95920e902f558a878ec3b9a979966a469f5a8bc6'
4
+ data.tar.gz: 80c16762979f20700d77ee7bcb4dc5304af995e32902e5010cc4be019ee83744
5
5
  SHA512:
6
- metadata.gz: 39839b0f31f1e5a9bf561e63ee2248330d1857f5f21c2736e1668aed2e226c79e3c6063c6195a6bb09e05c180bfd42a6cd6901271638e3dbba2a36ab8146844f
7
- data.tar.gz: 3bb459e3ff320cff130ac29c523a09c50b85b3efb98ad977410cdd2db0a53e333fce935f8a92aaa65325b7d421ce36be4ed92c49a6f46d5836184f2a4009e94e
6
+ metadata.gz: ccda8ac86c357f17665bf66956c40c20838a07271a3fbb4c7e5c4e959f240229a6f78c8fe5efe3641a25ead65f4ea14c945db8724319e019b365a98356657d8c
7
+ data.tar.gz: 794c437faa846c180290bd86c631fef310ff6066a5c5948efedd1a76f24e505e2f62b1acd5b76f8cd78d44aa263d6e84329e98ec2ed78cacd1560099024645a8
@@ -6,11 +6,12 @@ module KamalBackup
6
6
  DEFAULT_CONFIG_FILE = "config/deploy.yml"
7
7
  VERSION_LINE_PATTERN = /\A\d+(?:\.\d+)+(?:[-.][A-Za-z0-9]+)*\z/
8
8
 
9
- def initialize(redactor:, config_file: nil, destination: nil, env: ENV)
9
+ def initialize(redactor:, config_file: nil, destination: nil, env: ENV, cwd: Dir.pwd)
10
10
  @redactor = redactor
11
11
  @config_file = config_file
12
12
  @destination = destination
13
13
  @env = env
14
+ @cwd = cwd
14
15
  end
15
16
 
16
17
  def accessory_name(preferred: nil)
@@ -159,7 +160,7 @@ module KamalBackup
159
160
 
160
161
  def kamal_config_argv
161
162
  [
162
- "kamal",
163
+ *kamal_command,
163
164
  "config",
164
165
  *kamal_option_argv,
165
166
  "--version",
@@ -169,24 +170,34 @@ module KamalBackup
169
170
 
170
171
  def kamal_exec_argv(accessory_name, command)
171
172
  [
172
- "kamal",
173
+ *kamal_command,
173
174
  "accessory",
174
175
  "exec",
176
+ *kamal_option_argv,
175
177
  accessory_name,
176
- command,
177
- *kamal_option_argv
178
+ command
178
179
  ]
179
180
  end
180
181
 
181
182
  def kamal_secrets_print_argv
182
183
  [
183
- "kamal",
184
+ *kamal_command,
184
185
  "secrets",
185
186
  "print",
186
187
  *kamal_option_argv
187
188
  ]
188
189
  end
189
190
 
191
+ def kamal_command
192
+ if File.executable?(File.join(@cwd, "bin", "kamal"))
193
+ [ "bin/kamal" ]
194
+ elsif File.file?(File.join(@cwd, "Gemfile"))
195
+ [ "bundle", "exec", "kamal" ]
196
+ else
197
+ [ "kamal" ]
198
+ end
199
+ end
200
+
190
201
  def kamal_option_argv
191
202
  argv = []
192
203
  argv.concat(["-c", @config_file]) if @config_file
@@ -9,6 +9,9 @@ module KamalBackup
9
9
  end
10
10
 
11
11
  def run
12
+ $stdout.sync = true
13
+ $stderr.sync = true
14
+
12
15
  install_signal_handlers
13
16
  sleep_interruptibly(@config.backup_start_delay_seconds)
14
17
 
@@ -1,3 +1,3 @@
1
1
  module KamalBackup
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamal-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - crmne