dwc-archive 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/dwc-archive/ingester.rb +2 -1
- data/spec/lib/dwc-archive_spec.rb +3 -3
- metadata +10 -24
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "dmozzherin at gmail dot com"
|
11
11
|
gem.homepage = "http://github.com/dimus/dwc-archive"
|
12
12
|
gem.authors = ["Dmitry Mozzherin"]
|
13
|
-
gem.add_dependency "fastercsv" if RUBY_VERSION.match /^1.8/
|
13
|
+
#gem.add_dependency "fastercsv" if RUBY_VERSION.match /^1.8/
|
14
14
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
15
|
gem.add_development_dependency "cucumber", ">= 0"
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/dwc-archive/ingester.rb
CHANGED
@@ -8,9 +8,10 @@ class DarwinCore
|
|
8
8
|
index_fix = 1
|
9
9
|
args = {:col_sep => @field_separator}
|
10
10
|
args.merge!({:quote_char => @quote_character}) if @quote_character != ''
|
11
|
+
min_size = @fields.map {|f| f[:index].to_i || 0}.sort[-1] + 1
|
11
12
|
CSV.open(@file_path, args).each_with_index do |r, i|
|
12
13
|
index_fix = 0; next if @ignore_headers && i == 0
|
13
|
-
|
14
|
+
min_size > r.size ? errors << r : process_csv_row(res, errors, r)
|
14
15
|
if block_given? && (i + index_fix) % batch_size == 0
|
15
16
|
yield [res, errors]
|
16
17
|
res = []
|
@@ -14,17 +14,17 @@ describe DarwinCore do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
it "should raise error if archive file does not exist" do
|
17
|
+
it "should raise an error if archive file does not exist" do
|
18
18
|
file = 'not_a_file'
|
19
19
|
lambda { DarwinCore.new(file) }.should raise_error(DarwinCore::FileNotFoundError)
|
20
20
|
end
|
21
21
|
|
22
|
-
it "should raise
|
22
|
+
it "should raise an error if archive is broken" do
|
23
23
|
file = File.join(@file_dir, 'broken.tar.gz')
|
24
24
|
lambda { DarwinCore.new(file) }.should raise_error(DarwinCore::UnpackingError)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "should raise error if archive is invalid" do
|
27
|
+
it "should raise an error if archive is invalid" do
|
28
28
|
file = File.join(@file_dir, 'invalid.tar.gz')
|
29
29
|
lambda { DarwinCore.new(file) }.should raise_error(DarwinCore::InvalidArchiveError)
|
30
30
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwc-archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dmitry Mozzherin
|
@@ -15,27 +15,13 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-05-
|
18
|
+
date: 2010-05-27 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: fastercsv
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
21
|
- !ruby/object:Gem::Dependency
|
36
22
|
name: rspec
|
37
23
|
prerelease: false
|
38
|
-
requirement: &
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
26
|
requirements:
|
41
27
|
- - ">="
|
@@ -47,11 +33,11 @@ dependencies:
|
|
47
33
|
- 9
|
48
34
|
version: 1.2.9
|
49
35
|
type: :development
|
50
|
-
version_requirements: *
|
36
|
+
version_requirements: *id001
|
51
37
|
- !ruby/object:Gem::Dependency
|
52
38
|
name: cucumber
|
53
39
|
prerelease: false
|
54
|
-
requirement: &
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
55
41
|
none: false
|
56
42
|
requirements:
|
57
43
|
- - ">="
|
@@ -61,7 +47,7 @@ dependencies:
|
|
61
47
|
- 0
|
62
48
|
version: "0"
|
63
49
|
type: :development
|
64
|
-
version_requirements: *
|
50
|
+
version_requirements: *id002
|
65
51
|
description: Darwin Core Archive is the current standard exchange format for GLobal Names Architecture modules. This gem makes it easy to incorporate files in Darwin Core Archive format into a ruby project.
|
66
52
|
email: dmozzherin at gmail dot com
|
67
53
|
executables: []
|
@@ -141,6 +127,6 @@ signing_key:
|
|
141
127
|
specification_version: 3
|
142
128
|
summary: Handler of Darwin Core Archive files
|
143
129
|
test_files:
|
144
|
-
- spec/lib/dwc-archive_spec.rb
|
145
|
-
- spec/lib/ruby_extenstions_spec.rb
|
146
130
|
- spec/spec_helper.rb
|
131
|
+
- spec/lib/ruby_extenstions_spec.rb
|
132
|
+
- spec/lib/dwc-archive_spec.rb
|