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 +5 -5
- data/CHANGELOG.md +8 -0
- data/lib/data_migrater/migrator.rb +9 -26
- data/lib/data_migrater/s3.rb +1 -1
- data/lib/data_migrater/version.rb +1 -1
- data/spec/migrater_spec.rb +0 -4
- metadata +25 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad45bfd5bedd2d2b8a8bddd76afc4d10ce030c99d1507e5a57226c2d9be4a7bc
|
4
|
+
data.tar.gz: cce9a45c1224c2b9b69e0238ec7f39881b98ea96632f4a98aae11591b90c5158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 450dd08d38c0122a9b50ebc5d620d497e548a6f15e683887dab95a763a04006b4246ab5b697d512c3dbcbd8f694b7bd61d4a80efb54950aec3e2b99489e9e785
|
7
|
+
data.tar.gz: ce1181a6c82f55ac2748072d566793e3fb8f0f22df57c6942719fe991bfa346f07bb4f37cf9c27a83d0b96c71a933ac80d973d0a9a803fcbdc5c4d75fc422c05
|
data/CHANGELOG.md
CHANGED
@@ -7,34 +7,17 @@ module DataMigrater
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def migrate
|
10
|
-
|
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
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
data/lib/data_migrater/s3.rb
CHANGED
data/spec/migrater_spec.rb
CHANGED
@@ -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.
|
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:
|
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
|
-
|
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/
|
212
|
-
- spec/support/
|
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/
|
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
|