fly-ruby 0.1.0 → 0.1.1

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: 22dd71b806c6b21ec539f8fbeaf046a502134c4fcff78c9294f32602ceb82760
4
- data.tar.gz: a8840d2201bbc30175c36d30ed98833415a3621b42282c5bec8d787690a01f25
3
+ metadata.gz: 82d6cde56b619737984124f61e7fc526129eebb493e1954f9b9b171202d8eed0
4
+ data.tar.gz: 2a14fee50d07739be04a19476128671878fb448fbe1cf23654df254beba4507a
5
5
  SHA512:
6
- metadata.gz: c1b8977226ee069be065c7b8baad3b242dfbe47560854ff3d1f20a6b02d95f3394a82f70fac4fb63c051387d5fb51cd16fc68b8f7ccf6d6323512e43c39559a0
7
- data.tar.gz: 437c3d32c3498508d98cdc7ab96482260c93f367a754038985d124f1ffb05154cf4a3424650a0fb974d7f8c314188e9403556e8c7f00e150db7b5430b689b52b
6
+ metadata.gz: 87c976601cddc300a435f503983f5de87e54c7965b07fd36232526c8e3da26e4ac2f40b729e6f701924d9371872adeaafd780937eb9a750af95c8f6cb59b9012
7
+ data.tar.gz: 0c528dbb8a6d4035a754f8b580562c21194a37e999c64f82831aa2c70e0cb53b3687d9e94bbcaf67fe7ca1526f96232b87bb77a4dac1d017b30dcca080c9315d
@@ -2,9 +2,6 @@ on: [push, pull_request]
2
2
  name: Test
3
3
  jobs:
4
4
  test:
5
- defaults:
6
- run:
7
- working-directory: fly-ruby
8
5
  name: Test on ruby ${{ matrix.ruby_version }} with options - ${{ toJson(matrix.options) }}
9
6
  runs-on: ${{ matrix.os }}
10
7
  strategy:
data/Rakefile CHANGED
@@ -9,3 +9,8 @@ end
9
9
 
10
10
  desc "Run tests"
11
11
  task default: :test
12
+
13
+
14
+ task :top do
15
+ puts Rake.application.top_level_tasks
16
+ end
@@ -1,3 +1,5 @@
1
+ require 'rake'
2
+
1
3
  module Fly
2
4
  # Note that using instance variables in Rack middleware is considered a poor practice in
3
5
  # multithreaded environments. Instead of using dirty tricks like using Object#dup,
@@ -9,8 +11,19 @@ module Fly
9
11
  prefer_regional_database! unless in_primary_region?
10
12
  end
11
13
 
14
+ def console?
15
+ defined?(::Rails::Console) && $stdout.isatty && $stdin.isatty
16
+ end
17
+
18
+ def rake_task?
19
+ defined?(::Rake) && !Rake.application.top_level_tasks.empty?
20
+ end
21
+
12
22
  # Overwrite the primary database URL with that of the regional replica
13
23
  def prefer_regional_database!
24
+ # Don't override the database if migrations are running
25
+ return if console? || rake_task?
26
+
14
27
  uri = URI.parse(Fly.configuration.database_url)
15
28
  hostname = "#{Fly.configuration.current_region}.#{uri.hostname}"
16
29
  port = 5433
@@ -0,0 +1,3 @@
1
+ class Fly
2
+ VERSION = "0.1.1"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fly-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Sierles
@@ -42,6 +42,7 @@ files:
42
42
  - lib/fly-ruby/configuration.rb
43
43
  - lib/fly-ruby/railtie.rb
44
44
  - lib/fly-ruby/regional_database.rb
45
+ - lib/fly-ruby/version.rb
45
46
  homepage: https://github.com/superfly/fly-ruby
46
47
  licenses:
47
48
  - BSD-3-Clause