data_migrater 0.6.0 → 0.7.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: 71b7c73921d794d4ac054ced44e82f1cfd1acee2
4
- data.tar.gz: a312e89a86e7b63cc66c6b85c128f09412cba341
2
+ SHA256:
3
+ metadata.gz: ad45bfd5bedd2d2b8a8bddd76afc4d10ce030c99d1507e5a57226c2d9be4a7bc
4
+ data.tar.gz: cce9a45c1224c2b9b69e0238ec7f39881b98ea96632f4a98aae11591b90c5158
5
5
  SHA512:
6
- metadata.gz: ae54923bb1b86ec869ee77eb4fd80d6478a402733b0ecfc57538af94185edc3c6fd5ae386851f47686d658e684db80795145b8d3414cdc7140e11ef402f18f1a
7
- data.tar.gz: c406477d1b34247758f73189afac855c9d043eaf64c7e7a100b970cb45f4f908c3f729bc734e6b3594ced23855b5248cc52ff474b8f4242cb804c22a9a5b9fc2
6
+ metadata.gz: 450dd08d38c0122a9b50ebc5d620d497e548a6f15e683887dab95a763a04006b4246ab5b697d512c3dbcbd8f694b7bd61d4a80efb54950aec3e2b99489e9e785
7
+ data.tar.gz: ce1181a6c82f55ac2748072d566793e3fb8f0f22df57c6942719fe991bfa346f07bb4f37cf9c27a83d0b96c71a933ac80d973d0a9a803fcbdc5c4d75fc422c05
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v0.7.0
2
+
3
+ ### News
4
+
5
+ - Bump aws-sdk dependency to v3
6
+ - Bump Ruby version compatibilities
7
+ - Rails 5.2 compatibility
8
+
1
9
  ## v0.6.0
2
10
 
3
11
  ### News
@@ -7,34 +7,17 @@ module DataMigrater
7
7
  end
8
8
 
9
9
  def migrate
10
- ActiveRecord::Base.transaction do
11
- if execute?
12
- data_migrations.each(&:execute)
13
- else
14
- pending_migrations.each do |migration|
15
- puts " #{migration.version} #{migration.name}"
16
- end
17
- end
18
- end
19
- end
10
+ return unless DataMigration.table_exists?
20
11
 
21
- private
22
-
23
- def execute?
24
- return false if pending_migrations.any?
25
-
26
- DataMigration.table_exists? && data_migrations.any?
27
- end
12
+ begin
13
+ ActiveRecord::Migration.check_pending!
28
14
 
29
- def data_migrations
30
- @data_migrations ||= @collection.migrations
31
- end
32
-
33
- def pending_migrations
34
- migrations_paths = ActiveRecord::Migrator.migrations_paths
35
- migrator = ActiveRecord::Migrator.open migrations_paths
36
-
37
- @pending_migrations ||= migrator.pending_migrations
15
+ ActiveRecord::Base.transaction do
16
+ @collection.migrations.each(&:execute)
17
+ end
18
+ rescue ActiveRecord::PendingMigrationError
19
+ puts "DataMigrater stopped. Pending migrations need to executed!"
20
+ end
38
21
  end
39
22
  end
40
23
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DataMigrater
4
4
  class S3
5
- require 'aws-sdk'
5
+ require 'aws-sdk-s3'
6
6
 
7
7
  def initialize(bucket:, credentials: {}, file:, tmp_dir:)
8
8
  @bucket = bucket
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DataMigrater
4
- VERSION = '0.6.0'
4
+ VERSION = '0.7.0'
5
5
  end
@@ -102,10 +102,6 @@ describe DataMigrater::Migrator do
102
102
  end
103
103
 
104
104
  context 'executed' do
105
- before do
106
- allow_any_instance_of(ActiveRecord::Migrator).to receive(:pending_migrations) { [] }
107
- end
108
-
109
105
  it 'runs the data migrations' do
110
106
  expect(data_migration).to receive :execute
111
107
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_migrater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-31 00:00:00.000000000 Z
12
+ date: 2019-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -31,6 +31,20 @@ dependencies:
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '6'
34
+ - !ruby/object:Gem::Dependency
35
+ name: aws-sdk-s3
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1'
34
48
  - !ruby/object:Gem::Dependency
35
49
  name: railties
36
50
  requirement: !ruby/object:Gem::Requirement
@@ -65,20 +79,6 @@ dependencies:
65
79
  - - "~>"
66
80
  - !ruby/object:Gem::Version
67
81
  version: '1.1'
68
- - !ruby/object:Gem::Dependency
69
- name: aws-sdk
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '2.9'
75
- type: :runtime
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '2.9'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: pry-byebug
84
84
  requirement: !ruby/object:Gem::Requirement
@@ -196,26 +196,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  requirements: []
199
- rubyforge_project:
200
- rubygems_version: 2.6.14
199
+ rubygems_version: 3.0.3
201
200
  signing_key:
202
201
  specification_version: 4
203
202
  summary: A Data Migrator gem
204
203
  test_files:
205
- - spec/spec_helper.rb
206
- - spec/collection_spec.rb
207
- - spec/s3/initialize_spec.rb
208
- - spec/s3/download_spec.rb
209
204
  - spec/logger/data_logger_spec.rb
210
205
  - spec/logger/logger_path_spec.rb
211
- - spec/migration_spec.rb
212
- - spec/support/migrate.rb
206
+ - spec/collection_spec.rb
207
+ - spec/support/database_cleaner.rb
213
208
  - spec/support/common.rb
209
+ - spec/support/migrate.rb
214
210
  - spec/support/csv/dummy.csv
215
- - spec/support/database_cleaner.rb
211
+ - spec/spec_helper.rb
216
212
  - spec/migrater_spec.rb
213
+ - spec/s3/download_spec.rb
214
+ - spec/s3/initialize_spec.rb
215
+ - spec/data_migration_spec.rb
216
+ - spec/migration_spec.rb
217
217
  - spec/csv/csv_spec.rb
218
218
  - spec/csv/options_spec.rb
219
219
  - spec/csv/csv_path_spec.rb
220
220
  - spec/csv/converters_spec.rb
221
- - spec/data_migration_spec.rb