sufia 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -3
- data/.travis.yml +4 -4
- data/README.md +1 -10
- data/SUFIA_VERSION +1 -1
- data/app/assets/images/audio.png +0 -0
- data/app/assets/javascripts/sufia/trophy.js +11 -5
- data/app/controllers/single_use_links_controller.rb +11 -1
- data/app/helpers/facets_helper.rb +3 -0
- data/app/helpers/sufia/facets_helper_behavior.rb +23 -0
- data/app/helpers/sufia_helper.rb +3 -21
- data/app/views/dashboard/_facet_limit.html.erb +2 -20
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +4 -2
- data/app/views/generic_files/_descriptions.html.erb +2 -18
- data/app/views/generic_files/_field_form.html.erb +7 -2
- data/app/views/generic_files/_media_display.html.erb +0 -16
- data/app/views/generic_files/_permission.html.erb +1 -17
- data/app/views/generic_files/_permission_form.html.erb +1 -1
- data/app/views/generic_files/_show_actions.html.erb +1 -8
- data/app/views/generic_files/_versioning.html.erb +1 -17
- data/app/views/generic_files/edit.html.erb +1 -17
- data/app/views/mailbox/index.html.erb +5 -3
- data/app/views/users/_activity.html.erb +3 -0
- data/app/views/users/_activity_log.html.erb +1 -17
- data/app/views/users/_contributions.html.erb +29 -0
- data/app/views/users/_follower_modal.html.erb +26 -0
- data/app/views/users/_following_modal.html.erb +26 -0
- data/app/views/users/_left_sidebar.html.erb +12 -0
- data/app/views/users/_notify_number.html.erb +0 -16
- data/app/views/users/_profile.html.erb +7 -0
- data/app/views/users/_profile_actions.html.erb +11 -0
- data/app/views/users/_profile_tabs.html.erb +11 -0
- data/app/views/users/_search_form.html.erb +1 -17
- data/app/views/users/_social_media_info.html.erb +20 -0
- data/app/views/users/_user_info.html.erb +0 -16
- data/app/views/users/_vitals.html.erb +4 -0
- data/app/views/users/edit.html.erb +1 -17
- data/app/views/users/index.html.erb +0 -16
- data/app/views/users/notifications_number.js.erb +0 -16
- data/app/views/users/show.html.erb +21 -58
- data/lib/sufia.rb +1 -3
- data/lib/sufia/controller.rb +0 -6
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/batch_edits_controller_spec.rb +8 -2
- data/spec/controllers/generic_files_controller_spec.rb +8 -28
- data/spec/controllers/single_use_links_controller_spec.rb +26 -2
- data/spec/factories/generic_files.rb +46 -0
- data/spec/factories/users.rb +6 -2
- data/spec/features/browse_dashboard_files_spec.rb +39 -0
- data/spec/features/browse_files_spec.rb +30 -0
- data/spec/features/{contact_form.rb → contact_form_spec.rb} +1 -1
- data/spec/features/{display_dashboard.rb → display_dashboard_spec.rb} +1 -7
- data/spec/features/{ingest_upload_files.rb → ingest_upload_files_spec.rb} +2 -2
- data/spec/features/notifications_spec.rb +20 -0
- data/spec/features/users_spec.rb +12 -0
- data/spec/helpers/sufia_helper_spec.rb +23 -0
- data/spec/lib/sufia/id_service_spec.rb +0 -38
- data/spec/support/features.rb +2 -0
- data/spec/support/features/session_helpers.rb +9 -1
- data/spec/support/fixture_helpers.rb +10 -0
- data/spec/views/dashboard/facet_limit.html.erb_spec.rb +15 -0
- data/spec/views/dashboard/index_partials/_thumbnail_display.html.erb_spec.rb +22 -0
- data/spec/views/generic_file/edit.html.erb_spec.rb +24 -0
- data/spec/views/users/show.html.erb_spec.rb +31 -0
- data/sufia-models/app/models/concerns/sufia/user.rb +2 -2
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +2 -1
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_linkedin_to_users.rb +5 -0
- data/sufia-models/lib/sufia/models/generic_file/actions.rb +0 -1
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/sufia-models.gemspec +3 -5
- data/tasks/sufia-dev.rake +0 -10
- metadata +43 -69
- data/app/views/generic_files/edit_fields/_type.html.erb +0 -12
- data/lib/tasks/fixtures.rake +0 -231
- data/spec/features/browse_dashboard_files.rb +0 -21
- data/spec/features/browse_files.rb +0 -31
- data/spec/fixtures/empty_file.txt +0 -0
- data/spec/fixtures/fits_datastream.xml +0 -42
- data/spec/fixtures/sufia/bg_header.jpg +0 -0
- data/spec/fixtures/sufia/sufia_test1.descMeta.txt +0 -12
- data/spec/fixtures/sufia/sufia_test1.foxml.erb +0 -89
- data/spec/fixtures/sufia/sufia_test1.txt +0 -1
- data/spec/fixtures/sufia/sufia_test2.descMeta.txt +0 -12
- data/spec/fixtures/sufia/sufia_test2.docx +0 -0
- data/spec/fixtures/sufia/sufia_test2.foxml.erb +0 -88
- data/spec/fixtures/sufia/sufia_test3.descMeta.txt +0 -12
- data/spec/fixtures/sufia/sufia_test3.foxml.erb +0 -91
- data/spec/fixtures/sufia/sufia_test3.xls +0 -0
- data/spec/fixtures/sufia/sufia_test4.descMeta.txt +0 -12
- data/spec/fixtures/sufia/sufia_test4.foxml.erb +0 -91
- data/spec/fixtures/sufia/sufia_test5.descMeta.txt +0 -19
- data/spec/fixtures/sufia/sufia_test5.foxml.erb +0 -90
- data/spec/fixtures/sufia/sufia_test5.txt +0 -1
- data/spec/fixtures/sufia/sufia_test6.descMeta.txt +0 -12
- data/spec/fixtures/sufia/sufia_test6.foxml.erb +0 -89
- data/spec/fixtures/sufia/sufia_test6.jp2 +0 -0
- data/spec/fixtures/sufia/sufia_test6.txt +0 -1
- data/spec/fixtures/sufia_generic_stub.descMeta.txt +0 -12
- data/spec/fixtures/sufia_generic_stub.foxml.erb +0 -79
- data/spec/models/unzip_job_spec.rb +0 -47
- data/spec/rake/sufia_fixtures_spec.rb +0 -74
- data/sufia-models/lib/sufia/models/jobs/unzip_job.rb +0 -38
- data/tasks/sufia-fixtures.rake +0 -232
@@ -1,89 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<foxml:digitalObject PID="sufia:test6" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
3
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
4
|
-
<foxml:objectProperties>
|
5
|
-
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
6
|
-
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Test Image"/>
|
7
|
-
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
|
8
|
-
</foxml:objectProperties>
|
9
|
-
<foxml:datastream CONTROL_GROUP="X" ID="DC" STATE="A" VERSIONABLE="true">
|
10
|
-
<foxml:datastreamVersion FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
11
|
-
ID="DC1.0" LABEL="Dublin Core Record for this object" MIMETYPE="text/xml">
|
12
|
-
<foxml:xmlContent>
|
13
|
-
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/"
|
14
|
-
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
16
|
-
<dc:title>Test Image</dc:title>
|
17
|
-
<dc:identifier>sufia:test6</dc:identifier>
|
18
|
-
</oai_dc:dc>
|
19
|
-
</foxml:xmlContent>
|
20
|
-
</foxml:datastreamVersion>
|
21
|
-
</foxml:datastream>
|
22
|
-
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
|
-
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test6.descMeta.txt" TYPE="URL"/>
|
25
|
-
</foxml:datastreamVersion>
|
26
|
-
</foxml:datastream>
|
27
|
-
<foxml:datastream ID="properties" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
|
28
|
-
<foxml:datastreamVersion ID="properties.0" LABEL="" CREATED="2012-08-24T16:08:36.120Z" MIMETYPE="text/xml" SIZE="86">
|
29
|
-
<foxml:xmlContent>
|
30
|
-
<fields>
|
31
|
-
<depositor>archivist1</depositor>
|
32
|
-
<relative_path/>
|
33
|
-
</fields>
|
34
|
-
</foxml:xmlContent>
|
35
|
-
</foxml:datastreamVersion>
|
36
|
-
</foxml:datastream>
|
37
|
-
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
|
38
|
-
<foxml:datastreamVersion ID="RELS-EXT.0"
|
39
|
-
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
|
40
|
-
<foxml:xmlContent>
|
41
|
-
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
42
|
-
<rdf:Description rdf:about="info:fedora/sufia:test6">
|
43
|
-
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
44
|
-
</rdf:Description>
|
45
|
-
</rdf:RDF>
|
46
|
-
</foxml:xmlContent>
|
47
|
-
</foxml:datastreamVersion>
|
48
|
-
</foxml:datastream>
|
49
|
-
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
50
|
-
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
51
|
-
MIMETYPE="image/jpeg">
|
52
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test6.jp2" TYPE="URL"/>
|
53
|
-
</foxml:datastreamVersion>
|
54
|
-
</foxml:datastream>
|
55
|
-
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
56
|
-
<foxml:datastreamVersion CREATED="2012-04-06T13:41:37.093Z" ID="rightsMetadata.0" LABEL="" MIMETYPE="text/xml" SIZE="582">
|
57
|
-
<foxml:xmlContent>
|
58
|
-
<rightsMetadata version="0.1" xmlns="http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1">
|
59
|
-
<copyright>
|
60
|
-
<human/>
|
61
|
-
<machine>
|
62
|
-
<uvalicense>no</uvalicense>
|
63
|
-
</machine>
|
64
|
-
</copyright>
|
65
|
-
<access type="discover">
|
66
|
-
<human/>
|
67
|
-
<machine>
|
68
|
-
<group>public</group>
|
69
|
-
</machine>
|
70
|
-
</access>
|
71
|
-
<access type="read">
|
72
|
-
<human/>
|
73
|
-
<machine/>
|
74
|
-
</access>
|
75
|
-
<access type="edit">
|
76
|
-
<human/>
|
77
|
-
<machine>
|
78
|
-
<person>archivist1@example.com</person>
|
79
|
-
</machine>
|
80
|
-
</access>
|
81
|
-
<embargo>
|
82
|
-
<human/>
|
83
|
-
<machine/>
|
84
|
-
</embargo>
|
85
|
-
</rightsMetadata>
|
86
|
-
</foxml:xmlContent>
|
87
|
-
</foxml:datastreamVersion>
|
88
|
-
</foxml:datastream>
|
89
|
-
</foxml:digitalObject>
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
This is a test fixture for sufia: test6.
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/publisher> "<%= @user %>" .
|
2
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/description> "<%= @title %> Description" .
|
3
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/created> "<%= Time.now.ctime %>" .
|
4
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/contributor> "<%= @user %>" .
|
5
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/title> "<%= @title %>" .
|
6
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/relation> "test" .
|
7
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/subject> "<%= @title %> Test" .
|
8
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/language> "En" .
|
9
|
-
<info:fedora/sufia:<%= @id %>> <http://xmlns.com/foaf/0.1/based_near> "State College" .
|
10
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/rights> "<%= @user %>" .
|
11
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/creator> "<%= @user %>" .
|
12
|
-
<info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/identifier> "Test" .
|
@@ -1,79 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<foxml:digitalObject PID="<%=SUFIA_TEST_NS%>:<%= @id %>" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
3
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
4
|
-
<foxml:objectProperties>
|
5
|
-
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
6
|
-
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="<%= @title %>"/>
|
7
|
-
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
|
8
|
-
</foxml:objectProperties>
|
9
|
-
<foxml:datastream CONTROL_GROUP="X" ID="DC" STATE="A" VERSIONABLE="true">
|
10
|
-
<foxml:datastreamVersion FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
11
|
-
ID="DC1.0" LABEL="Dublin Core Record for this object" MIMETYPE="text/xml">
|
12
|
-
<foxml:xmlContent>
|
13
|
-
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/"
|
14
|
-
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
16
|
-
<dc:title><%= @title %></dc:title>
|
17
|
-
<dc:identifier><%=SUFIA_TEST_NS%>:<%= @id %></dc:identifier>
|
18
|
-
</oai_dc:dc>
|
19
|
-
</foxml:xmlContent>
|
20
|
-
</foxml:datastreamVersion>
|
21
|
-
</foxml:datastream>
|
22
|
-
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
|
-
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file:<%=@root%>/sufia/<%=SUFIA_TEST_NS%>_<%= @id %>.descMeta.txt" TYPE="URL"/>
|
25
|
-
</foxml:datastreamVersion>
|
26
|
-
</foxml:datastream>
|
27
|
-
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
|
28
|
-
<foxml:datastreamVersion ID="RELS-EXT.0"
|
29
|
-
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml">
|
30
|
-
<foxml:xmlContent>
|
31
|
-
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
32
|
-
<rdf:Description rdf:about="info:fedora/<%=SUFIA_TEST_NS%>:<%= @id %>">
|
33
|
-
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
34
|
-
</rdf:Description>
|
35
|
-
</rdf:RDF>
|
36
|
-
</foxml:xmlContent>
|
37
|
-
</foxml:datastreamVersion>
|
38
|
-
</foxml:datastream>
|
39
|
-
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
40
|
-
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
41
|
-
MIMETYPE="text/plain" >
|
42
|
-
<foxml:contentLocation REF="file:<%=@root%>/sufia/<%=SUFIA_TEST_NS%>_<%= @id %>.txt" TYPE="URL"/>
|
43
|
-
</foxml:datastreamVersion>
|
44
|
-
</foxml:datastream>
|
45
|
-
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
46
|
-
<foxml:datastreamVersion CREATED="2012-04-06T13:41:37.093Z" ID="rightsMetadata.0" LABEL="" MIMETYPE="text/xml">
|
47
|
-
<foxml:xmlContent>
|
48
|
-
<rightsMetadata version="0.1" xmlns="http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1">
|
49
|
-
<copyright>
|
50
|
-
<human/>
|
51
|
-
<machine>
|
52
|
-
<uvalicense>no</uvalicense>
|
53
|
-
</machine>
|
54
|
-
</copyright>
|
55
|
-
<access type="discover">
|
56
|
-
<human/>
|
57
|
-
<machine>
|
58
|
-
<group>public</group>
|
59
|
-
</machine>
|
60
|
-
</access>
|
61
|
-
<access type="read">
|
62
|
-
<human/>
|
63
|
-
<machine/>
|
64
|
-
</access>
|
65
|
-
<access type="edit">
|
66
|
-
<human/>
|
67
|
-
<machine>
|
68
|
-
<person>archivist1@example.com</person>
|
69
|
-
</machine>
|
70
|
-
</access>
|
71
|
-
<embargo>
|
72
|
-
<human/>
|
73
|
-
<machine/>
|
74
|
-
</embargo>
|
75
|
-
</rightsMetadata>
|
76
|
-
</foxml:xmlContent>
|
77
|
-
</foxml:datastreamVersion>
|
78
|
-
</foxml:datastream>
|
79
|
-
</foxml:digitalObject>
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe UnzipJob do
|
4
|
-
before do
|
5
|
-
@batch = Batch.create
|
6
|
-
@generic_file = GenericFile.new(:batch=>@batch)
|
7
|
-
@generic_file.add_file(File.open(fixture_path + '/icons.zip'), 'content', 'icons.zip')
|
8
|
-
@generic_file.apply_depositor_metadata('mjg36')
|
9
|
-
@generic_file.stub(:characterize_if_changed).and_yield #don't run characterization
|
10
|
-
@generic_file.save
|
11
|
-
end
|
12
|
-
|
13
|
-
after do
|
14
|
-
@batch.delete
|
15
|
-
@generic_file.delete
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should create GenericFiles for each file in the zipfile" do
|
19
|
-
one = GenericFile.new
|
20
|
-
#one.should_receive(:characterize_if_changed)
|
21
|
-
two = GenericFile.new
|
22
|
-
#two.should_receive(:characterize_if_changed)
|
23
|
-
three = GenericFile.new
|
24
|
-
#three.should_receive(:characterize_if_changed)
|
25
|
-
GenericFile.should_receive(:new).exactly(3).times.and_return(one, two, three)
|
26
|
-
UnzipJob.new(@generic_file.pid).run
|
27
|
-
|
28
|
-
one.content.size.should == 13024 #bread
|
29
|
-
one.content.label.should == 'spec/fixtures/bread-icon.png'
|
30
|
-
one.content.mimeType.should == 'image/png'
|
31
|
-
one.batch.should == @batch
|
32
|
-
|
33
|
-
two.content.size.should == 12995 #coffee
|
34
|
-
two.content.label.should == 'spec/fixtures/coffeecup-red-icon.png'
|
35
|
-
two.content.mimeType.should == 'image/png'
|
36
|
-
two.batch.should == @batch
|
37
|
-
|
38
|
-
three.content.size.should == 58097 #hamburger
|
39
|
-
three.content.label.should == 'spec/fixtures/hamburger-icon.png'
|
40
|
-
three.content.mimeType.should == 'image/png'
|
41
|
-
three.batch.should == @batch
|
42
|
-
|
43
|
-
one.delete
|
44
|
-
two.delete
|
45
|
-
three.delete
|
46
|
-
end
|
47
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Used to test the sufia-fixtures rake task
|
4
|
-
require "rake"
|
5
|
-
|
6
|
-
describe "sufia:fixtures" do
|
7
|
-
|
8
|
-
def loaded_files_excluding_current_rake_file
|
9
|
-
$".reject { |file| file.include? "tasks/sufia-fixtures" }
|
10
|
-
end
|
11
|
-
|
12
|
-
# saves original $stdout in variable
|
13
|
-
# set $stdout as local instance of StringIO
|
14
|
-
# yields to code execution
|
15
|
-
# returns the local instance of StringIO
|
16
|
-
# resets $stdout to original value
|
17
|
-
def capture_stdout
|
18
|
-
out = StringIO.new
|
19
|
-
$stdout = out
|
20
|
-
yield
|
21
|
-
return out.string
|
22
|
-
ensure
|
23
|
-
$stdout = STDOUT
|
24
|
-
end
|
25
|
-
|
26
|
-
def activefedora_path
|
27
|
-
Gem.loaded_specs['active-fedora'].full_gem_path
|
28
|
-
end
|
29
|
-
|
30
|
-
def delete_fixture_files
|
31
|
-
File.delete(File.join(File.expand_path("#{fixture_path}/sufia"), "sufia_rspecTestFixture.txt"))
|
32
|
-
File.delete(File.join(File.expand_path("#{fixture_path}/sufia"), "sufia_rspecTestFixture.descMeta.txt"))
|
33
|
-
File.delete(File.join(File.expand_path("#{fixture_path}/sufia"), "sufia_rspecTestFixture.foxml.erb"))
|
34
|
-
begin
|
35
|
-
File.delete(File.join(File.expand_path("#{fixture_path}/sufia"), "sufia_rspecTestFixture.foxml.xml"))
|
36
|
-
rescue
|
37
|
-
# do nothing; this just means the generate task was not called
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# set up the rake environment
|
42
|
-
before(:each) do
|
43
|
-
@rake = Rake::Application.new
|
44
|
-
Rake.application = @rake
|
45
|
-
Rake.application.rake_require("sufia-fixtures", ["#{Sufia::Engine.root}/tasks/"], loaded_files_excluding_current_rake_file)
|
46
|
-
Rake.application.rake_require("fixtures", ["#{Sufia::Engine.root}/lib/tasks/"], loaded_files_excluding_current_rake_file)
|
47
|
-
Rake.application.rake_require("lib/tasks/active_fedora", [activefedora_path], loaded_files_excluding_current_rake_file)
|
48
|
-
Rake::Task.define_task(:environment)
|
49
|
-
end
|
50
|
-
|
51
|
-
after(:each) do
|
52
|
-
delete_fixture_files
|
53
|
-
end
|
54
|
-
|
55
|
-
describe 'create, generate, load and delete' do
|
56
|
-
it 'should load and then delete fixtures' do
|
57
|
-
ENV["FIXTURE_ID"] = "rspecTestFixture"
|
58
|
-
ENV["FIXTURE_TITLE"] = "rspec Test Fixture"
|
59
|
-
ENV["FIXTURE_USER"] = "rspec"
|
60
|
-
o = capture_stdout do
|
61
|
-
@rake['sufia:fixtures:create'].invoke
|
62
|
-
@rake['sufia:fixtures:generate'].invoke
|
63
|
-
@rake['sufia:fixtures:load'].invoke
|
64
|
-
@rake['sufia:fixtures:delete'].invoke
|
65
|
-
end
|
66
|
-
Dir.glob(File.join(fixture_path, File.expand_path("/sufia"), "sufia_rspecTestFixture.txt")).length.should == 1
|
67
|
-
Dir.glob(File.join(fixture_path, File.expand_path("/sufia"), "sufia_rspecTestFixture.foxml.erb")).length.should == 1
|
68
|
-
Dir.glob(File.join(fixture_path, File.expand_path("/sufia"), "sufia_rspecTestFixture.descMeta.txt")).length.should == 1
|
69
|
-
Dir.glob(File.join(fixture_path, File.expand_path("/sufia"), "sufia_rspecTestFixture.foxml.xml")).length.should == 1
|
70
|
-
o.should include "Loaded 'sufia:rspecTestFixture'"
|
71
|
-
o.should include "Deleted 'sufia:rspecTestFixture'"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class UnzipJob < ActiveFedoraPidBasedJob
|
2
|
-
def queue_name
|
3
|
-
:unzip
|
4
|
-
end
|
5
|
-
|
6
|
-
def run
|
7
|
-
Zip::Archive.open_buffer(object.content.content) do |archive|
|
8
|
-
archive.each do |f|
|
9
|
-
if f.directory?
|
10
|
-
create_directory(f)
|
11
|
-
else
|
12
|
-
create_file(f)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
protected
|
19
|
-
|
20
|
-
# Creates a GenericFile object based on +file+
|
21
|
-
# @param file [Zip::File]
|
22
|
-
def create_file(file)
|
23
|
-
@generic_file = GenericFile.new
|
24
|
-
@generic_file.batch_id = object.batch.pid
|
25
|
-
@generic_file.add_file(file.read, 'content', file.name)
|
26
|
-
@generic_file.apply_depositor_metadata(object.edit_users.first)
|
27
|
-
@generic_file.date_uploaded = Time.now.ctime
|
28
|
-
@generic_file.date_modified = Time.now.ctime
|
29
|
-
@generic_file.save
|
30
|
-
end
|
31
|
-
|
32
|
-
# Creates representation of directory corresponding to +file+
|
33
|
-
# Default behavior: _do nothing_
|
34
|
-
# @param file [Zip::File]
|
35
|
-
def create_directory(file)
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
data/tasks/sufia-fixtures.rake
DELETED
@@ -1,232 +0,0 @@
|
|
1
|
-
# sufia-fixtures
|
2
|
-
#
|
3
|
-
# This was extracted from the original Hydra version in
|
4
|
-
# ~/rvm/gems/<rails version>@sufia/bundler/gems/lib/railties
|
5
|
-
# It has been changed to read all files out of a directory and pass those as fixtures.
|
6
|
-
# Any _ in the file name will be modified to a : for the id, since colons are not valid in a file name.
|
7
|
-
# The files should be named id_[fixture id] which should relates to the id within the foxml sufia:[fixture id] where
|
8
|
-
# [fixture id] is some alpha numeric id ('test1')
|
9
|
-
#
|
10
|
-
# There are 2 sets of data needed to attach to a sufia fixture, 1 the data file, and 2 the metadata.
|
11
|
-
# It is important that the meta-data contains the appropriate id, or solor will not index it!
|
12
|
-
#
|
13
|
-
# Usage: rake sufia:fixtures:create [DIR=<fixture dir>] [FIXTURE_ID=<fixture id>] [FIXTURE_TITLE=<fixture title>] [FIXTURE_USER=<fixture user>]
|
14
|
-
# <fixture dir> is an optional directory under spec/fixtures to find the fixtures to load
|
15
|
-
# DEFAULT: sufia
|
16
|
-
# <fixture id> is the id given to this fixture with fedora and solr.
|
17
|
-
# This must be unique and any old files will be overwritten.
|
18
|
-
# DEFAULT: sufia1
|
19
|
-
# <fixture title> is the title given to the fixture in fedora and solor,
|
20
|
-
# along with being put in the description and subject by default.
|
21
|
-
# DEFAULT: sufia test
|
22
|
-
# <fixture user> is the user given to the fixture in fedora and solor,
|
23
|
-
# along with being put in the contributor and rights.
|
24
|
-
# DEFAULT: archivist1
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# Creates new fixture files including the erb, descMeta, and text for loading into sufia.
|
28
|
-
# The Files are named based on the sufia: id_<fixture id>.foxml.erb, id_<fixture id>.descMeta.txt, and id_<fixture id>.txt
|
29
|
-
# The foxml.erb file references the descMeta.txt and .txt file. You can edit the erb to point to other data and/or edit the
|
30
|
-
# .descMeta.txt and/or .txt file to contain the data you wish.
|
31
|
-
#
|
32
|
-
# *** Please note that the id must be changed in the file name, foxml.erb, and descMeta.txt if you change it after creation. ***
|
33
|
-
#
|
34
|
-
# rake sufia:fixtures:generate [DIR=<fixture dir>]
|
35
|
-
# <fixture dir> is an optional directory under spec/fixtures to find the fixtures to load
|
36
|
-
# DEFAULT: sufia
|
37
|
-
#
|
38
|
-
# Creates foxml.xml files from the foxml.erb files doing any erb substitutions within the erb file.
|
39
|
-
# This task is mostly used to put the appropriate Rails.root into the foxml.xml file so that
|
40
|
-
# the data and meta-data files can be located on load.
|
41
|
-
#
|
42
|
-
# rake sufia:fixtures:delete [DIR=<fixture dir>]
|
43
|
-
# <fixture dir> is an optional directory under spec/fixtures to find the fixtures to load
|
44
|
-
# DEFAULT: sufia
|
45
|
-
#
|
46
|
-
# Remove any fixtures defined by .xml.foxml files in Rais.root/spec/fixtures/<fixture dir> from fedora and solr.
|
47
|
-
#
|
48
|
-
# rake sufia:fixtures:load [DIR=<fixture dir>]
|
49
|
-
# <fixture dir> is an optional directory under spec/fixtures to find the fixtures to load
|
50
|
-
# DEFAULT: sufia
|
51
|
-
#
|
52
|
-
# load any fixtures defined by .xml.foxml files in Rais.root/spec/fixtures/<fixture dir> into fedora and solr.
|
53
|
-
#
|
54
|
-
# rake sufia:fixtures:refresh [DIR=<fixture dir>]
|
55
|
-
# <fixture dir> is an optional directory under spec/fixtures to find the fixtures to load
|
56
|
-
# DEFAULT: sufia
|
57
|
-
#
|
58
|
-
# delete then load any fixtures defined by .xml.foxml files in Rais.root/spec/fixtures/<fixture dir> into fedora and solr.
|
59
|
-
#
|
60
|
-
# Example meta-data:
|
61
|
-
#
|
62
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/publisher> "archivist1" .
|
63
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/description> "MP3 Description" .
|
64
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/created> "04/12/2012" .
|
65
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/contributor> "archivist1" .
|
66
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/title> "MP3" .
|
67
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/relation> "test" .
|
68
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/subject> "MP3 Test" .
|
69
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/language> "En" .
|
70
|
-
# <info:fedora/sufia:[fixture id]> <http://xmlns.com/foaf/0.1/based_near> "State College" .
|
71
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/rights> "archivist1" .
|
72
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/creator> "archivist1" .
|
73
|
-
# <info:fedora/sufia:[fixture id]> <http://purl.org/dc/terms/identifier> "Test" .
|
74
|
-
#
|
75
|
-
# Example foxml: (note the ID needs to be unique) (the binary data in the xml below was generated using base64 on the text)
|
76
|
-
# <?xml version="1.0" encoding="UTF-8"?>
|
77
|
-
# <foxml:digitalObject PID="sufia:[fixture id]" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
78
|
-
# xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
79
|
-
# <foxml:objectProperties>
|
80
|
-
# <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
81
|
-
# <foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="testFixture2.txt"/>
|
82
|
-
# <foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
|
83
|
-
# </foxml:objectProperties>
|
84
|
-
# <foxml:datastream CONTROL_GROUP="X" ID="DC" STATE="A" VERSIONABLE="true">
|
85
|
-
# <foxml:datastreamVersion FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
86
|
-
# ID="DC1.0" LABEL="Dublin Core Record for this object" MIMETYPE="text/xml" SIZE="377">
|
87
|
-
# <foxml:xmlContent>
|
88
|
-
# <oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/"
|
89
|
-
# xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
90
|
-
# xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
91
|
-
# <dc:title>testFixture2.txt</dc:title>
|
92
|
-
# <dc:identifier>sufia:[fixture id]</dc:identifier>
|
93
|
-
# </oai_dc:dc>
|
94
|
-
# </foxml:xmlContent>
|
95
|
-
# </foxml:datastreamVersion>
|
96
|
-
# </foxml:datastream>
|
97
|
-
# <foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
98
|
-
# <foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
99
|
-
# <foxml:binaryContent> PGluZm86ZmVkb3JhL2lkOnRlc3QyPiA8aHR0cDovL3B1cmwub3JnL2RjL3Rlcm1zL3B1Ymxpc2hl
|
100
|
-
# cj4gIkNBQyIgLgo8aW5mbzpmZWRvcmEvaWQ6dGVzdDI+IDxodHRwOi8vcHVybC5vcmcvZGMvdGVy
|
101
|
-
# bXMvZGVzY3JpcHRpb24+ICJUZXN0IEZpeHR1cmUgMiIgLgo8aW5mbzpmZWRvcmEvaWQ6dGVzdDI+
|
102
|
-
# IDxodHRwOi8vcHVybC5vcmcvZGMvdGVybXMvY3JlYXRlZD4gIjQvNi8yMDEyIiAuCjxpbmZvOmZl
|
103
|
-
# ZG9yYS9pZDp0ZXN0Mj4gPGh0dHA6Ly9wdXJsLm9yZy9kYy90ZXJtcy9jb250cmlidXRvcj4gIkNB
|
104
|
-
# QyIgLgo8aW5mbzpmZWRvcmEvaWQ6dGVzdDI+IDxodHRwOi8vcHVybC5vcmcvZGMvdGVybXMvdGl0
|
105
|
-
# bGU+ICJUZXN0IEZpeHR1cmUgMiAoVGl0bGUpIiAuCjxpbmZvOmZlZG9yYS9pZDp0ZXN0Mj4gPGh0
|
106
|
-
# dHA6Ly9wdXJsLm9yZy9kYy90ZXJtcy9yZWxhdGlvbj4gInRlc3QiIC4KPGluZm86ZmVkb3JhL2lk
|
107
|
-
# OnRlc3QyPiA8aHR0cDovL3B1cmwub3JnL2RjL3Rlcm1zL3N1YmplY3Q+ICJUZXN0aW5nIEZpeHR1
|
108
|
-
# cmUgMiIgLgo8aW5mbzpmZWRvcmEvaWQ6dGVzdDI+IDxodHRwOi8vcHVybC5vcmcvZGMvdGVybXMv
|
109
|
-
# bGFuZ3VhZ2U+ICJFbiIgLgo8aW5mbzpmZWRvcmEvaWQ6dGVzdDI+IDxodHRwOi8veG1sbnMuY29t
|
110
|
-
# L2ZvYWYvMC4xL2Jhc2VkX25lYXI+ICJTdGF0ZSBDb2xsZWdlIiAuCjxpbmZvOmZlZG9yYS9pZDp0
|
111
|
-
# ZXN0Mj4gPGh0dHA6Ly9wdXJsLm9yZy9kYy90ZXJtcy9yaWdodHM+ICJjYWMiIC4KPGluZm86ZmVk
|
112
|
-
# b3JhL2lkOnRlc3QyPiA8aHR0cDovL3B1cmwub3JnL2RjL3Rlcm1zL2NyZWF0b3I+ICJDQUMiIC4K
|
113
|
-
# PGluZm86ZmVkb3JhL2lkOnRlc3QyPiA8aHR0cDovL3B1cmwub3JnL2RjL3Rlcm1zL2lkZW50aWZp
|
114
|
-
# ZXI+ICJmaXh0dXJlIiAuCg==
|
115
|
-
# </foxml:binaryContent>
|
116
|
-
# </foxml:datastreamVersion>
|
117
|
-
# </foxml:datastream>
|
118
|
-
# <foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
|
119
|
-
# <foxml:datastreamVersion ID="RELS-EXT.0"
|
120
|
-
# LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
|
121
|
-
# <foxml:xmlContent>
|
122
|
-
# <rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
123
|
-
# <rdf:Description rdf:about="info:fedora/sufia:[fixture id]">
|
124
|
-
# <ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
125
|
-
# </rdf:Description>
|
126
|
-
# </rdf:RDF>
|
127
|
-
# </foxml:xmlContent>
|
128
|
-
# </foxml:datastreamVersion>
|
129
|
-
# </foxml:datastream>
|
130
|
-
# <foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
131
|
-
# <foxml:datastreamVersion ID="content.0" LABEL="testFixture2.txt"
|
132
|
-
# MIMETYPE="text/plain" >
|
133
|
-
# <foxml:binaryContent> VGhpcyBpcyBhIHRlc3QgZml4dHVyZS4gCkJpbmFyeSBkYXRhIGZvciBmaXh0dXJlIDIuCg== </foxml:binaryContent>
|
134
|
-
# </foxml:datastreamVersion>
|
135
|
-
# </foxml:datastream>
|
136
|
-
# <foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
137
|
-
# <foxml:datastreamVersion ID="rightsMetadata.0" LABEL="" MIMETYPE="text/xml" SIZE="582">
|
138
|
-
# <foxml:xmlContent>
|
139
|
-
# <rightsMetadata version="0.1" xmlns="http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1">
|
140
|
-
# <copyright>
|
141
|
-
# <human/>
|
142
|
-
# <machine>
|
143
|
-
# <uvalicense>no</uvalicense>
|
144
|
-
# </machine>
|
145
|
-
# </copyright>
|
146
|
-
# <access type="discover">
|
147
|
-
# <human/>
|
148
|
-
# <machine/>
|
149
|
-
# </access>
|
150
|
-
# <access type="read">
|
151
|
-
# <human/>
|
152
|
-
# <machine/>
|
153
|
-
# </access>
|
154
|
-
# <access type="edit">
|
155
|
-
# <human/>
|
156
|
-
# <machine>
|
157
|
-
# <person>cam156@psu.edu</person>
|
158
|
-
# </machine>
|
159
|
-
# </access>
|
160
|
-
# <embargo>
|
161
|
-
# <human/>
|
162
|
-
# <machine/>
|
163
|
-
# </embargo>
|
164
|
-
# </rightsMetadata>
|
165
|
-
# </foxml:xmlContent>
|
166
|
-
# </foxml:datastreamVersion>
|
167
|
-
# </foxml:datastream>
|
168
|
-
# </foxml:digitalObject>
|
169
|
-
#
|
170
|
-
#
|
171
|
-
#
|
172
|
-
|
173
|
-
require 'active_fedora'
|
174
|
-
|
175
|
-
SUFIA_TEST_NS = 'sufia' #this must be the same as id_namespace in the test applications config
|
176
|
-
namespace :sufia do
|
177
|
-
namespace :fixtures do
|
178
|
-
@localDir = File.expand_path("../../spec/fixtures", __FILE__)
|
179
|
-
@dir = ENV["FIXTURE_DIR"] || 'sufia'
|
180
|
-
|
181
|
-
desc "Create sufia Hydra fixtures for generation and loading"
|
182
|
-
task :create do
|
183
|
-
@id = ENV["FIXTURE_ID"] ||'sufia1'
|
184
|
-
@title = ENV["FIXTURE_TITLE"] || 'sufia test'
|
185
|
-
@user = ENV["FIXTURE_USER"] || 'archivist1'
|
186
|
-
|
187
|
-
@root ='<%=@localDir%>'
|
188
|
-
|
189
|
-
@inputFoxmlFile = File.join(@localDir, 'sufia_generic_stub.foxml.erb')
|
190
|
-
@inputDescFile = File.join(@localDir, 'sufia_generic_stub.descMeta.txt')
|
191
|
-
@inputTxtFile = File.join(@localDir, 'sufia_generic_stub.txt')
|
192
|
-
|
193
|
-
@outputFoxmlFile = File.join(@localDir, @dir, "#{SUFIA_TEST_NS}_#{@id}.foxml.erb")
|
194
|
-
@outputDescFile = File.join(@localDir, @dir, "#{SUFIA_TEST_NS}_#{@id}.descMeta.txt")
|
195
|
-
@outputTxtFile = File.join(@localDir, @dir, "#{SUFIA_TEST_NS}_#{@id}.txt")
|
196
|
-
|
197
|
-
run_erb_stub @inputFoxmlFile, @outputFoxmlFile
|
198
|
-
run_erb_stub @inputDescFile, @outputDescFile
|
199
|
-
run_erb_stub @inputTxtFile, @outputTxtFile
|
200
|
-
end
|
201
|
-
|
202
|
-
desc "Generate default sufia Hydra fixtures"
|
203
|
-
task :generate do
|
204
|
-
ENV["dir"] = File.join(@localDir, @dir)
|
205
|
-
fixtures = find_fixtures_erb(@dir)
|
206
|
-
fixtures.each do |fixture|
|
207
|
-
unless fixture.include?('generic_stub')
|
208
|
-
outFile = fixture.sub('foxml.erb','foxml.xml')
|
209
|
-
File.open(outFile, "w+") do |f|
|
210
|
-
f.write(ERB.new(get_erb_template fixture).result(binding))
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
private
|
217
|
-
|
218
|
-
def run_erb_stub(inputFile, outputFile)
|
219
|
-
File.open(outputFile, "w+") do |f|
|
220
|
-
f.write(ERB.new(get_erb_template inputFile).result())
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
def find_fixtures_erb(dir)
|
225
|
-
Dir.glob(File.join(@localDir, dir, '*.foxml.erb'))
|
226
|
-
end
|
227
|
-
|
228
|
-
def get_erb_template(file)
|
229
|
-
File.read(file)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
end
|