seed-snapshot 0.5.2 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c087a187bb04a6153e749da89995c78fecc2b4882484142ebb45f59aace24e0
4
- data.tar.gz: 187f259b3f887ca6f37ffdea9f8a5c87878a12f482235248656ce6e925c3cd07
3
+ metadata.gz: 90069e1b7ee4498d79d7ae215173663cc360b0dda9ac7df7e4413e0faa177fc0
4
+ data.tar.gz: 632a91e5023b4c76fb35c8f04d0667d7569572283b589f04c1ce333c296535d9
5
5
  SHA512:
6
- metadata.gz: b2608a4f75c7e9820a19852e3fc2a8faf8ebc9ca2d4ae18762d385e124c1b38069640b9e007e1dd0f4506e0fd7ec66d55d9ab542a768d50c79f4d72bc7806e02
7
- data.tar.gz: 34f9e31f6d64e6c1ad59d19521adba47a1ce1bf9f125ff6031bd1e41ab4406320b364c72f87da47b552a4a87aed6562dec95320e346c2e846c5322b91d30f53f
6
+ metadata.gz: a02a6935e5df0947f2af651630ddb4bf9398e30dc9fba0a8386d1898109f71f67fd06ec7c6ae7bdc2ff11cf41c2c4e8c041efe1650248ddc7e4f00fcc1d8d941
7
+ data.tar.gz: f6f95d24fcec890787caa28fd255638fba2845508d0865ffcea9e0ca09335adea65abfe9d36b92016a3073b73d0dbb50ce43b3220ad3790020b17decbfc0d4c9
@@ -16,9 +16,11 @@ jobs:
16
16
  build:
17
17
  runs-on: ubuntu-latest
18
18
 
19
+ name: test (ruby:${{ matrix.ruby }}, ar:${{ matrix.ar }})
20
+
19
21
  services:
20
22
  mysql:
21
- image: mysql:5.7
23
+ image: mysql:8.0
22
24
  env:
23
25
  MYSQL_ALLOW_EMPTY_PASSWORD: yes
24
26
  MYSQL_DATABASE: 'activerecord_unittest'
@@ -27,27 +29,26 @@ jobs:
27
29
  options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
28
30
 
29
31
  strategy:
32
+ fail-fast: false
30
33
  matrix:
31
- ruby-version: ['2.6', '2.7']
32
- gemfile: ['Gemfile', 'gemfiles/ar_6_1.gemfile']
34
+ ruby: ['3.1', '3.2', '3.3']
35
+ ar: ['7.0', '7.1', '7.2', '8.0']
36
+ exclude:
37
+ - ruby: '3.1'
38
+ ar: '8.0'
33
39
 
34
40
  env:
35
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
41
+ BUNDLE_GEMFILE: gemfiles/ar_${{ matrix.ar }}.gemfile
36
42
 
37
43
  steps:
38
- - name: Checkout
39
- uses: actions/checkout@v3
40
-
41
- - name: Set up Ruby ${{ matrix.ruby-version }}
42
- uses: ruby/setup-ruby@v1
43
- with:
44
- ruby-version: ${{ matrix.ruby-version }}
45
- bundler-cache: true
46
-
47
- - name: Install dependencies
48
- run: |
49
- gem install bundler
50
- bundle install --jobs 3 --retry 3
51
-
52
- - name: Run tests
53
- run: bundle exec rake
44
+ - name: Checkout
45
+ uses: actions/checkout@v4
46
+
47
+ - name: Set up Ruby ${{ matrix.ruby }}
48
+ uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: ${{ matrix.ruby }}
51
+ bundler-cache: true
52
+
53
+ - name: Run tests
54
+ run: bundle exec rake
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # SeedSnapshot
1
+ # seed-snapshot
2
2
 
3
- [![Build Status](https://travis-ci.org/waka/seed-snapshot.png?branch=master)](https://travis-ci.org/waka/seed-snapshot)
4
-
5
- This library manage of dump/restore data by database.
3
+ The library that easily and quickly dumps and restores seed data.
6
4
 
7
5
  ## Installation
8
6
 
@@ -6,4 +6,4 @@ gem 'pry'
6
6
  gem 'minitest'
7
7
  gem 'erubis'
8
8
  gem 'mysql2', '>= 0.4.4', '< 0.6.0'
9
- gem 'activerecord', '~> 6.1.0'
9
+ gem 'activerecord', '~> 7.0.0'
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'bundler'
4
+ gem 'rake'
5
+ gem 'pry'
6
+ gem 'minitest'
7
+ gem 'erubis'
8
+ gem 'mysql2', '>= 0.4.4', '< 0.6.0'
9
+ gem 'activerecord', '~> 7.1.0'
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'bundler'
4
+ gem 'rake'
5
+ gem 'pry'
6
+ gem 'minitest'
7
+ gem 'erubis'
8
+ gem 'mysql2', '>= 0.4.4', '< 0.6.0'
9
+ gem 'activerecord', '~> 7.2.0'
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'bundler'
4
+ gem 'rake'
5
+ gem 'pry'
6
+ gem 'minitest'
7
+ gem 'erubis'
8
+ gem 'mysql2', '>= 0.4.4', '< 0.6.0'
9
+ gem 'activerecord', '~> 8.0.0'
@@ -41,7 +41,10 @@ module Seed
41
41
  private
42
42
 
43
43
  def get_all_versions
44
- if ::Gem::Version.new(::ActiveRecord::VERSION::STRING) >= ::Gem::Version.new('6.0')
44
+ if ::Gem::Version.new(::ActiveRecord::VERSION::STRING) >= ::Gem::Version.new('7.1')
45
+ migration_paths = ::ActiveRecord::Migrator.migrations_paths
46
+ ::ActiveRecord::MigrationContext.new(migration_paths).get_all_versions
47
+ elsif ::Gem::Version.new(::ActiveRecord::VERSION::STRING) >= ::Gem::Version.new('6.0')
45
48
  migration_paths = ::ActiveRecord::Migrator.migrations_paths
46
49
  ::ActiveRecord::MigrationContext.new(migration_paths, ::ActiveRecord::SchemaMigration).get_all_versions
47
50
  elsif ::Gem::Version.new(::ActiveRecord::VERSION::STRING) >= ::Gem::Version.new('5.2')
data/lib/seed/mysql.rb CHANGED
@@ -10,13 +10,13 @@ module Seed
10
10
  ''
11
11
  end
12
12
 
13
- cmd = "MYSQL_PWD=#{password} mysqldump -u #{username} -h #{host} #{database} -t #{allow_tables_option(tables)} #{ignore_tables_option(ignore_tables)} --no-tablespaces #{additional_options} > #{file_path}"
13
+ cmd = "MYSQL_PWD=#{password} mysqldump -u #{username} -h #{host} -P #{port} #{database} -t #{allow_tables_option(tables)} #{ignore_tables_option(ignore_tables)} --no-tablespaces #{additional_options} > #{file_path}"
14
14
  system cmd
15
15
  end
16
16
 
17
17
  def self.restore(file_path, username:, password:, host:, port:, database:)
18
18
  host = 'localhost' unless host
19
- cmd = "MYSQL_PWD=#{password} mysql -u #{username} -h #{host} #{database} < #{file_path}"
19
+ cmd = "MYSQL_PWD=#{password} mysql -u #{username} -h #{host} -P #{port} #{database} < #{file_path}"
20
20
  system cmd
21
21
  end
22
22
 
data/lib/seed/snapshot.rb CHANGED
@@ -68,11 +68,16 @@ module Seed
68
68
  end
69
69
  end
70
70
 
71
+ IGNORED_TABLES = [
72
+ 'ar_internal_metadata',
73
+ 'schema_migrations'
74
+ ].freeze
75
+
71
76
  def ignore_tables(classes)
72
77
  db = @configuration.database_options[:database]
73
78
 
74
79
  # mysqldump `--ignore-table` options require database name.
75
- tables(classes).push('schema_migrations').map {|t| "#{db}.#{t}" }
80
+ tables(classes).concat(IGNORED_TABLES).map {|t| "#{db}.#{t}" }
76
81
  end
77
82
  end
78
83
  end
@@ -1,3 +1,3 @@
1
1
  module SeedSnapshot
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -17,5 +17,5 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ['lib']
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
19
 
20
- spec.add_runtime_dependency 'activerecord', '>= 4.2'
20
+ spec.add_runtime_dependency 'activerecord', '>= 7.0'
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed-snapshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yo_waka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2024-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '7.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: '7.0'
27
27
  description: Easy dump/restore tool for ActiveRecord.
28
28
  email:
29
29
  - y.wakahara@gmail.com
@@ -39,7 +39,10 @@ files:
39
39
  - Rakefile
40
40
  - bin/console
41
41
  - bin/setup
42
- - gemfiles/ar_6_1.gemfile
42
+ - gemfiles/ar_7.0.gemfile
43
+ - gemfiles/ar_7.1.gemfile
44
+ - gemfiles/ar_7.2.gemfile
45
+ - gemfiles/ar_8.0.gemfile
43
46
  - lib/seed-snapshot.rb
44
47
  - lib/seed/configuration.rb
45
48
  - lib/seed/manifest.rb
@@ -67,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
70
  - !ruby/object:Gem::Version
68
71
  version: '0'
69
72
  requirements: []
70
- rubygems_version: 3.0.3
73
+ rubygems_version: 3.5.9
71
74
  signing_key:
72
75
  specification_version: 4
73
76
  summary: Easy dump/restore tool for ActiveRecord.