fly.io-rails 0.1.18-x64-mingw32 → 0.1.19-x64-mingw32

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: de0c354099a707c5df36e1661c21870170a523d2755ea0935891cf4bf14d9783
4
- data.tar.gz: c1eb047bea6edfa1de626ecc43c53951e26f44fdef79db0d26d769203a4f0369
3
+ metadata.gz: 7fa806e7f277dde435a4527d99759cb1ce8c9a56e174a05bf82490bc765cbcc7
4
+ data.tar.gz: f86bcdb1d12ec8cc4df3340e7ad24c4ee033d7721b191a3054f850221d30fc4b
5
5
  SHA512:
6
- metadata.gz: e919bec2e6d040b0e66155a433b7068eab2294dc6d34e74549f7e0b12f99cef8f30cc28bb1bcdad0ba44aa00334c98132fe014b76bb89af5087656b14ab630f4
7
- data.tar.gz: f44a08b3ce2ae82f0ad3f7d1f98b07489bc7f236e5a1fc1b787a9c4828a0af6e3597dd546e269135f16bec8a48cdd2cff5da9644e032b7f525e26bb35d217107
6
+ metadata.gz: 5b959b420fad0923f0e53502194fde19f117e13b23118975e83bda6de7cb33052fcc58b339e69d7271c3ab25c1121eb241e77c2ff7cb701ebd7fd8ce2e2cec9f
7
+ data.tar.gz: d7cc24bc4dd138c16f7a7d19f429cf1cdee5e1b1bb960ef64f57b37c65b6bef0d6ae90b2042bc3f3566f1d3672624d6cfd59130eb78f64be6c1f23c754924c0d
@@ -365,13 +365,15 @@ module Fly
365
365
 
366
366
  # stop previous instances - list will fail on first run
367
367
  stdout, stderr, status = Open3.capture3('fly machines list --json')
368
+ existing_machines = []
368
369
  unless stdout.empty?
369
- JSON.parse(stdout).each do |list|
370
- next if list['id'] == machine or list['state'] == 'destroyed'
371
- cmd = "fly machines remove --force #{list['id']}"
372
- say_status :run, cmd
373
- system cmd
374
- end
370
+ JSON.parse(stdout).each do |list|
371
+ existing_machines << list['name']
372
+ next if list['id'] == machine or list['state'] == 'destroyed'
373
+ cmd = "fly machines remove --force #{list['id']}"
374
+ say_status :run, cmd
375
+ system cmd
376
+ end
375
377
  end
376
378
 
377
379
  # configure sqlite3 (can be overridden by fly.toml)
@@ -410,7 +412,10 @@ module Fly
410
412
  options = {region: @region, config: config}
411
413
  say_status :fly, "start #{app}"
412
414
  if not toml['processes'] or toml['processes'].empty?
413
- options[:name] = "#{app}-machine",
415
+ options[:name] = "#{app}-machine"
416
+ taken = existing_machines.find {|name| name.start_with? options[:name]}
417
+ options[:name] = taken == options[:name] ? "#{taken}-2" : taken.next if taken
418
+
414
419
  start = Fly::Machines.create_and_start_machine(app, options)
415
420
  machines['app'] = start[:id]
416
421
  else
@@ -418,11 +423,14 @@ module Fly
418
423
  config[:env]['NATS_SERVER'] = 'localhost'
419
424
  toml['processes'].each do |name, entrypoint|
420
425
  options[:name] = "#{app}-machine-#{name}"
426
+ taken = existing_machines.find {|name| name.start_with? options[:name]}
427
+ options[:name] = taken == options[:name] ? "#{taken}-2" : taken.next if taken
428
+
421
429
  config[:env]['SERVER_COMMAND'] = entrypoint
422
430
  start = Fly::Machines.create_and_start_machine(app, options)
423
431
 
424
432
  if start['error']
425
- STDERR.puts "ERROR: #{start.error}"
433
+ STDERR.puts "ERROR: #{start['error']}"
426
434
  exit 1
427
435
  end
428
436
 
@@ -1,3 +1,3 @@
1
1
  module Fly_io
2
- VERSION = '0.1.18'
2
+ VERSION = '0.1.19'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fly.io-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-24 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fly-ruby