blackstack-db 1.0.1 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blackstack-db/crdb.rb +8 -8
- data/lib/blackstack-db/postgresql.rb +7 -7
- data/lib/blackstack-db.rb +2 -0
- metadata +42 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf0c5cdf7acfb91f583f4b1c2acd296e8575a65fa26baafc5c91845ac1b84341
|
4
|
+
data.tar.gz: 26407def1ad08b2c2ac84cf6d50d71e44f4db60acb48a56ef935cdb967055960
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4665dfbbe3ebde9c392ce305ab052e3ab60fc4024fd095782fed2c8bc059b99d6a1022df48de52cf092cc18caed475d0d0a486dbd4471d8a4de5fc2ea383a3ed
|
7
|
+
data.tar.gz: da754c75b967522e65839c06376ec56da75eae72b6f7afcef694b456dbf0c466fda401b4d41be549e308bf81c99dd339cdc08182e1b765f6c55cd89b052a23cc
|
data/lib/blackstack-db/crdb.rb
CHANGED
@@ -115,7 +115,7 @@ module BlackStack
|
|
115
115
|
tz = 'America/Argentina/Buenos_Aires' #DB["SELECT current_setting('TIMEZONE') AS tz"].first[:tz]
|
116
116
|
DB["SELECT current_timestamp() at TIME ZONE '#{tz}' AS now"].first[:now]
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
# test the connection to the database.
|
120
120
|
# raise an exception if the connection fails, or if any incongruence is found.
|
121
121
|
def self.test(l=nil)
|
@@ -128,11 +128,11 @@ module BlackStack
|
|
128
128
|
l.logs "Testing connection... "
|
129
129
|
begin
|
130
130
|
@db = BlackStack::Deployer::DB::connect(
|
131
|
-
BlackStack::
|
131
|
+
BlackStack::CRDB::connection_string # use the connection parameters setting in ./config.rb
|
132
132
|
)
|
133
|
-
l.logf "success"
|
133
|
+
l.logf "success".green
|
134
134
|
rescue => e
|
135
|
-
l.logf "failed"
|
135
|
+
l.logf "failed".red
|
136
136
|
l.log e.message
|
137
137
|
end
|
138
138
|
|
@@ -141,13 +141,13 @@ module BlackStack
|
|
141
141
|
begin
|
142
142
|
l.logs "Verify database name... "
|
143
143
|
s = @db["SHOW DATABASES"].first.to_s
|
144
|
-
raise 'Wrong database name' if s !~ /:database_name=>\"#{Regexp.escape(BlackStack::
|
145
|
-
l.logf "success"
|
144
|
+
raise 'Wrong database name' if s !~ /:database_name=>\"#{Regexp.escape(BlackStack::CRDB::db_name)}\"/i
|
145
|
+
l.logf "success".green
|
146
146
|
rescue => e
|
147
|
-
l.logf "failed"
|
147
|
+
l.logf "failed".red
|
148
148
|
l.log e.message
|
149
149
|
end
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
end # module CRDB
|
153
153
|
end # module BlackStack
|
@@ -97,7 +97,7 @@ module BlackStack
|
|
97
97
|
tz = 'America/Argentina/Buenos_Aires' #DB["SELECT current_setting('TIMEZONE') AS tz"].first[:tz]
|
98
98
|
DB["SELECT (current_timestamp - interval '#{n} seconds') at TIME ZONE '#{tz}' AS now"].first[:now]
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
# test the connection to the database.
|
102
102
|
# raise an exception if the connection fails, or if any incongruence is found.
|
103
103
|
def self.test(l=nil)
|
@@ -112,9 +112,9 @@ module BlackStack
|
|
112
112
|
@db = BlackStack::Deployer::DB::connect(
|
113
113
|
BlackStack::PostgreSQL::connection_string # use the connection parameters setting in ./config.rb
|
114
114
|
)
|
115
|
-
l.logf "success"
|
115
|
+
l.logf "success".green
|
116
116
|
rescue => e
|
117
|
-
l.logf "failed"
|
117
|
+
l.logf "failed".red
|
118
118
|
l.log e.message
|
119
119
|
end
|
120
120
|
|
@@ -122,14 +122,14 @@ module BlackStack
|
|
122
122
|
# This validation checks the connection to the correct database.
|
123
123
|
begin
|
124
124
|
l.logs "Verify database name... "
|
125
|
-
s = @db["
|
125
|
+
s = @db["SELECT datname FROM pg_database"].first.to_s
|
126
126
|
raise 'Wrong database name' if s !~ /:database_name=>\"#{Regexp.escape(BlackStack::PostgreSQL::db_name)}\"/i
|
127
|
-
l.logf "success"
|
127
|
+
l.logf "success".green
|
128
128
|
rescue => e
|
129
|
-
l.logf "failed"
|
129
|
+
l.logf "failed".red
|
130
130
|
l.log e.message
|
131
131
|
end
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
end # module PostgreSQL
|
135
135
|
end
|
data/lib/blackstack-db.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackstack-db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.1
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.8.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.8.1
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.8.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: simple_cloud_logging
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.2.2
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.2.2
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.2.2
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.2.2
|
13
53
|
- !ruby/object:Gem::Dependency
|
14
54
|
name: sequel
|
15
55
|
requirement: !ruby/object:Gem::Requirement
|