platform_sh 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/platform_sh.rb +19 -16
- data/lib/platform_sh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d7dc484d0414e3a3d3033ca3a5435910932c4c9
|
4
|
+
data.tar.gz: 5e234ccea2bc43683dbefe4ec7ee60547116c745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c0fa7f383216fd004bc70287936e8f857b3f4d1e52e4fc59f303a3e668371155bc909d4ca2c611c9d82e031e2d8ec968feb3024b1a91b80ec298c1ef0d0139
|
7
|
+
data.tar.gz: 4f4ff7373bb4c045817222e20decddb343bf8534bea8feadadca7f45dafc684ae8a5fbd9621587fde8834d979d7a0d0ba673cdc648bd5d892ae89d6e216111ab
|
data/lib/platform_sh.rb
CHANGED
@@ -57,23 +57,26 @@ class PlatformSH
|
|
57
57
|
|
58
58
|
#Tries to guess relational database url
|
59
59
|
def self.guess_database_url
|
60
|
-
databases = PlatformSH::config["relationships"].select {|k,v| v[0]["scheme"]=="mysql" || v[0]["scheme"]=="
|
60
|
+
databases = PlatformSH::config["relationships"].select {|k,v| v[0]["scheme"]=="mysql" || v[0]["scheme"]=="pgsql"}
|
61
61
|
case databases.length
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
62
|
+
when 0
|
63
|
+
$stderr.puts "Could not find a relational database"
|
64
|
+
return nil
|
65
|
+
when 1
|
66
|
+
database = databases.first[1][0]
|
67
|
+
#This is needed to choose between mysql and mysql2 gems, magically.
|
68
|
+
case database['scheme']
|
69
|
+
when "mysql"
|
70
|
+
scheme = "mysql2"
|
71
|
+
when "pgsql"
|
72
|
+
scheme = "postgresql"
|
73
|
+
else
|
74
|
+
scheme = database['scheme']
|
75
|
+
end
|
76
|
+
database_url = "#{scheme}://#{database['username']}:#{database['password']}@#{database['host']}:#{database['port']}/#{database['path']}"
|
77
|
+
return database_url
|
78
|
+
else
|
79
|
+
$stderr.puts "More than one database, giving up, set configuration by hand"
|
77
80
|
end
|
78
81
|
end
|
79
82
|
|
data/lib/platform_sh/version.rb
CHANGED