active_admin_import 4.2.0 → 5.0.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
2
  SHA256:
3
- metadata.gz: de2d35b497f1bd3dc0ec315c01b54b414f33d17ae00ec1dd696dabda7f457d23
4
- data.tar.gz: f384a6d7ee62080902c06ce1bc37dbc184313c7150af13af7f45d732da499cd5
3
+ metadata.gz: ba919b0429b44accf46af4dcdc52ef1ddcf691a446cddf1bc434b38982c6b0c2
4
+ data.tar.gz: b54c35f3d81a3b170a8a27b657f1c0b8137c49716fab6b1ba0717845f1b15649
5
5
  SHA512:
6
- metadata.gz: 4918c47b9cd9bfdc0d2e12733f00c7608999162e0d041b9c6414ca63aa3660dafb87e01d10eb52ffb106895c0cda44f1e89231c546be72bf94707253e71bb5da
7
- data.tar.gz: 29d229496fc5e75e3d74b7b2f9312dde645dd29c44833d7c6315b01109410364262e9c90e16f49117b2fffe503077006bf602074b937963aa78b5cd4d4b90ac0
6
+ metadata.gz: d949ae03350ff838eb97856d4c34afb610708dde36bee45d32b56de0bd1bf48a5e0adb4e67aaa549e1e35393cca146be755258fbc213422ab9a91b299769688e
7
+ data.tar.gz: 4ddc52d5273f06837f54a3806e56ebdad52c2a60581aa452b196de25885697348b13af8f56e27716ed2234b3771072f3f93e365035cdfc02b1539e7aa8385fb1
data/.travis.yml CHANGED
@@ -1,9 +1,14 @@
1
1
  script: bundle exec rspec spec
2
2
  env:
3
3
  matrix:
4
- - RAILS=5.1.6.2
5
- - RAILS=5.2.2.1
4
+ - RAILS=5.2.6
5
+ - RAILS=6.0.4
6
+ - RAILS=6.1.4
6
7
  rvm:
7
- - 2.3.8
8
- - 2.4.5
9
- - 2.5.5
8
+ - 2.6.7
9
+ - 2.7.4
10
+ - 3.0.2
11
+ jobs:
12
+ exclude:
13
+ - rvm: 3.0.1
14
+ env: RAILS=5.2.6
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  # Changelog
2
+ ## [5.0.0] - 2021-11-16
3
+ - Ruby 3 compatibility added #190 | @clinejj
4
+ - Support for a non UTF-8 file when zip uploading #185| @naokirin
5
+ - Rails 6 supported #183 | @pnghai
6
+ - Drop ruby 2.4 support #192 | @Fivell
7
+
8
+
2
9
  ## [4.2.0] - 2020-02-05
3
10
  - generic exception for import added #175 | @linqueta
4
11
 
data/Gemfile CHANGED
@@ -6,12 +6,13 @@ gemspec
6
6
 
7
7
 
8
8
  group :test do
9
- default_rails_version = "~> 5.1"
9
+ default_rails_version = "~> 5.2.4"
10
10
  rails_version = ENV['RAILS'] || default_rails_version
11
+ gem 'sassc-rails'
11
12
  gem 'rails', rails_version
12
13
  gem 'rspec-rails'
13
14
  gem 'coveralls', require: false # Test coverage website. Go to https://coveralls.io
14
- gem 'sqlite3',"~> 1.3.6"
15
+ gem "sqlite3", "~> 1.4.0"
15
16
  gem 'launchy'
16
17
  gem 'database_cleaner'
17
18
  gem 'capybara'
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ['lib']
17
17
  gem.version = ActiveAdminImport::VERSION
18
18
  gem.add_runtime_dependency 'activerecord-import', '>= 0.27'
19
- gem.add_runtime_dependency 'rchardet', '~> 1.6'
20
- gem.add_runtime_dependency 'rubyzip', '~> 1.2'
21
- gem.add_dependency 'activeadmin', '>= 1.0.0.pre2'
19
+ gem.add_runtime_dependency 'rchardet', '>= 1.6'
20
+ gem.add_runtime_dependency 'rubyzip', '>= 1.2'
21
+ gem.add_dependency 'activeadmin', '>= 1.0.0'
22
22
  end
@@ -37,7 +37,7 @@ module ActiveAdminImport
37
37
  end
38
38
 
39
39
  def cycle(lines)
40
- @csv_lines = CSV.parse(lines.join, @csv_options)
40
+ @csv_lines = CSV.parse(lines.join, **@csv_options)
41
41
  import_result.add(batch_import, lines.count)
42
42
  end
43
43
 
@@ -115,7 +115,7 @@ module ActiveAdminImport
115
115
  batch_size = options[:batch_size].to_i
116
116
  File.open(file.path) do |f|
117
117
  # capture headers if not exist
118
- prepare_headers { CSV.parse(f.readline, @csv_options).first }
118
+ prepare_headers { CSV.parse(f.readline, **@csv_options).first }
119
119
  f.each_line do |line|
120
120
  lines << line if line.present?
121
121
  if lines.size == batch_size || f.eof?
@@ -110,7 +110,7 @@ module ActiveAdminImport
110
110
 
111
111
  def unzip_file
112
112
  Zip::File.open(file_path) do |zip_file|
113
- self.file = Tempfile.new(CONST::TMP_FILE)
113
+ self.file = Tempfile.new(CONST::TMP_FILE, binmode: true)
114
114
  data = zip_file.entries.select(&:file?).first.get_input_stream.read
115
115
  file << data
116
116
  file.close
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveAdminImport
4
- VERSION = '4.2.0'
4
+ VERSION = '5.0.0'
5
5
  end
data/spec/import_spec.rb CHANGED
@@ -371,6 +371,20 @@ describe 'import', type: :feature do
371
371
  end
372
372
  end
373
373
  end
374
+
375
+ context 'when zipped with Win1251 file' do
376
+ let(:options) do
377
+ attributes = { force_encoding: :auto }
378
+ { template_object: ActiveAdminImport::Model.new(attributes) }
379
+ end
380
+ it 'should import file' do
381
+ with_zipped_csv(:authors_win1251_win_endline) do
382
+ upload_file!(:authors_win1251_win_endline, :zip)
383
+ expect(page).to have_content 'Successfully imported 2 authors'
384
+ expect(Author.count).to eq(2)
385
+ end
386
+ end
387
+ end
374
388
  end
375
389
 
376
390
  context 'with different header attribute names' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Fedoronchuk
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-06 00:00:00.000000000 Z
11
+ date: 2021-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-import
@@ -28,28 +28,28 @@ dependencies:
28
28
  name: rchardet
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.6'
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
40
  version: '1.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubyzip
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.2'
55
55
  - !ruby/object:Gem::Dependency
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0.pre2
61
+ version: 1.0.0
62
62
  type: :runtime
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: 1.0.0.pre2
68
+ version: 1.0.0
69
69
  description: The most efficient way to import for Active Admin
70
70
  email:
71
71
  - fedoronchuk@gmail.com
@@ -134,7 +134,7 @@ homepage: http://github.com/Fivell/active_admin_import
134
134
  licenses:
135
135
  - MIT
136
136
  metadata: {}
137
- post_install_message:
137
+ post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths:
140
140
  - lib
@@ -149,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.0.6
153
- signing_key:
152
+ rubygems_version: 3.1.6
153
+ signing_key:
154
154
  specification_version: 4
155
155
  summary: ActiveAdmin import based on activerecord-import gem.
156
156
  test_files: