csv-importer 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/CHANGELOG.md +11 -0
- data/README.md +6 -6
- data/lib/csv_importer.rb +2 -2
- data/lib/csv_importer/row.rb +1 -0
- data/lib/csv_importer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfff4468934d3d7fd8e13b81d618bd2691f3fac7
|
4
|
+
data.tar.gz: f8980b3710130e74d400c9f649da525da7d46145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd7068f3d2a32f40b58234fc0805883891e5212aeed10dab1c42c1b3198475080e18a88107fd095d02cda7002740b05c1d1436ec0a6e034899d9c0b0a12c93dc
|
7
|
+
data.tar.gz: aa78cf760944b7db3204e746b480e01a161ab4a834ddb79aae65a4d33d7b41f8b03a34d68e898add41a7b209d033c3613b06f264fdfcbb380d092ce69e89ea7d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [0.4.0] - 2017-08-10
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
* Rows are now aware of their line number.
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
import.report.invalid_rows.map { |row| [row.line_number, row.model.email, row.errors] }
|
13
|
+
# => [ [2, "INVALID_EMAIL", { "email" => "is invalid" } ] ]
|
14
|
+
```
|
15
|
+
|
5
16
|
## [0.3.2] - 2017-01-06
|
6
17
|
|
7
18
|
### Fixed
|
data/README.md
CHANGED
@@ -7,11 +7,11 @@ CSVImporter aims to handle validations, column mapping, import
|
|
7
7
|
and reporting.
|
8
8
|
|
9
9
|
[![Build
|
10
|
-
Status](https://travis-ci.org/
|
10
|
+
Status](https://travis-ci.org/pcreux/csv-importer.svg)](https://travis-ci.org/pcreux/csv-importer)
|
11
11
|
[![Code
|
12
|
-
Climate](https://codeclimate.com/github/
|
12
|
+
Climate](https://codeclimate.com/github/pcreux/csv-importer/badges/gpa.svg)](https://codeclimate.com/github/pcreux/csv-importer)
|
13
13
|
[![Test
|
14
|
-
Coverage](https://codeclimate.com/github/
|
14
|
+
Coverage](https://codeclimate.com/github/pcreux/csv-importer/badges/coverage.svg)](https://codeclimate.com/github/pcreux/csv-importer/coverage)
|
15
15
|
[![Gem
|
16
16
|
Version](https://badge.fury.io/rb/csv-importer.svg)](http://badge.fury.io/rb/csv-importer)
|
17
17
|
|
@@ -353,8 +353,8 @@ You can get your hands dirty and fetch the errored rows and the
|
|
353
353
|
associated error message:
|
354
354
|
|
355
355
|
```ruby
|
356
|
-
import.report.invalid_rows.map { |row| [row.model.email, row.errors] }
|
357
|
-
# => [ [ "INVALID_EMAIL", { "email" => "is invalid" } ] ]
|
356
|
+
import.report.invalid_rows.map { |row| [row.line_number, row.model.email, row.errors] }
|
357
|
+
# => [ [2, "INVALID_EMAIL", { "email" => "is invalid" } ] ]
|
358
358
|
```
|
359
359
|
|
360
360
|
We do our best to map the errors back to the original column name. So
|
@@ -415,7 +415,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
415
415
|
|
416
416
|
## Contributing
|
417
417
|
|
418
|
-
1. Fork it ( https://github.com/
|
418
|
+
1. Fork it ( https://github.com/pcreux/csv-importer/fork )
|
419
419
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
420
420
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
421
421
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/csv_importer.rb
CHANGED
@@ -69,8 +69,8 @@ module CSVImporter
|
|
69
69
|
|
70
70
|
# Initialize and return the `Row`s for the current CSV file
|
71
71
|
def rows
|
72
|
-
csv.rows.map do |row_array|
|
73
|
-
Row.new(header: header, row_array: row_array, model_klass: config.model,
|
72
|
+
csv.rows.map.with_index(2) do |row_array, line_number|
|
73
|
+
Row.new(header: header, line_number: line_number, row_array: row_array, model_klass: config.model,
|
74
74
|
identifiers: config.identifiers, after_build_blocks: config.after_build_blocks)
|
75
75
|
end
|
76
76
|
end
|
data/lib/csv_importer/row.rb
CHANGED
data/lib/csv_importer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv-importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philippe Creux
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|