datacite-mapping 0.2.3 → 0.2.4

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
  SHA1:
3
- metadata.gz: 94b1cd9d6fa3c9f73d4e01b8932735ed5531de96
4
- data.tar.gz: 1f641d5ea6c21711480d806a4fc6e07b07df2697
3
+ metadata.gz: e8d570ed19b36949ccbd477c42b99eb16decca70
4
+ data.tar.gz: 3f9608fb7b9520b69bfc5a4f802d36d3cfeba96b
5
5
  SHA512:
6
- metadata.gz: 8958bbce65cce405ec02251e111902de276955f4f822a60409ef62c0532cc3315869db205f2491b95d8701579a623da711513c1938f637ab9c59ea84646668e9
7
- data.tar.gz: 91bfefea1df89cf6067fa6f9a680c885ee49f76ff700849e88ada850016f42626fe3eec484da19efd1e1520ea16480dbea41afcbf5c75ec447d9b36237a8bbfe
6
+ metadata.gz: 1a4d62507b31e9a3c3086ae9a4f2721c7e8539d0e08d49ccff037e85eaca7a2b740d3055791ba81f8df5589e01ca0ab04d90beec3881c979039a58f874a06a4a
7
+ data.tar.gz: 56f0d8270aca2b12cca28998fca293490d8cb30ff89f4af1274fbb571bb81bd1a99d50f978cf42b6e1532ec4e573ebdecaf8e5b067978d5bc5dfb1b6b839cfeb
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.2.4 (8 November 2016)
2
+
3
+ - Fix issue where writing a resource in Datacite 3 would cause the Datacite 3 namespace
4
+ to stick around, even when later writing Datacite 4.
5
+ - Remove well-intentioned but ill-advised feature that would auto-sort `<geoLocationBox/>`
6
+ coordinates into north/south and east/west.
7
+
1
8
  ## 0.2.3 (5 October 2016)
2
9
 
3
10
  - Allow empty `<identifier/>` tags on read, but not write
@@ -117,8 +117,10 @@ module Datacite
117
117
  end
118
118
 
119
119
  def init_from_array(coordinates)
120
- self.south_latitude, self.north_latitude = [coordinates[0], coordinates[2]].sort
121
- self.west_longitude, self.east_longitude = [coordinates[1], coordinates[3]].sort
120
+ self.south_latitude = coordinates[0]
121
+ self.north_latitude = coordinates[2]
122
+ self.west_longitude = coordinates[1]
123
+ self.east_longitude = coordinates[3]
122
124
  end
123
125
  end
124
126
 
@@ -4,7 +4,7 @@ module Datacite
4
4
  NAME = 'datacite-mapping'.freeze
5
5
 
6
6
  # The version of this gem
7
- VERSION = '0.2.3'.freeze
7
+ VERSION = '0.2.4'.freeze
8
8
 
9
9
  # The copyright notice for this gem
10
10
  COPYRIGHT = 'Copyright (c) 2016 The Regents of the University of California'.freeze
@@ -28,12 +28,15 @@ module Datacite
28
28
 
29
29
  # Overrides Namespaced::InstanceMethods.fill_into_xml to check mapping
30
30
  def fill_into_xml(xml, options = { mapping: :_default })
31
- if options[:mapping] == :datacite_3
32
- unless namespace.uri == DATACITE_3_NAMESPACE.uri
33
- @namespace = DATACITE_3_NAMESPACE.with_prefix(namespace.prefix)
34
- end
31
+ current_namespace = namespace
32
+ return super if options[:mapping] != :datacite_3 || current_namespace.uri == DATACITE_3_NAMESPACE.uri
33
+
34
+ begin
35
+ @namespace = DATACITE_3_NAMESPACE.with_prefix(current_namespace.prefix)
36
+ super
37
+ ensure
38
+ @namespace = current_namespace
35
39
  end
36
- super
37
40
  end
38
41
 
39
42
  # Initialies a new {Resource}
@@ -12,20 +12,12 @@ module Datacite
12
12
  expect(box.east_longitude).to eq(-70.67)
13
13
  end
14
14
 
15
- it 'accepts a quad with flipped east/west coordinates' do
16
- box = GeoLocationBox.new(-33.45, -70.67, 47.61, -122.33)
17
- expect(box.south_latitude).to eq(-33.45)
18
- expect(box.west_longitude).to eq(-122.33)
19
- expect(box.north_latitude).to eq(47.61)
20
- expect(box.east_longitude).to eq(-70.67)
21
- end
22
-
23
- it 'accepts a quad with flipped north/south coordinates' do
24
- box = GeoLocationBox.new(47.61, -122.33, -33.45, -70.67)
25
- expect(box.south_latitude).to eq(-33.45)
26
- expect(box.west_longitude).to eq(-122.33)
27
- expect(box.north_latitude).to eq(47.61)
28
- expect(box.east_longitude).to eq(-70.67)
15
+ it 'accepts a quad crossing 180°' do
16
+ box = GeoLocationBox.new(-41.289, 174.777, 21.3, -157.817)
17
+ expect(box.south_latitude).to eq(-41.289)
18
+ expect(box.west_longitude).to eq(174.777)
19
+ expect(box.north_latitude).to eq(21.3)
20
+ expect(box.east_longitude).to eq(-157.817)
29
21
  end
30
22
 
31
23
  it 'accepts :south_latitude, :west_longitude, :north_latitude, :east_longitude' do
@@ -1045,6 +1045,11 @@ module Datacite
1045
1045
  expect(rexml.namespace).to eq(DATACITE_3_NAMESPACE.uri)
1046
1046
  end
1047
1047
 
1048
+ it 'still writes DC4 by default after writing DC3' do
1049
+ dc4xml = resource.save_to_xml
1050
+ expect(dc4xml.namespace).to eq(DATACITE_4_NAMESPACE.uri)
1051
+ end
1052
+
1048
1053
  it 'warns about givenNames and familyNames' do
1049
1054
  name_tags = %w(givenName familyName)
1050
1055
  name_tags.each do |tag|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datacite-mapping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-05 00:00:00.000000000 Z
11
+ date: 2016-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typesafe_enum
@@ -656,4 +656,3 @@ test_files:
656
656
  - spec/unit/datacite/mapping/rights_spec.rb
657
657
  - spec/unit/datacite/mapping/subject_spec.rb
658
658
  - spec/unit/datacite/mapping/title_spec.rb
659
- has_rdoc: