blackstack-db 1.0.8 → 1.0.9

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: e7bb074f4d88555ea328860cc08bc1ba72a2299db81fef74ed839e0ca22f3d34
4
- data.tar.gz: 3cfdd099de0d3f6dc05e7f553e4dc94f5420e3af94552cda2c8f1d9196ad7c4c
3
+ metadata.gz: bbd6c260dad3244665d28642c195ac7c30c4e793618a63a3d9b5e8d20a0d5222
4
+ data.tar.gz: 235c9e11c1dfd0095ae7d0c426a4960499d899c13e5f621c4d55b4048e481f9e
5
5
  SHA512:
6
- metadata.gz: 3edc6fb80fa604ec8c2862df98509398b856bc2e517c97d563e602b757c04066b8365c12d4ea50c37dbaf494ec778fe14dc71a730d53312f0ecc75595f911d15
7
- data.tar.gz: 6d18124e13b0cdcc2f64c4c3567d3f57f5968f06d7e75587c9cc7141cd06aec6c433ad42760cb84b3f4808a002e773de8d7419b87784547cc8f9b8721a302303
6
+ metadata.gz: 8d1e697ab4f75d02f900fc5a095840306ba58170eb7965e6ef2634701e25b7c9ddaf6fa9f68bc91f2e5e28b071d5801af6ac9adfbcdbd04f99c4ecef2a7e4fb1
7
+ data.tar.gz: 623ec3594481d480dfa2c015f7b3ef1659c7d25c9eca0f820e9075ff997daef76514c14b8e63064b10e386484c3023a0e62148427317eb25f89baa6511642614
@@ -130,9 +130,7 @@ module BlackStack
130
130
 
131
131
  l.logs "Testing connection... "
132
132
  begin
133
- @db = BlackStack::Deployer::DB::connect(
134
- BlackStack::CRDB::connection_string # use the connection parameters setting in ./config.rb
135
- )
133
+ @db = BlackStack::CRDB::connect
136
134
  l.logf "success".green
137
135
  rescue => e
138
136
  l.logf "failed".red
@@ -80,7 +80,8 @@ module BlackStack
80
80
  # create database connection
81
81
  def self.connect
82
82
  BlackStack::set_db_type(BlackStack::TYPE_POSTGRESQL)
83
- Sequel.connect(BlackStack::PostgreSQL.connection_string)
83
+ s = BlackStack::PostgreSQL.connection_string
84
+ Sequel.connect(s)
84
85
  end
85
86
 
86
87
  # return a postgresql uuid
@@ -112,9 +113,7 @@ module BlackStack
112
113
 
113
114
  l.logs "Testing connection... "
114
115
  begin
115
- @db = BlackStack::Deployer::DB::connect(
116
- BlackStack::PostgreSQL::connection_string # use the connection parameters setting in ./config.rb
117
- )
116
+ @db = BlackStack::PostgreSQL::connect
118
117
  l.logf "success".green
119
118
  rescue => e
120
119
  l.logf "failed".red
@@ -125,8 +124,8 @@ module BlackStack
125
124
  # This validation checks the connection to the correct database.
126
125
  begin
127
126
  l.logs "Verify database name... "
128
- s = @db["SELECT datname FROM pg_database"].first[:datname]
129
- raise 'Wrong database name' if s !~ /#{Regexp.escape(BlackStack::PostgreSQL::db_name)}/i
127
+ s = @db["SELECT datname FROM pg_database WHERE datname='#{BlackStack::PostgreSQL::db_name}'"].first
128
+ raise 'Wrong database name' if s.nil?
130
129
  l.logf "success".green
131
130
  rescue => e
132
131
  l.logf "failed".red
data/lib/blackstack-db.rb CHANGED
@@ -37,7 +37,7 @@ module BlackStack
37
37
  end
38
38
  end
39
39
 
40
- def self.test(l=nil)
40
+ def self.db_test(l=nil)
41
41
  if @@db_type == TYPE_POSTGRESQL
42
42
  return BlackStack::PostgreSQL.test(l)
43
43
  elsif @@db_type == TYPE_CRDB
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackstack-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi