Skip to content

Commit abf07fe

Browse files
committedMay 24, 2024··
#75 url
1 parent c9a4b5d commit abf07fe

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed
 

‎.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Layout/EmptyLineAfterGuardClause:
3838
Metrics/AbcSize:
3939
Max: 50
4040
Metrics/CyclomaticComplexity:
41-
Max: 12
41+
Max: 15
4242
Metrics/ClassLength:
4343
Max: 120
4444
Metrics/MethodLength:

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The config.yml file should be in this format:
7373

7474
```yaml
7575
pgsql:
76-
url: postgres://user:password@host:port/dbname
76+
url: jdbc:postgresql://<host>:<port>/<dbname>?user=<user>
7777
host: ...
7878
port: ...
7979
dbname: ...

‎lib/pgtk/liquibase_task.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,17 @@ def run
6767
raise "YAML configuration is missing the 'pgsql' section" unless yml['pgsql']
6868
@master = File.expand_path(@master)
6969
unless File.exist?(@master)
70-
raise "Liquibase master is absent at '#{@master}'. \
71-
More about this file you can find in Liquibase documentation: \
72-
https://docs.liquibase.com/concepts/changelogs/xml-format.html"
70+
raise \
71+
"Liquibase master is absent at '#{@master}'. " \
72+
'More about this file you can find in Liquibase documentation: ' \
73+
'https://docs.liquibase.com/concepts/changelogs/xml-format.html'
7374
end
7475
pom = File.expand_path(File.join(__dir__, '../../resources/pom.xml'))
7576
old = @liquibase_version.match?(/^[1-3]\..+$/)
77+
url = yml['pgsql']['url']
78+
raise "The 'url' is not set in the config (YAML)" if url.nil?
79+
password = yml['pgsql']['password']
80+
raise "The 'password' is not set in the config (YAML)" if password.nil?
7681
Dir.chdir(File.dirname(@master)) do
7782
system(
7883
[
@@ -92,9 +97,9 @@ def run
9297
'--define',
9398
"liquibase.changeLogFile=#{old ? @master : File.basename(@master)}",
9499
'--define',
95-
"liquibase.url=#{Shellwords.escape(yml['pgsql']['url'])}",
100+
"liquibase.url=#{Shellwords.escape(url)}",
96101
'--define',
97-
"liquibase.password=#{Shellwords.escape(yml['pgsql']['password'])}",
102+
"liquibase.password=#{Shellwords.escape(password)}",
98103
'--define',
99104
"liquibase.logging=#{@quiet ? 'severe' : 'info'}",
100105
'2>&1'

0 commit comments

Comments
 (0)
Please sign in to comment.