slonik_migration 1.1.0 → 1.2.0
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 +5 -5
- data/.github/workflows/ci.yml +62 -0
- data/.gitignore +1 -4
- data/CHANGELOG.md +27 -0
- data/Gemfile +0 -1
- data/README.md +1 -1
- data/gemfiles/rails50.gemfile +0 -1
- data/gemfiles/rails51.gemfile +0 -1
- data/gemfiles/rails52.gemfile +1 -2
- data/gemfiles/rails60.gemfile +6 -0
- data/gemfiles/rails61.gemfile +5 -0
- data/gemfiles/rails70.gemfile +5 -0
- data/lib/slonik_migration/command.rb +5 -3
- data/lib/slonik_migration/config.rb +20 -3
- data/lib/slonik_migration/version.rb +1 -1
- metadata +8 -5
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 3caa52c10f2bf3e46027dbb8c0ff309e8dad46d9f5efc45694d31af21c2ba9f7
|
|
4
|
+
data.tar.gz: 5f430959a86ff8b3bcb71e911eba4115bb8e4f2acb69c03554a19e66cc9b19d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a06fdbe3f87891a5c456ad5da721a064044db89ab66059dcb1a0f4ce3c5a84601f785a3f37de2d8ac9a15e118b5855e8b1e71f550774c54f714497e7eb8f7674
|
|
7
|
+
data.tar.gz: 8a9ff1a400a121b4759251733892dd49bcecb21e1bcf0e47b4718c039743f6102879f51cb44c790c88038b99d6739440b1a4786d0595b4a10e6ccc92032451d7
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-20.04
|
|
8
|
+
services:
|
|
9
|
+
postgres:
|
|
10
|
+
image: postgres:9.5
|
|
11
|
+
env:
|
|
12
|
+
POSTGRES_USER: postgres
|
|
13
|
+
POSTGRES_PASSWORD: postgres
|
|
14
|
+
ports:
|
|
15
|
+
- 5432:5432
|
|
16
|
+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1]
|
|
21
|
+
gemfile: ['rails50', 'rails51', 'rails52', 'rails60', 'rails61', 'rails70']
|
|
22
|
+
exclude:
|
|
23
|
+
- ruby: 2.4
|
|
24
|
+
gemfile: rails60
|
|
25
|
+
- ruby: 2.4
|
|
26
|
+
gemfile: rails61
|
|
27
|
+
- ruby: 2.4
|
|
28
|
+
gemfile: rails70
|
|
29
|
+
- ruby: 2.5
|
|
30
|
+
gemfile: rails70
|
|
31
|
+
- ruby: 2.6
|
|
32
|
+
gemfile: rails70
|
|
33
|
+
- ruby: 3.0
|
|
34
|
+
gemfile: rails50
|
|
35
|
+
- ruby: 3.0
|
|
36
|
+
gemfile: rails51
|
|
37
|
+
- ruby: 3.0
|
|
38
|
+
gemfile: rails52
|
|
39
|
+
- ruby: 3.1
|
|
40
|
+
gemfile: rails50
|
|
41
|
+
- ruby: 3.1
|
|
42
|
+
gemfile: rails51
|
|
43
|
+
- ruby: 3.1
|
|
44
|
+
gemfile: rails52
|
|
45
|
+
|
|
46
|
+
name: ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}
|
|
47
|
+
|
|
48
|
+
env:
|
|
49
|
+
POSTGRES_USER: postgres
|
|
50
|
+
POSTGRES_PASSWORD: postgres
|
|
51
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v2
|
|
55
|
+
- uses: ruby/setup-ruby@v1
|
|
56
|
+
with:
|
|
57
|
+
ruby-version: ${{ matrix.ruby }}
|
|
58
|
+
bundler-cache: true
|
|
59
|
+
- name: Run test
|
|
60
|
+
run: |
|
|
61
|
+
bundle exec rspec spec/slonik_migration_spec.rb
|
|
62
|
+
bundle exec rspec spec/slonik_migration_task_spec.rb
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
* Support ruby 3.1.
|
|
6
|
+
* Drop support for ruby 2.3.
|
|
7
|
+
|
|
8
|
+
## 1.1.3
|
|
9
|
+
|
|
10
|
+
* Fix deprecation warning for ruby 2.7.
|
|
11
|
+
|
|
12
|
+
## 1.1.2
|
|
13
|
+
|
|
14
|
+
* Fix shell command escape.
|
|
15
|
+
|
|
16
|
+
## 1.1.1
|
|
17
|
+
|
|
18
|
+
* Check config file existence before read.
|
|
19
|
+
|
|
20
|
+
## 1.1.0
|
|
21
|
+
|
|
22
|
+
* Enhance db:migrate related tasks.
|
|
23
|
+
* Remove activesupport dependency.
|
|
24
|
+
|
|
25
|
+
## 1.0.0
|
|
26
|
+
|
|
27
|
+
* First release.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/gemfiles/rails50.gemfile
CHANGED
data/gemfiles/rails51.gemfile
CHANGED
data/gemfiles/rails52.gemfile
CHANGED
|
@@ -8,7 +8,7 @@ module SlonikMigration
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def execute(sql, options = {})
|
|
11
|
-
command = build(sql, options)
|
|
11
|
+
command = build(sql, **options)
|
|
12
12
|
puts command if ENV['VERBOSE']
|
|
13
13
|
system command
|
|
14
14
|
end
|
|
@@ -17,8 +17,10 @@ module SlonikMigration
|
|
|
17
17
|
|
|
18
18
|
def build(sql, target: nil, name: nil, owner: nil)
|
|
19
19
|
sql << %Q|; ALTER #{target} "#{name}" OWNER TO #{@config.owner}| if target && name && @config.owner
|
|
20
|
-
@config.command.
|
|
21
|
-
|
|
20
|
+
command = @config.command.dup
|
|
21
|
+
command.gsub!(%r{\$SQL}) { Shellwords.escape(sql) }
|
|
22
|
+
command.gsub!(%r{\$(\w+)}) { replace($1) }
|
|
23
|
+
command
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def replace(key)
|
|
@@ -4,13 +4,30 @@ module SlonikMigration
|
|
|
4
4
|
class Config
|
|
5
5
|
class << self
|
|
6
6
|
def load
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
OpenStruct.new(YAML.load(ERB.new(IO.read(file)).result)[env]).freeze
|
|
7
|
+
hash = load_file
|
|
8
|
+
OpenStruct.new(hash).freeze
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
private
|
|
13
12
|
|
|
13
|
+
def load_file
|
|
14
|
+
file = config_file
|
|
15
|
+
if File.exist?(file)
|
|
16
|
+
load_yaml(file).fetch(ENV['RAILS_ENV'] || 'development', {})
|
|
17
|
+
else
|
|
18
|
+
{}
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def load_yaml(file)
|
|
23
|
+
yaml = ERB.new(IO.read(file)).result
|
|
24
|
+
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("4.0")
|
|
25
|
+
YAML.load(yaml, aliases: true)
|
|
26
|
+
else
|
|
27
|
+
YAML.load(yaml)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
14
31
|
def config_file
|
|
15
32
|
if ENV['CONFIG_FILE']
|
|
16
33
|
ENV['CONFIG_FILE']
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slonik_migration
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yoshikazu Kaneta
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-01-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -101,9 +101,10 @@ executables: []
|
|
|
101
101
|
extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
|
103
103
|
files:
|
|
104
|
+
- ".github/workflows/ci.yml"
|
|
104
105
|
- ".gitignore"
|
|
105
106
|
- ".rspec"
|
|
106
|
-
-
|
|
107
|
+
- CHANGELOG.md
|
|
107
108
|
- Gemfile
|
|
108
109
|
- LICENSE
|
|
109
110
|
- README.md
|
|
@@ -111,6 +112,9 @@ files:
|
|
|
111
112
|
- gemfiles/rails50.gemfile
|
|
112
113
|
- gemfiles/rails51.gemfile
|
|
113
114
|
- gemfiles/rails52.gemfile
|
|
115
|
+
- gemfiles/rails60.gemfile
|
|
116
|
+
- gemfiles/rails61.gemfile
|
|
117
|
+
- gemfiles/rails70.gemfile
|
|
114
118
|
- lib/generators/slonik_migration/config_generator.rb
|
|
115
119
|
- lib/generators/slonik_migration/templates/slonik.yml
|
|
116
120
|
- lib/slonik_migration.rb
|
|
@@ -139,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
143
|
- !ruby/object:Gem::Version
|
|
140
144
|
version: '0'
|
|
141
145
|
requirements: []
|
|
142
|
-
|
|
143
|
-
rubygems_version: 2.5.2.2
|
|
146
|
+
rubygems_version: 3.1.2
|
|
144
147
|
signing_key:
|
|
145
148
|
specification_version: 4
|
|
146
149
|
summary: A rails migration gem for slony
|
data/.travis.yml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
rvm:
|
|
3
|
-
- 2.3
|
|
4
|
-
- 2.4
|
|
5
|
-
- 2.5
|
|
6
|
-
gemfile:
|
|
7
|
-
- gemfiles/rails50.gemfile
|
|
8
|
-
- gemfiles/rails51.gemfile
|
|
9
|
-
- gemfiles/rails52.gemfile
|
|
10
|
-
script:
|
|
11
|
-
- bundle exec rspec spec/slonik_migration_spec.rb
|
|
12
|
-
- bundle exec rspec spec/slonik_migration_task_spec.rb
|
|
13
|
-
|