fly.io-rails 0.1.18-arm64-darwin → 0.1.19-arm64-darwin

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: 7389af7bf88265119e2d06aa049355559bc4028f0d3dece0d0e8953343e4f862
4
- data.tar.gz: c152a91850b5b485a20587c6dc00c07bd5dbfd0598bc732a55195e1e9660b01b
3
+ metadata.gz: 3c377a9ad2cc1b010d8ce03e8ab13102188a78577c3a3f6324cabb7a7f26d7ad
4
+ data.tar.gz: 8433d90ec57bf0ce16c039f8319daf15c7bdc4aacf719f7d07acc63635a1a6eb
5
5
  SHA512:
6
- metadata.gz: 4f0cd311b53e3eeac2b85249759f66d6a978187df0597a83458bc4d99522d9657ffc06a150ff6ab8580ffb246ce57ddd6851c13722b1585dd26e8b8fb6479101
7
- data.tar.gz: 75c9ca90be85fa0a003fc4ba47924f0414a0ee5f794c3412fc072bd78c7f714ce0e3d7220866df6fbad935484bace0e43e00b5d236f41a9945bbda9d84be70bc
6
+ metadata.gz: ac7e4a4a9364564bdd466297a6aadca1b0279c9f9f8cca4a71d26ccd66456ef2f4c0645cdb9dfa46dfc80e62a7d6d9e509fb4ce99df3bec9af6dde9df43864c0
7
+ data.tar.gz: 2a3a4538ea643f7cf5cf5dc5e818767f2e5c4952eb76f155c24eceb5cfde30f5582e307534409c30b56f4506846c874a96762b79101360f0d7576835707376bc
@@ -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: arm64-darwin
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