dwc-archive 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  task :default => :spec
48
48
 
49
- require 'rake/rdoctask'
49
+ require 'rdoc/task'
50
50
  Rake::RDocTask.new do |rdoc|
51
51
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
52
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -60,7 +60,7 @@ class DarwinCore
60
60
  def get_canonical_name(a_scientific_name)
61
61
  a_scientific_name.force_encoding('utf-8')
62
62
  canonical_name = @parser.parse(a_scientific_name, :canonical_only => true)
63
- canonical_name.to_s.empty? ? a_scientific_name : canonical_name.force_encoding('utf-8')
63
+ canonical_name.to_s.empty? ? a_scientific_name : canonical_name
64
64
  end
65
65
 
66
66
  def get_fields(element)
@@ -89,10 +89,10 @@ class DarwinCore
89
89
  def set_scientific_name(row, fields)
90
90
  row[fields[:scientificname]] = 'N/A' unless row[fields[:scientificname]]
91
91
  canonical_name = ''
92
- scientific_name = row[fields[:scientificname]].strip
92
+ scientific_name = row[fields[:scientificname]].strip.force_encoding('utf-8')
93
93
  if separate_canonical_and_authorship?(row, fields)
94
- canonical_name = row[fields[:scientificname]].strip
95
- scientific_name += " #{row[fields[:scientificnameauthorship]].strip}"
94
+ canonical_name = row[fields[:scientificname]].strip.force_encoding('utf-8')
95
+ scientific_name += " #{row[fields[:scientificnameauthorship]].strip.force_encoding('utf-8')}"
96
96
  else
97
97
  canonical_name = get_canonical_name(row[fields[:scientificname]])
98
98
  end
@@ -124,8 +124,8 @@ class DarwinCore
124
124
  else
125
125
  taxon = @normalized_data[r[@core_fields[:id]]] ? @normalized_data[r[@core_fields[:id]]] : @normalized_data[r[@core_fields[:id]]] = DarwinCore::TaxonNormalized.new
126
126
  taxon.id = r[@core_fields[:id]]
127
- taxon.current_name = r[@core_fields[:scientificname]].force_encoding("utf-8")
128
- taxon.current_name_canonical = r[@core_fields[:canonicalname]].force_encoding("utf-8")
127
+ taxon.current_name = r[@core_fields[:scientificname]]
128
+ taxon.current_name_canonical = r[@core_fields[:canonicalname]]
129
129
  taxon.parent_id = r[parent_id]
130
130
  taxon.rank = r[@core_fields[:taxonrank]] if @core_fields[:taxonrank]
131
131
  taxon.status = r[@core_fields[:taxonomicstatus]] if @core_fields[:taxonomicstatus]
@@ -248,5 +248,3 @@ class DarwinCore
248
248
 
249
249
  end
250
250
  end
251
-
252
-
@@ -120,9 +120,11 @@ describe DarwinCore do
120
120
  it "should be able work with files which have scientificNameAuthorship" do
121
121
  file = File.join(@file_dir, 'sci_name_authorship.tar.gz')
122
122
  dwc = DarwinCore.new(file)
123
- $lala = 1
124
123
  cn = DarwinCore::ClassificationNormalizer.new(dwc)
125
124
  norm = cn.normalize
125
+ path_encodings = norm.map {|taxon_id, taxon| taxon.classification_path}.flatten.map { |name| name.encoding.to_s }.uniq
126
+ path_encodings.size.should == 1
127
+ path_encodings[0].should == "UTF-8"
126
128
  taxa = norm.select{|k,v| v.current_name_canonical.match " "}.select{|k,v| [v.current_name.split(" ").size > v.current_name_canonical.split(" ").size]}
127
129
  taxa.size.should == 507
128
130
  syn = norm.select{|k,v| v.synonyms.size > 0}.map {|k,v| v.synonyms}.flatten.select {|s| s.name.split(" ").size > s.canonical_name.split(" ").size}
@@ -132,7 +134,6 @@ describe DarwinCore do
132
134
  it "should be able work with files which repeat scientificNameAuthorship value in scientificName field" do
133
135
  file = File.join(@file_dir, 'sci_name_authorship_dup.tar.gz')
134
136
  dwc = DarwinCore.new(file)
135
- $lala = 1
136
137
  norm = dwc.normalize_classification
137
138
  taxa = norm.select{|k,v| v.current_name_canonical.match " "}.select{|k,v| [v.current_name.split(" ").size > v.current_name_canonical.split(" ").size]}
138
139
  taxa.size.should == 507
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dwc-archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parsley-store
16
- requirement: &70198504788000 !ruby/object:Gem::Requirement
16
+ requirement: &70195181105880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70198504788000
24
+ version_requirements: *70195181105880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70198504787520 !ruby/object:Gem::Requirement
27
+ requirement: &70195181104820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.3.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70198504787520
35
+ version_requirements: *70195181104820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &70198504787040 !ruby/object:Gem::Requirement
38
+ requirement: &70195181104200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70198504787040
46
+ version_requirements: *70195181104200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &70198504786560 !ruby/object:Gem::Requirement
49
+ requirement: &70195181103720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70198504786560
57
+ version_requirements: *70195181103720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &70198504786080 !ruby/object:Gem::Requirement
60
+ requirement: &70195181103100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70198504786080
68
+ version_requirements: *70195181103100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &70198504785600 !ruby/object:Gem::Requirement
71
+ requirement: &70195181102480 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.6.4
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70198504785600
79
+ version_requirements: *70195181102480
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: ruby-debug19
82
- requirement: &70198504785060 !ruby/object:Gem::Requirement
82
+ requirement: &70195181102000 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70198504785060
90
+ version_requirements: *70195181102000
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: parsley-store
93
- requirement: &70198504784520 !ruby/object:Gem::Requirement
93
+ requirement: &70195181101520 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.3.0
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70198504784520
101
+ version_requirements: *70195181101520
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &70198504784020 !ruby/object:Gem::Requirement
104
+ requirement: &70195181101020 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 1.2.9
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70198504784020
112
+ version_requirements: *70195181101020
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: cucumber
115
- requirement: &70198504783540 !ruby/object:Gem::Requirement
115
+ requirement: &70195181100540 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70198504783540
123
+ version_requirements: *70195181100540
124
124
  description: Darwin Core Archive is the current standard exchange format for GLobal
125
125
  Names Architecture modules. This gem makes it easy to incorporate files in Darwin
126
126
  Core Archive format into a ruby project.