activerecord_csv_importer 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +27 -0
- data/README.md +3 -2
- data/activerecord_csv_importer.gemspec +6 -8
- data/lib/activerecord_csv_importer/column_definition.rb +1 -1
- data/lib/activerecord_csv_importer/version.rb +1 -1
- metadata +28 -57
- data/.rubocop.yml +0 -20
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e020134d19e90aabb08259285326c6a64bce0414a4aba8315beb57e09ceee841
|
4
|
+
data.tar.gz: 860c16f28c3ea187cc809e6faf6fa1a1f1d224204d8c958ab314f27bdbed6cd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00227a9aae5171427820b60077a329040da91b52b7fc2402f918136901923f132dd93617f59794c79da406331bb1a1a6fe50c91c6a9372bdc492ffd113b71a9d
|
7
|
+
data.tar.gz: 6e92890b6daded437ab77823223b4c69d8c683fe1f73c37eaaaae40fc847f7941f637d78364dfe10f0357a475fa982bde8bad0c13e7fc293fd32fb386e6dd5e3
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: master
|
6
|
+
pull_request:
|
7
|
+
branches: master
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: ['2.6', '2.7', '3.0', '3.1']
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Install dependencies
|
25
|
+
run: bundle install
|
26
|
+
- name: Run tests
|
27
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# ActiveRecordCSVImporter
|
2
2
|
|
3
|
+
[![Ruby](https://github.com/desheikh/activerecord_csv_importer/actions/workflows/ruby.yml/badge.svg)](https://github.com/desheikh/activerecord_csv_importer/actions/workflows/ruby.yml)
|
4
|
+
|
3
5
|
ActiveRecordCSVImporter is a modified version CSVImporter, which uses activerecord-import to speed up processing.
|
4
6
|
|
5
7
|
The key difference with CSVImporter is the removal of callback support, since that is incompatible with bulk inserts. Additional config options are available instead to deal with batching and index conflicts.
|
@@ -317,7 +319,7 @@ import.run!
|
|
317
319
|
You can handle exotic encodings with the `encoding` option.
|
318
320
|
|
319
321
|
```ruby
|
320
|
-
ImportUserCSV.new(content: "メール,氏名".encode('SJIS'), encoding: '
|
322
|
+
ImportUserCSV.new(content: "メール,氏名".encode('SJIS'), encoding: 'UTF-8')
|
321
323
|
```
|
322
324
|
|
323
325
|
## TODO
|
@@ -337,4 +339,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/deshei
|
|
337
339
|
## License
|
338
340
|
|
339
341
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
340
|
-
|
@@ -20,15 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency 'virtus'
|
24
|
-
spec.add_dependency 'activerecord-import'
|
23
|
+
spec.add_dependency 'virtus'
|
24
|
+
spec.add_dependency 'activerecord-import'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler'
|
27
|
-
spec.add_development_dependency 'rake'
|
26
|
+
spec.add_development_dependency 'bundler'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
28
|
|
29
|
-
spec.add_development_dependency 'rspec'
|
30
|
-
spec.add_development_dependency 'rubocop', '~> 0.63'
|
29
|
+
spec.add_development_dependency 'rspec'
|
31
30
|
|
32
|
-
spec.add_development_dependency 'guard-rspec'
|
33
|
-
spec.add_development_dependency 'guard-rubocop', '~> 1.2'
|
31
|
+
spec.add_development_dependency 'guard-rspec'
|
34
32
|
end
|
@@ -46,7 +46,7 @@ module ActiveRecordCSVImporter
|
|
46
46
|
def match?(column_name, search_query = (as || name))
|
47
47
|
return false if column_name.nil?
|
48
48
|
|
49
|
-
column_name.gsub
|
49
|
+
column_name = column_name.gsub("\xEF\xBB\xBF", '') #strip BOM
|
50
50
|
|
51
51
|
downcased_column_name = column_name.downcase
|
52
52
|
underscored_column_name = downcased_column_name.gsub(/\s+/, '_')
|
metadata
CHANGED
@@ -1,127 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_csv_importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zulfiqar Ali
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '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: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord-import
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.63'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.63'
|
82
|
+
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: guard-rspec
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '4.7'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '4.7'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard-rubocop
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
87
|
+
- - ">="
|
116
88
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
89
|
+
version: '0'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
|
-
- - "
|
94
|
+
- - ">="
|
123
95
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
96
|
+
version: '0'
|
125
97
|
description:
|
126
98
|
email:
|
127
99
|
- desheikh@gmail.com
|
@@ -129,10 +101,9 @@ executables: []
|
|
129
101
|
extensions: []
|
130
102
|
extra_rdoc_files: []
|
131
103
|
files:
|
104
|
+
- ".github/workflows/ruby.yml"
|
132
105
|
- ".gitignore"
|
133
106
|
- ".rspec"
|
134
|
-
- ".rubocop.yml"
|
135
|
-
- ".travis.yml"
|
136
107
|
- Gemfile
|
137
108
|
- Guardfile
|
138
109
|
- LICENSE.txt
|
@@ -172,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
143
|
- !ruby/object:Gem::Version
|
173
144
|
version: '0'
|
174
145
|
requirements: []
|
175
|
-
rubygems_version: 3.
|
146
|
+
rubygems_version: 3.1.6
|
176
147
|
signing_key:
|
177
148
|
specification_version: 4
|
178
149
|
summary: A modified version of CSV Import using activerecord-import
|
data/.rubocop.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Style/Documentation:
|
2
|
-
Enabled: false
|
3
|
-
|
4
|
-
Metrics/LineLength:
|
5
|
-
Max: 100
|
6
|
-
|
7
|
-
Metrics/MethodLength:
|
8
|
-
Max: 15
|
9
|
-
|
10
|
-
Style/BlockDelimiters:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
Style/AsciiComments:
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Style/StructInheritance:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Lint/HandleExceptions:
|
20
|
-
Enabled: false
|