pgtk 0.9.0 → 0.9.2

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: 62a786eefdf5750efb4fc874c1d56cabf81925652323df45cf305f7e7cd6db5f
4
- data.tar.gz: 9d03860055718f2793aa0805307679240d4bd7765e9ae3310dae849511327134
3
+ metadata.gz: 5b201e77d472e16891cd9b86c0c403431319b14f651be6f4f8891f1d4373b346
4
+ data.tar.gz: 764f9a225a0025b0c88457bb1875e1b11c8c972a487482547427dbee0af02748
5
5
  SHA512:
6
- metadata.gz: 4bea1c503932c6a77edb73272aaaaa015abc36d82fb6d96d06e9576237f42430f6871d22bdb096feccb0f91eebc01fa41ff5cf64b025bbd8b23ec254914b6fab
7
- data.tar.gz: 347c2d8171c8ce34390cad9b66c6753f4f40ff1a6f597cfece1284a690d9063951d6fbf9763307a880296161eeac75c3dcadeb54686711424bd87447747e617e
6
+ metadata.gz: 73e7225c5e2fb009a170df8bf047323e023751ec185c62aaa21479620020e1939f834b9358f417950aaf9bcc04469cdefd8c0e716401f66eaebf4fc56ae969b6
7
+ data.tar.gz: 20d725cf5522d2342b4ea894c4eb6b4177baa5906687a89e5d9b0ee827100bbd8594f6e9c2f996f0632717ccb6e4bccb370b861ab32d38b429791ebd2587b4fa
data/.rubocop.yml CHANGED
@@ -24,6 +24,6 @@ Metrics/ClassLength:
24
24
  Metrics/MethodLength:
25
25
  Max: 100
26
26
  Metrics/PerceivedComplexity:
27
- Max: 12
27
+ Max: 15
28
28
  Metrics/ParameterLists:
29
29
  Max: 6
data/.rultor.yml CHANGED
@@ -3,10 +3,10 @@ docker:
3
3
  assets:
4
4
  rubygems.yml: yegor256/home#assets/rubygems.yml
5
5
  install: |
6
- sudo chown -R "$(whoami)" /usr/local/rvm
7
6
  pdd -f /dev/null
8
- bundle install --no-color "--gemfile=$(pwd)/Gemfile"
7
+ bundle install --no-color
9
8
  release:
9
+ pre: false
10
10
  script: |-
11
11
  [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
12
12
  bundle exec rake
data/README.md CHANGED
@@ -50,13 +50,16 @@ Pgtk::PgsqlTask.new :pgsql do |t|
50
50
  end
51
51
  ```
52
52
 
53
- And this too:
53
+ And this too ([org.postgresql:postgresql](https://mvnrepository.com/artifact/org.postgresql/postgresql) and [org.liquibase:liquibase-maven-plugin](https://mvnrepository.com/artifact/org.liquibase/liquibase-maven-plugin) are used inside):
54
54
 
55
55
  ```ruby
56
56
  require 'pgtk/liquibase_task'
57
57
  Pgtk::LiquibaseTask.new liquibase: :pgsql do |t|
58
58
  t.master = 'liquibase/master.xml' # Master XML file path
59
59
  t.yaml = ['target/pgsql-config.yml', 'config.yml'] # YAML files with connection details
60
+ t.quiet = false # TRUE by default
61
+ t.postgresql_version = '42.7.0' # overwriting default version
62
+ t.liquibase_version = '3.2.2' # overwriting default version
60
63
  end
61
64
  ```
62
65
 
@@ -129,10 +132,12 @@ end
129
132
 
130
133
  Should work.
131
134
 
132
- Well, it works in [wts.zold.io](https://github.com/zold-io/wts.zold.io),
135
+ Well, it works in
136
+ [netbout.com](https://github.com/yegor256/netbout),
137
+ [wts.zold.io](https://github.com/zold-io/wts.zold.io),
133
138
  [mailanes.com](https://github.com/yegor256/mailanes), and
134
- [0rsk.com](https://github.com/yegor256/0rsk). They are all
135
- open source, you can see how they use `pgtk`.
139
+ [0rsk.com](https://github.com/yegor256/0rsk).
140
+ They are all open source, you can see how they use `pgtk`.
136
141
 
137
142
  ## How to contribute
138
143
 
@@ -54,17 +54,25 @@ class Pgtk::LiquibaseTask < Rake::TaskLib
54
54
  def run
55
55
  raise "Option 'master' is mandatory" unless @master
56
56
  raise "Option 'yaml' is mandatory" unless @yaml
57
- yml = YAML.load_file(
58
- if @yaml.is_a?(Array)
59
- @yaml.drop_while { |f| !File.exist?(f) }.first
60
- else
61
- @yaml
62
- end
63
- )
64
- raise "YAML at #{yaml} is missing 'pgsql' section" unless yml['pgsql']
65
- pom = File.expand_path(File.join(__dir__, '../../resources/pom.xml'))
66
- raise "Liquibase master is absent at #{@master}" unless File.exist?(@master)
57
+ yml = @yaml
58
+ unless yml.is_a?(Hash)
59
+ yml = YAML.load_file(
60
+ if @yaml.is_a?(Array)
61
+ @yaml.drop_while { |f| !File.exist?(f) }.first
62
+ else
63
+ @yaml
64
+ end
65
+ )
66
+ end
67
+ raise "YAML configuration is missing the 'pgsql' section" unless yml['pgsql']
67
68
  @master = File.expand_path(@master)
69
+ 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"
73
+ end
74
+ pom = File.expand_path(File.join(__dir__, '../../resources/pom.xml'))
75
+ old = @liquibase_version.match?(/^[1-3]\..+$/)
68
76
  Dir.chdir(File.dirname(@master)) do
69
77
  system(
70
78
  [
@@ -80,7 +88,9 @@ class Pgtk::LiquibaseTask < Rake::TaskLib
80
88
  '--define',
81
89
  "postgresql.version=#{@postgresql_version}",
82
90
  '--define',
83
- "liquibase.changeLogFile=#{@master}",
91
+ "liquibase.searchPath=#{File.dirname(@master)}",
92
+ '--define',
93
+ "liquibase.changeLogFile=#{old ? @master : File.basename(@master)}",
84
94
  '--define',
85
95
  "liquibase.url=#{Shellwords.escape(yml['pgsql']['url'])}",
86
96
  '--define',
data/lib/pgtk/version.rb CHANGED
@@ -28,5 +28,5 @@ require_relative '../pgtk'
28
28
  # License:: MIT
29
29
  module Pgtk
30
30
  # Current version of the library.
31
- VERSION = '0.9.0'
31
+ VERSION = '0.9.2'
32
32
  end
@@ -53,4 +53,36 @@ class TestLiquibaseTask < Minitest::Test
53
53
  Rake::Task['liquibase2'].invoke
54
54
  end
55
55
  end
56
+
57
+ def test_latest_version
58
+ Dir.mktmpdir 'test' do |dir|
59
+ Pgtk::PgsqlTask.new(:pgsql) do |t|
60
+ t.dir = File.join(dir, 'pgsql')
61
+ t.user = 'xxx'
62
+ t.password = 'xxx'
63
+ t.dbname = 'xxx'
64
+ t.yaml = File.join(dir, 'xxx.yml')
65
+ t.quiet = true
66
+ end
67
+ Rake::Task['pgsql'].invoke
68
+ Pgtk::LiquibaseTask.new(:liquibase) do |t|
69
+ t.master = File.join(__dir__, '../test-resources/master.xml')
70
+ t.yaml = File.join(dir, 'xxx.yml')
71
+ t.postgresql_version = '42.7.1'
72
+ t.liquibase_version = '4.25.1'
73
+ end
74
+ Rake::Task['liquibase'].invoke
75
+ end
76
+ end
77
+
78
+ def test_with_invalid_master_file
79
+ Pgtk::LiquibaseTask.new(:lb) do |t|
80
+ t.master = 'the-file-doesnt-exist.xml'
81
+ t.yaml = { 'pgsql' => {} }
82
+ end
83
+ ex = assert_raises do
84
+ Rake::Task['lb'].invoke
85
+ end
86
+ assert(ex.message.include?('the-file-doesnt-exist.xml'))
87
+ end
56
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-16 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace