slonik_migration 1.1.0 → 1.2.0

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
- SHA1:
3
- metadata.gz: 0a9bac5e2a100f82b528a7e361791da8861df69c
4
- data.tar.gz: 4f0d8060ee2efc0e090468e47269dbc1fd83667a
2
+ SHA256:
3
+ metadata.gz: 3caa52c10f2bf3e46027dbb8c0ff309e8dad46d9f5efc45694d31af21c2ba9f7
4
+ data.tar.gz: 5f430959a86ff8b3bcb71e911eba4115bb8e4f2acb69c03554a19e66cc9b19d6
5
5
  SHA512:
6
- metadata.gz: 96882aac71029ddd3c17ef983b3701955d0bb6eee73ed333d127b4e1c51a29ddfbcea5638855daa71536a4b07aad32b7b641ff52de2ae485bc9388ba41488412
7
- data.tar.gz: 71141e836529b0059b2434619ecd1aa4efb9778f4e46f7c0ec055006b15f391bdde0fa6a067b5b214ffc34dabb3f523ef01fc303aff85061c35b9db6c874bae9
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
@@ -1,12 +1,9 @@
1
1
  .bundle/
2
- .yardoc
3
2
  .project
4
3
  Gemfile.lock
5
- _yardoc/
6
4
  coverage/
7
- doc/
5
+ gemfiles/*.lock
8
6
  pkg/
9
- spec/reports/
10
7
  spec/dummy/db/schema.rb
11
8
  spec/dummy/log/*.log
12
9
  spec/dummy/tmp/*
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
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in slonik_migration.gemspec
4
3
  gemspec
data/README.md CHANGED
@@ -4,7 +4,7 @@ A rails migration gem for slony using `slonik_execute_script` command.
4
4
 
5
5
  ## Dependencies
6
6
 
7
- * ruby 2.3+
7
+ * ruby 2.4+
8
8
  * activerecord 5.0+
9
9
  * slony 2.2+
10
10
 
@@ -3,5 +3,4 @@ source 'https://rubygems.org'
3
3
  gem "rails", "~> 5.0.0"
4
4
  gem "pg", "~> 0.18"
5
5
 
6
- # Specify your gem's dependencies in params_keeper_rails.gemspec
7
6
  gemspec path: "../"
@@ -3,5 +3,4 @@ source 'https://rubygems.org'
3
3
  gem "rails", "~> 5.1.0"
4
4
  gem "pg", "~> 0.18"
5
5
 
6
- # Specify your gem's dependencies in params_keeper_rails.gemspec
7
6
  gemspec path: "../"
@@ -1,6 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "rails", "~> 5.2.0.rc1"
3
+ gem "rails", "~> 5.2.0"
4
4
 
5
- # Specify your gem's dependencies in params_keeper_rails.gemspec
6
5
  gemspec path: "../"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 6.0.0"
4
+ gem "psych", "~> 3.3.0"
5
+
6
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 6.1.0"
4
+
5
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 7.0.1"
4
+
5
+ gemspec path: "../"
@@ -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.gsub(%r{\$SQL}, Shellwords.escape(sql))
21
- .gsub(%r{\$(\w+)}) { replace($1) }
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
- file = config_file
8
- env = ENV['RAILS_ENV'] || 'development'
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']
@@ -1,3 +1,3 @@
1
1
  module SlonikMigration
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
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.1.0
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: 2018-03-09 00:00:00.000000000 Z
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
- - ".travis.yml"
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
- rubyforge_project:
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
-