dwc-archive 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -26,12 +26,13 @@ class DarwinCore
26
26
  f.split("/")[-1]
27
27
  end
28
28
  data.unshift(fields) if keep_headers
29
- @meta_xml_data[:core] = {:fields => header, :ignoreHeaderLines => keep_headers, :location => file_name}
29
+ ignore_header_lines = keep_headers ? 1 : 0
30
+ @meta_xml_data[:core] = {:fields => header, :ignoreHeaderLines => ignore_header_lines, :location => file_name}
30
31
  data.each {|d| c << d}
31
32
  c.close
32
33
  end
33
34
 
34
- def add_extension(data, file_name, keep_headers = true)
35
+ def add_extension(data, file_name, keep_headers = true, row_type = "http://rs.tdwg.org/dwc/terms/Taxon")
35
36
  c = CSV.open(File.join(@path,file_name), @write)
36
37
  header = data.shift
37
38
  fields = header.map do |f|
@@ -40,7 +41,8 @@ class DarwinCore
40
41
  f.split("/")[-1]
41
42
  end
42
43
  data.unshift(fields) if keep_headers
43
- @meta_xml_data[:extensions] << { :fields => header, :ignoreHeaderLines => keep_headers, :location => file_name }
44
+ ignore_header_lines = keep_headers ? 1 : 0
45
+ @meta_xml_data[:extensions] << { :fields => header, :ignoreHeaderLines => ignore_header_lines, :location => file_name, :rowType => row_type }
44
46
  data.each { |d| c << d }
45
47
  c.close
46
48
  end
@@ -10,10 +10,9 @@ class DarwinCore
10
10
  def create
11
11
  builder = Nokogiri::XML::Builder.new do |xml|
12
12
  opts = { :encoding => "UTF-8", :fieldsTerminatedBy => ",", :fieldsEnclosedBy => '"', :linesTerminatedBy => "\n", :rowType => "http://rs.tdwg.org/dwc/terms/Taxon" }
13
- xml.starArchive(:xmlns => "http://rs.tdwg.org/dwc/terms/xsd/archive/",
13
+ xml.archive(:xmlns => "http://rs.tdwg.org/dwc/text/",
14
14
  "xmlns:xsi" =>"http://www.w3.org/2001/XMLSchema-instance",
15
- "xsi:schemaLocation" => "http://rs.tdwg.org/dwc/terms/xsd/archive/ http://darwincore.googlecode.com/svn/trunk/text/tdwg_dwc_text.xsd",
16
- :fileRoot => ".") do
15
+ "xsi:schemaLocation" => "http://rs.tdwg.org/dwc/terms/xsd/archive/ http://darwincore.googlecode.com/svn/trunk/text/tdwg_dwc_text.xsd") do
17
16
  xml.core(opts.merge(:ignoreHeaderLines => @data[:core][:ignoreHeaderLines])) do
18
17
  xml.files { xml.location(@data[:core][:location]) }
19
18
  taxon_id, fields = find_taxon_id(@data[:core][:fields])
@@ -21,7 +20,7 @@ class DarwinCore
21
20
  fields.each { |f| xml.field(:term => f[0], :index => f[1]) }
22
21
  end
23
22
  @data[:extensions].each do |e|
24
- xml.extension(opts.merge(:ignoreHeaderLines => e[:ignoreHeaderLines])) do
23
+ xml.extension(opts.merge(:ignoreHeaderLines => e[:ignoreHeaderLines], :rowType => e[:rowType])) do
25
24
  xml.files { xml.location(e[:location]) }
26
25
  taxon_id, fields = find_taxon_id(e[:fields])
27
26
  xml.coreid(:term => taxon_id[0], :index => taxon_id[1])
File without changes
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.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -269,7 +269,7 @@ files:
269
269
  - spec/files/tmp/metadata.txt
270
270
  - spec/files/uncompressed
271
271
  - spec/lib/dwc-archive_spec.rb
272
- - spec/lib/xml_reader_soec.rb
272
+ - spec/lib/xml_reader_spec.rb
273
273
  - spec/spec.opts
274
274
  - spec/spec_helper.rb
275
275
  homepage: http://github.com/GlobalNamesArchitecture/dwc-archive
@@ -286,7 +286,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
286
286
  version: '0'
287
287
  segments:
288
288
  - 0
289
- hash: 542323731549920464
289
+ hash: 4292793553882825535
290
290
  required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  none: false
292
292
  requirements: