dwc-archive 0.4.5 → 0.4.6

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/README.rdoc CHANGED
@@ -55,6 +55,56 @@ Update to latest rubygems (v >= 1.3.6) which adds gemcutter sources by default.
55
55
 
56
56
  DarwinCore.clean_all # remove all expanded archives
57
57
 
58
+ == Creating a DarwinCore Archive file
59
+
60
+ gen = DarwinCore::Generator.new('/tmp/dwc_birches.tar.gz')
61
+
62
+ core = [
63
+ ["http://rs.tdwg.org/dwc/terms/taxonID", "http://rs.tdwg.org/dwc/terms/parentNameUsageID", "http://rs.tdwg.org/dwc/terms/scientificName", "http://rs.tdwg.org/dwc/terms/taxonRank"],
64
+ [1, 0, "Plantae", "kingdom"],
65
+ [2, 1, "Betula", "genus"],
66
+ [3, 2, "Betula verucosa", "species"]
67
+ ]
68
+
69
+ vernacular_names = [
70
+ ["http://rs.tdwg.org/dwc/terms/TaxonID", "http://rs.tdwg.org/dwc/terms/vernacularName"],
71
+ [1, "Plants"],
72
+ [1, "Растения"],
73
+ [2, "Birch"],
74
+ [2, "Береза"],
75
+ [3, "Wheeping Birch"],
76
+ [3, "Береза плакучая"]
77
+ ]
78
+
79
+ synonyms = [
80
+ ["http://rs.tdwg.org/dwc/terms/TaxonID", "http://rs.tdwg.org/dwc/terms/scientificName", "http://rs.tdwg.org/dwc/terms/taxonomicStatus"],
81
+ [1, "Betila Linnaeus, 1753", 'misspelling']
82
+ ]
83
+
84
+ eml = {
85
+ :id => '1234',
86
+ :title => 'Test Classification',
87
+ :authors => [
88
+ { :first_name => 'John',
89
+ :last_name => 'Doe',
90
+ :email => 'jdoe@example.com' },
91
+ { :first_name => 'Jane',
92
+ :last_name => 'Doe',
93
+ :email => 'jane@example.com' }
94
+ ],
95
+ :abstract => 'test classification',
96
+ :citation => 'Test classification: Doe John, Doe Jane, Taxnonmy, 10, 1, 2010',
97
+ :url => 'http://example.com'
98
+ }
99
+
100
+ gen.add_core(core, 'core.txt')
101
+ gen.add_extension(synonyms, 'synonyms.txt')
102
+ gen.add_extension(vernacular_names, 'vernacular_names.txt')
103
+ gen.add_meta_xml
104
+ gen.add_eml_xml(eml)
105
+ gen.pack
106
+
107
+
58
108
  == Note on Patches/Pull Requests
59
109
 
60
110
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.4.6
@@ -7,7 +7,10 @@ class DarwinCore
7
7
  attr_accessor :id, :parent_id, :classification_path, :current_name, :current_name_canonical, :synonyms, :vernacular_names, :rank, :status
8
8
 
9
9
  def initialize
10
- @id = @parent_id = @classification_path = @current_name = @current_name_canonical = @rank = @status = nil
10
+ @id = @parent_id = @rank = @status = nil
11
+ @current_name = ''
12
+ @current_name_canonical = ''
13
+ @classification_path = []
11
14
  @synonyms = []
12
15
  @vernacular_names = []
13
16
  end
@@ -116,7 +119,7 @@ class DarwinCore
116
119
  def get_classification_path(taxon)
117
120
  return if taxon.classification_path
118
121
  if DarwinCore.nil_field?(taxon.parent_id)
119
- taxon.classification_path = [taxon.current_name_canonical]
122
+ taxon.classification_path << taxon.current_name_canonical
120
123
  else
121
124
  begin
122
125
  parent_cp = @res[taxon.parent_id].classification_path
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: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 5
10
- version: 0.4.5
9
+ - 6
10
+ version: 0.4.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dmitry Mozzherin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-15 00:00:00 -04:00
18
+ date: 2010-09-17 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency