data_migrater 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -5
- data/README.md +19 -11
- data/lib/data_migrater/version.rb +1 -1
- data/lib/generators/data_migrater/templates/config/initializers/data_migrater.rb +3 -1
- metadata +13 -43
- data/spec/support/local/dummy.csv +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b7c73921d794d4ac054ced44e82f1cfd1acee2
|
4
|
+
data.tar.gz: a312e89a86e7b63cc66c6b85c128f09412cba341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae54923bb1b86ec869ee77eb4fd80d6478a402733b0ecfc57538af94185edc3c6fd5ae386851f47686d658e684db80795145b8d3414cdc7140e11ef402f18f1a
|
7
|
+
data.tar.gz: c406477d1b34247758f73189afac855c9d043eaf64c7e7a100b970cb45f4f908c3f729bc734e6b3594ced23855b5248cc52ff474b8f4242cb804c22a9a5b9fc2
|
data/CHANGELOG.md
CHANGED
@@ -1,22 +1,49 @@
|
|
1
|
-
|
1
|
+
## v0.6.0
|
2
|
+
|
3
|
+
### News
|
4
|
+
|
5
|
+
- Adds `ENV['DATA_MIGRATER']` to controller the Data Migrater run;
|
6
|
+
- Bump Ruby to 2.4.3.
|
7
|
+
|
8
|
+
## v0.5.0
|
9
|
+
|
10
|
+
### Fixes
|
11
|
+
|
12
|
+
- Fix CSV and Logger variable conflict; [tmartinelli]
|
13
|
+
|
14
|
+
### News
|
15
|
+
|
16
|
+
- Adds S3 CSV file support;
|
17
|
+
|
18
|
+
## v0.4.0
|
19
|
+
|
20
|
+
### News
|
2
21
|
|
3
22
|
- Add Rails 5 support;
|
4
23
|
- Bump Ruby until 2.4.1.
|
5
24
|
|
6
|
-
|
25
|
+
## v0.3.0
|
26
|
+
|
27
|
+
### News
|
7
28
|
|
8
29
|
- Added support for CSV;
|
9
30
|
- Added options `dir` to specify the directory on Logger;
|
10
31
|
- Added options `file` to specify the Logger file name.
|
11
32
|
|
12
|
-
|
33
|
+
## v0.2.0
|
34
|
+
|
35
|
+
### News
|
13
36
|
|
14
37
|
- Added support for custom logger.
|
15
38
|
|
16
|
-
|
39
|
+
## v0.1.1
|
40
|
+
|
41
|
+
### Fixes
|
17
42
|
|
18
43
|
- Fixed `require` name on `bin` script.
|
19
44
|
|
20
|
-
|
45
|
+
## v0.1.0
|
46
|
+
|
47
|
+
### News
|
21
48
|
|
22
49
|
- Rails 4 support.
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ Next time your application run, all pending data migration will be executed.
|
|
37
37
|
|
38
38
|
You can send your log to a file including the module `DataMigrater::Logger`.
|
39
39
|
|
40
|
-
```
|
40
|
+
```ruby
|
41
41
|
class MyDataMigration
|
42
42
|
include DataMigrater::Logger
|
43
43
|
|
@@ -49,7 +49,7 @@ end
|
|
49
49
|
|
50
50
|
By default, the class name is used and the file goes to `log` folder. You can change it:
|
51
51
|
|
52
|
-
```
|
52
|
+
```ruby
|
53
53
|
class MyDataMigration
|
54
54
|
include DataMigrater::Logger
|
55
55
|
|
@@ -71,7 +71,7 @@ end
|
|
71
71
|
|
72
72
|
You can parse CSV on the fly using the module `DataMigrater::CSV`.
|
73
73
|
|
74
|
-
```
|
74
|
+
```ruby
|
75
75
|
class MyDataMigration
|
76
76
|
include DataMigrater::CSV
|
77
77
|
|
@@ -85,7 +85,7 @@ end
|
|
85
85
|
|
86
86
|
By default, the class name is used and the file is parsed from `db/data_migrate/support/csv` folder. You can change it:
|
87
87
|
|
88
|
-
```
|
88
|
+
```ruby
|
89
89
|
class MyDataMigration
|
90
90
|
include DataMigrater::CSV
|
91
91
|
|
@@ -101,7 +101,7 @@ end
|
|
101
101
|
|
102
102
|
You can process a batch of items using the `chunk_size`:
|
103
103
|
|
104
|
-
```
|
104
|
+
```ruby
|
105
105
|
class MyDataMigration
|
106
106
|
include DataMigrater::CSV
|
107
107
|
|
@@ -119,7 +119,7 @@ end
|
|
119
119
|
|
120
120
|
You can rename the keys inside the iterated data using the option `key_mapping`:
|
121
121
|
|
122
|
-
```
|
122
|
+
```ruby
|
123
123
|
class MyDataMigration
|
124
124
|
include DataMigrater::CSV
|
125
125
|
|
@@ -153,7 +153,7 @@ For more CSV options, check the project [Smarter CSV](https://github.com/tilo/sm
|
|
153
153
|
You can download your CSV directly from [Amazon S3](https://aws.amazon.com/s3) using the module `DataMigrater::CSV` with some configs.
|
154
154
|
You *must* keep the path as `:s3` to activate S3 feature.
|
155
155
|
|
156
|
-
```
|
156
|
+
```ruby
|
157
157
|
class MyDataMigration
|
158
158
|
include DataMigrater::CSV
|
159
159
|
|
@@ -167,7 +167,7 @@ end
|
|
167
167
|
|
168
168
|
By default, the class name is used as the file name in `underscore` style: `my_data_migration.csv`. You can change it:
|
169
169
|
|
170
|
-
```
|
170
|
+
```ruby
|
171
171
|
class MyDataMigration
|
172
172
|
include DataMigrater::CSV
|
173
173
|
|
@@ -181,7 +181,7 @@ end
|
|
181
181
|
|
182
182
|
By default, the bucket name is `data-migrater`, to change it, just declare the `bucket` options:
|
183
183
|
|
184
|
-
```
|
184
|
+
```ruby
|
185
185
|
class MyDataMigration
|
186
186
|
include DataMigrater::CSV
|
187
187
|
|
@@ -195,7 +195,7 @@ end
|
|
195
195
|
|
196
196
|
When file is downloaded, it is keeped in a temporary (`/tmp`) folder waiting to be parsed, using the options `tmp_dir` you change it:
|
197
197
|
|
198
|
-
```
|
198
|
+
```ruby
|
199
199
|
class MyDataMigration
|
200
200
|
include DataMigrater::CSV
|
201
201
|
|
@@ -212,7 +212,7 @@ end
|
|
212
212
|
By default, when you use the S3 feature, the envs `ACCESS_KEY_ID`, `REGION` and `SECRET_ACCESS_KEY` will be used.
|
213
213
|
If you do not want export it globally and need to pass it inside you class, just declare de `credentials` options:
|
214
214
|
|
215
|
-
```
|
215
|
+
```ruby
|
216
216
|
class MyDataMigration
|
217
217
|
include DataMigrater::CSV
|
218
218
|
|
@@ -235,3 +235,11 @@ end
|
|
235
235
|
- `file`: File name;
|
236
236
|
- `path`: `:s3` to indicate the S3 support;
|
237
237
|
- `tmp_dir`: Directory where CSV will be keeped after download.
|
238
|
+
|
239
|
+
#### Skip Run
|
240
|
+
|
241
|
+
You can use `ENV` to prevent Data Migrater to run. By default, `RAILS_ENV` as `test` already prevents it.
|
242
|
+
|
243
|
+
```bash
|
244
|
+
DATA_MIGRATER=false rails s
|
245
|
+
```
|
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.6.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: 2018-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -79,20 +79,6 @@ dependencies:
|
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '2.9'
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: guard-rspec
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
89
|
-
type: :development
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
96
82
|
- !ruby/object:Gem::Dependency
|
97
83
|
name: pry-byebug
|
98
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,20 +121,6 @@ dependencies:
|
|
135
121
|
- - ">="
|
136
122
|
- !ruby/object:Gem::Version
|
137
123
|
version: '0'
|
138
|
-
- !ruby/object:Gem::Dependency
|
139
|
-
name: rubocop
|
140
|
-
requirement: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
145
|
-
type: :development
|
146
|
-
prerelease: false
|
147
|
-
version_requirements: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - ">="
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '0'
|
152
124
|
- !ruby/object:Gem::Dependency
|
153
125
|
name: sqlite3
|
154
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,7 +176,6 @@ files:
|
|
204
176
|
- spec/support/common.rb
|
205
177
|
- spec/support/csv/dummy.csv
|
206
178
|
- spec/support/database_cleaner.rb
|
207
|
-
- spec/support/local/dummy.csv
|
208
179
|
- spec/support/migrate.rb
|
209
180
|
homepage: https://github.com/getninjas/data_migrater
|
210
181
|
licenses:
|
@@ -226,26 +197,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
197
|
version: '0'
|
227
198
|
requirements: []
|
228
199
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.6.
|
200
|
+
rubygems_version: 2.6.14
|
230
201
|
signing_key:
|
231
202
|
specification_version: 4
|
232
203
|
summary: A Data Migrator gem
|
233
204
|
test_files:
|
205
|
+
- spec/spec_helper.rb
|
234
206
|
- spec/collection_spec.rb
|
235
|
-
- spec/
|
236
|
-
- spec/
|
237
|
-
- spec/csv/csv_spec.rb
|
238
|
-
- spec/csv/options_spec.rb
|
239
|
-
- spec/data_migration_spec.rb
|
207
|
+
- spec/s3/initialize_spec.rb
|
208
|
+
- spec/s3/download_spec.rb
|
240
209
|
- spec/logger/data_logger_spec.rb
|
241
210
|
- spec/logger/logger_path_spec.rb
|
242
|
-
- spec/migrater_spec.rb
|
243
211
|
- spec/migration_spec.rb
|
244
|
-
- spec/
|
245
|
-
- spec/s3/initialize_spec.rb
|
246
|
-
- spec/spec_helper.rb
|
212
|
+
- spec/support/migrate.rb
|
247
213
|
- spec/support/common.rb
|
248
214
|
- spec/support/csv/dummy.csv
|
249
215
|
- spec/support/database_cleaner.rb
|
250
|
-
- spec/
|
251
|
-
- spec/
|
216
|
+
- spec/migrater_spec.rb
|
217
|
+
- spec/csv/csv_spec.rb
|
218
|
+
- spec/csv/options_spec.rb
|
219
|
+
- spec/csv/csv_path_spec.rb
|
220
|
+
- spec/csv/converters_spec.rb
|
221
|
+
- spec/data_migration_spec.rb
|
File without changes
|