cul-fedora-arm 0.5.2 → 0.6.0
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 +1 -1
- data/cul-fedora-arm.gemspec +5 -4
- data/lib/cul/fedora/arm/builder.rb +16 -2
- data/lib/cul/fedora/arm/foxml_builder.rb +8 -2
- data/test/cul_fedora_arm_builder_test.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/cul-fedora-arm.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cul-fedora-arm}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["James Stuart"]
|
12
|
-
s.date = %q{2009-10
|
12
|
+
s.date = %q{2009-11-10}
|
13
13
|
s.description = %q{Tools for dealing with Cul ARM specification}
|
14
14
|
s.email = %q{tastyhat@jamesstuart.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -90,3 +90,4 @@ Gem::Specification.new do |s|
|
|
90
90
|
s.add_dependency(%q<ruby-fedora>, [">= 0"])
|
91
91
|
end
|
92
92
|
end
|
93
|
+
|
@@ -23,7 +23,7 @@ module Cul
|
|
23
23
|
MANDATORY_COLUMNS = [:sequence, :target, :model_type]
|
24
24
|
|
25
25
|
# list of columns which may have values
|
26
|
-
VALID_COLUMNS = [:sequence, :target, :model_type, :source, :template_type, :dc_format, :id, :pid, :action, :license]
|
26
|
+
VALID_COLUMNS = [:sequence, :target, :model_type, :source, :template_type, :dc_format, :title_attr, :mime, :id, :pid, :action, :license]
|
27
27
|
|
28
28
|
FOXML_BUILDER = FoxmlBuilder.new()
|
29
29
|
# array of individual hash: each hash corresponds to a metadata or resource.
|
@@ -128,6 +128,20 @@ module Cul
|
|
128
128
|
task.post(@connector)
|
129
129
|
task.response
|
130
130
|
end
|
131
|
+
|
132
|
+
def update_aggregator(value_hash)
|
133
|
+
self.purge(value_hash[:pid])
|
134
|
+
insert_aggregator(value_hash)
|
135
|
+
end
|
136
|
+
def update_metadata(value_hash)
|
137
|
+
self.purge(value_hash[:pid])
|
138
|
+
insert_metadata(value_hash)
|
139
|
+
end
|
140
|
+
def update_resource(value_hash)
|
141
|
+
self.purge(value_hash[:pid])
|
142
|
+
insert_resource(value_hash)
|
143
|
+
end
|
144
|
+
|
131
145
|
|
132
146
|
def reserve_pids(parts=@parts)
|
133
147
|
assigned = []
|
@@ -182,7 +196,7 @@ module Cul
|
|
182
196
|
def test_for_required_columns(value_hash)
|
183
197
|
missing_values = REQUIRED_COLUMNS.select { |col| !value_hash.has_key?(col) || value_hash[col].nil? }
|
184
198
|
if (value_hash.has_key?(:action) and value_hash[:action].eql?('update'))
|
185
|
-
raise "Update operations require a PID" unless (value_hash.has_key(:pid) and !value_hash[:pid].strip().eql?(''))
|
199
|
+
raise "Update operations require a PID" unless (value_hash.has_key?(:pid) and !value_hash[:pid].strip().eql?(''))
|
186
200
|
end
|
187
201
|
raise "Missing required values #{missing_values.join(",")}" unless missing_values.empty?
|
188
202
|
end
|
@@ -212,7 +212,7 @@ RESOURCE
|
|
212
212
|
value_default_key = (template_type.downcase + "_" + model_type.downcase).intern
|
213
213
|
subs = {}
|
214
214
|
if(DEFAULTS.has_key?(value_default_key))
|
215
|
-
subs =
|
215
|
+
subs = DEFAULTS[value_default_key].merge(value_hash)
|
216
216
|
now = Time.now
|
217
217
|
subs[:timestamp] = now.strftime("%Y-%m-%dT%H:%M:%S.000Z")
|
218
218
|
subs[:rels] = build_rels(subs)
|
@@ -228,7 +228,13 @@ RESOURCE
|
|
228
228
|
subs[:metadata] = File.open(subs[:source]){|file| file.read() }
|
229
229
|
subs.merge!(parse_mods(subs[:metadata]))
|
230
230
|
end
|
231
|
-
|
231
|
+
realpath = ""
|
232
|
+
begin
|
233
|
+
realpath = Pathname.new(subs[:source]).realpath
|
234
|
+
rescue
|
235
|
+
realpath = subs[:source]
|
236
|
+
end
|
237
|
+
subs[:source] = 'file://' + realpath
|
232
238
|
subs[:datastream_type] = 'E'
|
233
239
|
else
|
234
240
|
subs[:datastream_type] = 'M'
|
@@ -42,7 +42,7 @@ class CulFedoraArmBuilderTest < Test::Unit::TestCase
|
|
42
42
|
|
43
43
|
assert_equal @builder_class::REQUIRED_COLUMNS, [:sequence]
|
44
44
|
assert_equal @builder_class::MANDATORY_COLUMNS, [:sequence, :target, :model_type]
|
45
|
-
assert_equal @builder_class::VALID_COLUMNS, [:sequence, :target, :model_type, :source, :template_type, :dc_format, :id, :pid, :action, :license]
|
45
|
+
assert_equal @builder_class::VALID_COLUMNS, [:sequence, :target, :model_type, :source, :template_type, :dc_format, :title_attr, :mime, :id, :pid, :action, :license]
|
46
46
|
end
|
47
47
|
|
48
48
|
should "accept only options :template or :file" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul-fedora-arm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stuart
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10
|
12
|
+
date: 2009-11-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|