sufia 3.3.0 → 3.4.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.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/History.md +20 -0
- data/README.md +9 -5
- data/Releasing_sufia.md +4 -1
- data/SUFIA_VERSION +1 -1
- data/UpgradeGuide.md +3 -0
- data/{lib → app/controllers/concerns}/sufia/dashboard_controller_behavior.rb +1 -15
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/app/views/dashboard/_facet_layout.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_list_files.html.erb +1 -17
- data/app/views/generic_files/_permission_form.html.erb +3 -3
- data/app/views/users/index.html.erb +3 -3
- data/lib/sufia/version.rb +1 -1
- data/lib/sufia.rb +1 -3
- data/spec/controllers/batch_edits_controller_spec.rb +2 -2
- data/spec/controllers/downloads_controller_spec.rb +4 -4
- data/spec/controllers/generic_files_controller_spec.rb +12 -24
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +1 -1
- data/spec/features/single_use_links_spec.rb +1 -1
- data/spec/features/users_spec.rb +6 -0
- data/spec/fixtures/image.jpg +0 -0
- data/spec/fixtures/png_fits.xml +29 -0
- data/spec/models/file_content_datastream_spec.rb +3 -13
- data/spec/models/generic_file/visibility_spec.rb +2 -2
- data/spec/models/generic_file_spec.rb +6 -1
- data/spec/spec_helper.rb +10 -4
- data/sufia-models/app/models/batch.rb +2 -6
- data/sufia-models/lib/sufia/models/engine.rb +2 -1
- data/sufia-models/lib/sufia/models/generic_file/characterization.rb +4 -4
- data/sufia-models/lib/sufia/models/generic_file/metadata.rb +22 -0
- data/sufia-models/lib/sufia/models/generic_file/mime_types.rb +23 -0
- data/sufia-models/lib/sufia/models/generic_file/permissions.rb +9 -4
- data/sufia-models/lib/sufia/models/generic_file/trophies.rb +15 -0
- data/sufia-models/lib/sufia/models/generic_file/versions.rb +16 -0
- data/sufia-models/lib/sufia/models/generic_file.rb +6 -52
- data/sufia-models/lib/sufia/models/noid.rb +1 -1
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/lib/sufia/models.rb +0 -6
- data/sufia-models/sufia-models.gemspec +9 -5
- data/sufia.gemspec +1 -2
- data/tasks/release.rake +2 -0
- data/tasks/sufia-dev.rake +1 -1
- metadata +26 -47
- data/lib/generators/sufia/templates/migrations/acts_as_follower_migration.rb +0 -17
- data/lib/generators/sufia/templates/migrations/add_avatars_to_users.rb +0 -9
- data/lib/generators/sufia/templates/migrations/add_groups_to_users.rb +0 -11
- data/lib/generators/sufia/templates/migrations/add_ldap_attrs_to_user.rb +0 -27
- data/lib/generators/sufia/templates/migrations/add_social_to_users.rb +0 -13
- data/lib/generators/sufia/templates/migrations/create_checksum_audit_logs.rb +0 -20
- data/lib/generators/sufia/templates/migrations/create_local_authorities.rb +0 -50
- data/lib/generators/sufia/templates/migrations/create_single_use_links.rb +0 -12
- data/lib/generators/sufia/templates/migrations/create_trophies.rb +0 -10
- data/lib/generators/sufia/templates/migrations/create_version_committers.rb +0 -15
- data/spec/models/access_right_spec.rb +0 -57
- data/sufia-models/app/models/concerns/sufia/models/access_right.rb +0 -79
- data/sufia-models/app/models/concerns/sufia/models/with_access_right.rb +0 -33
- data/sufia-models/lib/sufia/models/generic_file/visibility.rb +0 -65
- /data/{lib → app/controllers/concerns}/sufia/contact_form_controller_behavior.rb +0 -0
- /data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/user.rb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b325d0460fd902145ca8b8c197ea822e271d7182
|
|
4
|
+
data.tar.gz: 6cb9cb9a2b1c4838a16ee2cc5dd4526fb918fc7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02ba6513e673044b55e11a6dbaa68cb83cde5b3e3381c9c75dc86dd2bd21cdb0b709f35904befcb4a8a3fa6485d3081d4028b0480489fdceb3b5ae55a1d19ec0
|
|
7
|
+
data.tar.gz: b7be173445501e70cf190ba23e2965ed3fac991ac5ca4f07a0e339692ce1ef58c7de4edf549788a95d461f32a5fa2a68afbe134518a77c8839a6ff4042dd3669
|
data/Gemfile
CHANGED
|
@@ -8,8 +8,6 @@ gem 'kaminari', github: 'harai/kaminari', branch: 'route_prefix_prototype'
|
|
|
8
8
|
gem 'sufia-models', path: './sufia-models'
|
|
9
9
|
|
|
10
10
|
group :development, :test do
|
|
11
|
-
# https://github.com/zdennis/activerecord-import/pull/79
|
|
12
|
-
#gem 'activerecord-import', '0.3.0'
|
|
13
11
|
gem 'sqlite3'
|
|
14
12
|
gem 'selenium-webdriver'
|
|
15
13
|
gem 'rspec-rails', '~> 2.14'
|
data/History.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# History of Sufia releases
|
|
2
2
|
|
|
3
|
+
## 3.4.0
|
|
4
|
+
* Handle facets with 3 or more words [Jeremy Friesen]
|
|
5
|
+
* Fixed show links in Users#index [Andrew Curley]
|
|
6
|
+
* Update to AF 6.7.0 [Justin Coyne]
|
|
7
|
+
* Adding more verbose logging to specs [Jeremy Friesen]
|
|
8
|
+
* Update to Blacklight 4.5.0 [Justin Coyne]
|
|
9
|
+
* Removing migration templates from Sufia (they are in sufia-models) [Justin Coyne]
|
|
10
|
+
* Removed HTML align property from views [Justin Coyne]
|
|
11
|
+
* Relax the Resque spec [Justin Coyne]
|
|
12
|
+
* Pinned to hydra-head ~> 6.4.0 [Justin Coyne]
|
|
13
|
+
* Moved trophies related methods to Trophies module [Justin Coyne]
|
|
14
|
+
* Move mime type related methods into MimeTypes module [Justin Coyne]
|
|
15
|
+
* Extract version methods into its own module [Justin Coyne]
|
|
16
|
+
* Extract metadata into its own module [Justin Coyne]
|
|
17
|
+
* AccessRight has moved into HydraHead [Justin Coyne]
|
|
18
|
+
* Remove Visibility, which was moved into hydra-head [Justin Coyne]
|
|
19
|
+
* Fix deprecation warnings by switching to
|
|
20
|
+
Hydra::AccessControls::Permissions [Justin Coyne]
|
|
21
|
+
|
|
22
|
+
|
|
3
23
|
## 3.3.0
|
|
4
24
|
* Fix authorities deprecations [Justin Coyne]
|
|
5
25
|
* Fix deprecation on MailboxController [Justin Coyne]
|
data/README.md
CHANGED
|
@@ -49,11 +49,8 @@ Then `bundle install`
|
|
|
49
49
|
|
|
50
50
|
Note the line with kaminari listed as a dependency. This is a temporary fix to address a problem in the current release of kaminari. Technically you should not have to list kaminari, which is a dependency of blacklight and sufia.
|
|
51
51
|
|
|
52
|
-
### Run the
|
|
52
|
+
### Run the sufia generator
|
|
53
53
|
```
|
|
54
|
-
rails g blacklight --devise
|
|
55
|
-
rails g hydra:head -f
|
|
56
|
-
bundle install
|
|
57
54
|
rails g sufia -f
|
|
58
55
|
rm public/index.html
|
|
59
56
|
```
|
|
@@ -90,6 +87,13 @@ Add this line:
|
|
|
90
87
|
//= require sufia
|
|
91
88
|
```
|
|
92
89
|
|
|
90
|
+
**Remove** this line, if present (typically, when using Rails 4):
|
|
91
|
+
```
|
|
92
|
+
//= require turbolinks
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Turbolinks does not mix well with Blacklight.
|
|
96
|
+
|
|
93
97
|
### Install Fits.sh
|
|
94
98
|
1. Go to http://code.google.com/p/fits/downloads/list and download a copy of fits & unpack it somewhere on your Machine.
|
|
95
99
|
1. Give your system access to fits
|
|
@@ -120,7 +124,7 @@ See https://github.com/defunkt/resque for more options
|
|
|
120
124
|
#### On a mac
|
|
121
125
|
Use homebrew:
|
|
122
126
|
```
|
|
123
|
-
brew install ffmpeg --with-libvpx --with-libvorbis
|
|
127
|
+
brew install ffmpeg --with-fdk-aac --with-libvpx --with-libvorbis
|
|
124
128
|
```
|
|
125
129
|
|
|
126
130
|
#### On Ubuntu Linux
|
data/Releasing_sufia.md
CHANGED
data/SUFIA_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.4.0
|
data/UpgradeGuide.md
ADDED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright © 2012 The Pennsylvania State University
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
1
|
require 'blacklight/catalog'
|
|
16
2
|
|
|
17
3
|
module Sufia
|
|
@@ -61,7 +47,7 @@ module Sufia
|
|
|
61
47
|
# adding a key to the session so that the history will be saved so that batch_edits select all will work
|
|
62
48
|
search_session[:dashboard] = true
|
|
63
49
|
respond_to do |format|
|
|
64
|
-
format.html {
|
|
50
|
+
format.html { }
|
|
65
51
|
format.rss { render :layout => false }
|
|
66
52
|
format.atom { render :layout => false }
|
|
67
53
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<li class="expandable_new grey">
|
|
2
|
-
<% id = facet_field.label.
|
|
2
|
+
<% id = facet_field.label.gsub(" ","_") %>
|
|
3
3
|
<!--button class="btn dropdown" data-toggle="collapse" data-target="#collapse_<%= id%>" data-parent="#facet_group"><i class="icon-chevron-right"></i> <%= facet_field.label%></button-->
|
|
4
4
|
|
|
5
5
|
<a class="accordion-toggle grey" data-toggle="collapse" data-parent="#facet_group" data-target="#collapse_<%= id%>">
|
|
@@ -15,7 +15,7 @@ limitations under the License.
|
|
|
15
15
|
%>
|
|
16
16
|
|
|
17
17
|
<li class="expandable_new grey">
|
|
18
|
-
<% id = facet_field.label.
|
|
18
|
+
<% id = facet_field.label.gsub(" ","_")+"_db" %>
|
|
19
19
|
|
|
20
20
|
<a class="accordion-toggle grey" data-toggle="collapse" data-parent="#facet_group" data-target="#collapse_<%= id%>">
|
|
21
21
|
<%= facet_field.label %><i class="icon-chevron-right grey"></i>
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
<%#
|
|
2
|
-
Copyright © 2012 The Pennsylvania State University
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
%>
|
|
16
|
-
|
|
17
1
|
<% noid = document.noid %>
|
|
18
2
|
<tr id="document_<%= noid %>" class="<%= cycle("","zebra") %>">
|
|
19
3
|
<% gf = GenericFile.load_instance_from_solr(document.id) %>
|
|
@@ -32,7 +16,7 @@ limitations under the License.
|
|
|
32
16
|
<span class=center><%= link_to document.title_or_label, sufia.generic_file_path(noid), :id => "src_copy_link#{noid}" %> <br /></span>
|
|
33
17
|
</td>
|
|
34
18
|
<td width="17%"><%= document.date_uploaded %> </td>
|
|
35
|
-
<td width="5%"
|
|
19
|
+
<td width="5%">
|
|
36
20
|
<% if document.registered? %>
|
|
37
21
|
<a href="<%= sufia.generic_file_path(noid) %>/edit/?tab=permissions" id="permission_<%= noid %>"><span class="label label-info" title="<%=t('sufia.institution_name') %>"><%=t('sufia.institution_name') %></span></a>
|
|
38
22
|
<% elsif document.public? %>
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
<h3>Visibility - <small>who should have the ability to read and download</small></h3>
|
|
61
61
|
<div class="controls">
|
|
62
62
|
<label class="radio">
|
|
63
|
-
<input type="radio" id="visibility_open" name="visibility" value="<%=
|
|
63
|
+
<input type="radio" id="visibility_open" name="visibility" value="<%=Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC %>" <% if !public_perm.blank? %> checked="true"<% end %>/> <span class="label label-success">Open Access</span> Visible to the world.
|
|
64
64
|
</label>
|
|
65
65
|
<label class="radio">
|
|
66
|
-
<input type="radio" id="visibility_psu" name="visibility" value="<%=
|
|
66
|
+
<input type="radio" id="visibility_psu" name="visibility" value="<%=Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED %>" <% if !registered_perm.blank? %> checked="true"<% end %> /><span class="label label-info"><%=t('sufia.institution_name') %></span> Visible to all <%=t('sufia.institution_name') %> users.
|
|
67
67
|
</label>
|
|
68
68
|
<label class="radio">
|
|
69
|
-
<input type="radio" id="visibility_restricted" name="visibility" value="<%=
|
|
69
|
+
<input type="radio" id="visibility_restricted" name="visibility" value="<%=Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE %>"<% if registered_perm.blank? and public_perm.blank?%> checked="true"<% end %> /> <span class="label label-important">Private</span> Visible to users/groups specified below, if any.
|
|
70
70
|
</label>
|
|
71
71
|
</div><!-- /.controls -->
|
|
72
72
|
</div><!-- /.control-group -->
|
|
@@ -32,9 +32,9 @@ limitations under the License.
|
|
|
32
32
|
<tbody>
|
|
33
33
|
<% @users.each do |user| %>
|
|
34
34
|
<tr class="<%= cycle("","zebra") %>">
|
|
35
|
-
<td><a href="<%= sufia.profile_path(
|
|
36
|
-
<td ><a href="<%= sufia.profile_path(
|
|
37
|
-
<td><a href="<%= sufia.profile_path(
|
|
35
|
+
<td><a href="<%= sufia.profile_path(user) %>" class="btn btn-small " ><%= image_tag user.avatar.url(:thumb), :width => 30 %></a></td>
|
|
36
|
+
<td ><a href="<%= sufia.profile_path(user) %>" ><%= user.name %><a></td>
|
|
37
|
+
<td><a href="<%= sufia.profile_path(user) %>" ><%= user.user_key %><a></td>
|
|
38
38
|
<td><%= user.department %> </td>
|
|
39
39
|
<td><%= number_of_deposits(user) %> </td>
|
|
40
40
|
</tr>
|
data/lib/sufia/version.rb
CHANGED
data/lib/sufia.rb
CHANGED
|
@@ -6,8 +6,6 @@ require 'hydra-batch-edit'
|
|
|
6
6
|
require 'sufia/models'
|
|
7
7
|
|
|
8
8
|
require 'rails_autolink'
|
|
9
|
-
require 'sufia/dashboard_controller_behavior'
|
|
10
|
-
require "sufia/contact_form_controller_behavior"
|
|
11
9
|
|
|
12
10
|
autoload :Zip, 'zipruby'
|
|
13
11
|
module Sufia
|
|
@@ -20,8 +18,8 @@ module Sufia
|
|
|
20
18
|
#{config.root}/app/controllers/concerns
|
|
21
19
|
#{config.root}/app/models/concerns
|
|
22
20
|
#{config.root}/app/models/datastreams
|
|
21
|
+
#{Hydra::Engine.root}/app/models/concerns
|
|
23
22
|
)
|
|
24
|
-
|
|
25
23
|
end
|
|
26
24
|
|
|
27
25
|
autoload :Controller
|
|
@@ -8,10 +8,10 @@ describe BatchEditsController do
|
|
|
8
8
|
User.any_instance.stub(:groups).and_return([])
|
|
9
9
|
controller.stub(:clear_session_user) ## Don't clear out the authenticated session
|
|
10
10
|
request.env["HTTP_REFERER"] = 'test.host/original_page'
|
|
11
|
-
@routes = Internal::Application.routes
|
|
12
|
-
|
|
13
11
|
end
|
|
14
12
|
|
|
13
|
+
routes { Internal::Application.routes }
|
|
14
|
+
|
|
15
15
|
describe "edit" do
|
|
16
16
|
before do
|
|
17
17
|
@one = GenericFile.new(:creator=>"Fred", :language=>'en')
|
|
@@ -29,7 +29,7 @@ describe DownloadsController do
|
|
|
29
29
|
it "should default to returning configured default download" do
|
|
30
30
|
DownloadsController.default_content_dsid.should == "content"
|
|
31
31
|
controller.stub(:render) # send_data calls render internally
|
|
32
|
-
expected_content = ActiveFedora::Base.find("sufia:test1").content.content
|
|
32
|
+
expected_content = ActiveFedora::Base.find("sufia:test1", cast: true).content.content
|
|
33
33
|
controller.should_receive(:send_file_headers!).with({:filename => 'world.png', :disposition => 'inline', :type => 'image/png' })
|
|
34
34
|
get "show", :id => "test1"
|
|
35
35
|
response.body.should == expected_content
|
|
@@ -37,7 +37,7 @@ describe DownloadsController do
|
|
|
37
37
|
end
|
|
38
38
|
it "should return requested datastreams" do
|
|
39
39
|
controller.stub(:render) # send_data calls render internally
|
|
40
|
-
expected_content = ActiveFedora::Base.find("sufia:test1").descMetadata.content
|
|
40
|
+
expected_content = ActiveFedora::Base.find("sufia:test1", cast: true).descMetadata.content
|
|
41
41
|
controller.should_receive(:send_file_headers!).with({:filename => 'descMetadata', :disposition => 'inline', :type => 'text/plain' })
|
|
42
42
|
get "show", :id => "test1", :datastream_id => "descMetadata"
|
|
43
43
|
response.body.should == expected_content
|
|
@@ -45,7 +45,7 @@ describe DownloadsController do
|
|
|
45
45
|
end
|
|
46
46
|
it "should support setting disposition to inline" do
|
|
47
47
|
controller.stub(:render) # send_data calls render internally
|
|
48
|
-
expected_content = ActiveFedora::Base.find("sufia:test1").content.content
|
|
48
|
+
expected_content = ActiveFedora::Base.find("sufia:test1", cast: true).content.content
|
|
49
49
|
controller.should_receive(:send_file_headers!).with({:filename => 'world.png', :disposition => 'inline', :type => 'image/png' })
|
|
50
50
|
get "show", :id => "test1", :disposition => "inline"
|
|
51
51
|
response.body.should == expected_content
|
|
@@ -54,7 +54,7 @@ describe DownloadsController do
|
|
|
54
54
|
|
|
55
55
|
it "should allow you to specify filename for download" do
|
|
56
56
|
controller.stub(:render) # send_data calls render internally
|
|
57
|
-
expected_content = ActiveFedora::Base.find("sufia:test1").content.content
|
|
57
|
+
expected_content = ActiveFedora::Base.find("sufia:test1", cast: true).content.content
|
|
58
58
|
controller.should_receive(:send_file_headers!).with({:filename => 'my%20dog.png', :disposition => 'inline', :type => 'image/png' })
|
|
59
59
|
get "show", :id => "test1", "filename" => "my%20dog.png"
|
|
60
60
|
response.body.should == expected_content
|
|
@@ -191,7 +191,7 @@ describe GenericFilesController do
|
|
|
191
191
|
# Dir.mkdir @mock_upload_directory unless File.exists? @mock_upload_directory
|
|
192
192
|
FileUtils.mkdir_p([File.join(@mock_upload_directory, "import/files"),File.join(@mock_upload_directory, "import/metadata")])
|
|
193
193
|
FileUtils.copy(File.expand_path('../../fixtures/world.png', __FILE__), @mock_upload_directory)
|
|
194
|
-
FileUtils.copy(File.expand_path('../../fixtures/image.
|
|
194
|
+
FileUtils.copy(File.expand_path('../../fixtures/image.jpg', __FILE__), @mock_upload_directory)
|
|
195
195
|
FileUtils.copy(File.expand_path('../../fixtures/dublin_core_rdf_descMetadata.nt', __FILE__), File.join(@mock_upload_directory, "import/metadata"))
|
|
196
196
|
FileUtils.copy(File.expand_path('../../fixtures/icons.zip', __FILE__), File.join(@mock_upload_directory, "import/files"))
|
|
197
197
|
FileUtils.copy(File.expand_path('../../fixtures/Example.ogg', __FILE__), File.join(@mock_upload_directory, "import/files"))
|
|
@@ -203,30 +203,24 @@ describe GenericFilesController do
|
|
|
203
203
|
end
|
|
204
204
|
context "when User model defines a directory path" do
|
|
205
205
|
before do
|
|
206
|
-
User.any_instance.stub(:directory).and_return(@mock_upload_directory)
|
|
207
|
-
end
|
|
208
|
-
it "should ingest files from the filesystem" do
|
|
209
206
|
if $in_travis
|
|
210
|
-
# This is in place because we stub fits for travis, and the stub sets the mime to application/pdf.
|
|
211
207
|
# In order to avoid an invalid derivative creation, just stub out the derivatives.
|
|
212
208
|
GenericFile.any_instance.stub(:create_derivatives)
|
|
213
209
|
end
|
|
214
|
-
|
|
210
|
+
User.any_instance.stub(:directory).and_return(@mock_upload_directory)
|
|
211
|
+
end
|
|
212
|
+
it "should ingest files from the filesystem" do
|
|
213
|
+
lambda { post :create, local_file: ["world.png", "image.jpg"], batch_id: "xw42n7934"}.should change(GenericFile, :count).by(2)
|
|
215
214
|
response.should redirect_to Sufia::Engine.routes.url_helpers.batch_edit_path('xw42n7934')
|
|
216
215
|
# These files should have been moved out of the upload directory
|
|
217
|
-
File.exist?("#{@mock_upload_directory}/image.
|
|
216
|
+
File.exist?("#{@mock_upload_directory}/image.jpg").should be_false
|
|
218
217
|
File.exist?("#{@mock_upload_directory}/world.png").should be_false
|
|
219
218
|
# And into the storage directory
|
|
220
219
|
files = GenericFile.find(Solrizer.solr_name("is_part_of",:symbol) => 'info:fedora/sufia:xw42n7934')
|
|
221
220
|
files.first.label.should == 'world.png'
|
|
222
|
-
files.last.label.should == 'image.
|
|
221
|
+
files.last.label.should == 'image.jpg'
|
|
223
222
|
end
|
|
224
223
|
it "should ingest redirect to another location" do
|
|
225
|
-
if $in_travis
|
|
226
|
-
# This is in place because we stub fits for travis, and the stub sets the mime to application/pdf.
|
|
227
|
-
# In order to avoid an invalid derivative creation, just stub out the derivatives.
|
|
228
|
-
GenericFile.any_instance.stub(:create_derivatives)
|
|
229
|
-
end
|
|
230
224
|
GenericFilesController.should_receive(:upload_complete_path).and_return(mock_url)
|
|
231
225
|
lambda { post :create, local_file: ["world.png"], batch_id: "xw42n7934"}.should change(GenericFile, :count).by(1)
|
|
232
226
|
response.should redirect_to mock_url
|
|
@@ -237,12 +231,6 @@ describe GenericFilesController do
|
|
|
237
231
|
files.first.label.should == 'world.png'
|
|
238
232
|
end
|
|
239
233
|
it "should ingest directories from the filesystem" do
|
|
240
|
-
#TODO this test is very slow because it kicks off CharacterizeJob.
|
|
241
|
-
if $in_travis
|
|
242
|
-
# This is in place because we stub fits for travis, and the stub sets the mime to application/pdf.
|
|
243
|
-
# In order to avoid an invalid derivative creation, just stub out the derivatives.
|
|
244
|
-
GenericFile.any_instance.stub(:create_derivatives)
|
|
245
|
-
end
|
|
246
234
|
lambda { post :create, local_file: ["world.png", "import"], batch_id: "xw42n7934"}.should change(GenericFile, :count).by(4)
|
|
247
235
|
response.should redirect_to Sufia::Engine.routes.url_helpers.batch_edit_path('xw42n7934')
|
|
248
236
|
# These files should have been moved out of the upload directory
|
|
@@ -261,7 +249,7 @@ describe GenericFilesController do
|
|
|
261
249
|
end
|
|
262
250
|
context "when User model does not define directory path" do
|
|
263
251
|
it "should return an error message and redirect to file upload page" do
|
|
264
|
-
lambda { post :create, local_file: ["world.png", "image.
|
|
252
|
+
lambda { post :create, local_file: ["world.png", "image.jpg"], batch_id: "xw42n7934"}.should_not change(GenericFile, :count)
|
|
265
253
|
response.should render_template :new
|
|
266
254
|
flash[:alert].should == 'Your account is not configured for importing files from a user-directory on the server.'
|
|
267
255
|
end
|
|
@@ -375,15 +363,15 @@ describe GenericFilesController do
|
|
|
375
363
|
posted_file = GenericFile.find(@generic_file.pid)
|
|
376
364
|
version1 = posted_file.content.latest_version
|
|
377
365
|
posted_file.content.version_committer(version1).should == @user.user_key
|
|
378
|
-
|
|
379
|
-
file = fixture_file_upload('/image.
|
|
366
|
+
|
|
367
|
+
file = fixture_file_upload('/image.jpg','image/jpg')
|
|
380
368
|
post :update, :id=>@generic_file.pid, :filedata=>file, :Filename=>"The world", :generic_file=>{:tag=>[''], :permissions=>{:new_user_name=>{'archivist1@example.com'=>'edit'}}}
|
|
381
369
|
|
|
382
370
|
posted_file = GenericFile.find(@generic_file.pid)
|
|
383
371
|
version2 = posted_file.content.latest_version
|
|
384
372
|
posted_file.content.version_committer(version2).should == @user.user_key
|
|
385
373
|
|
|
386
|
-
posted_file.content.mimeType.should == "image/
|
|
374
|
+
posted_file.content.mimeType.should == "image/jpeg"
|
|
387
375
|
post :update, :id=>@generic_file.pid, :revision=>'content.0'
|
|
388
376
|
|
|
389
377
|
|
|
@@ -422,7 +410,7 @@ describe GenericFilesController do
|
|
|
422
410
|
s2 = double('one')
|
|
423
411
|
CharacterizeJob.should_receive(:new).with(@generic_file.pid).and_return(s2)
|
|
424
412
|
Sufia.queue.should_receive(:push).with(s2).once
|
|
425
|
-
file = fixture_file_upload('/image.
|
|
413
|
+
file = fixture_file_upload('/image.jpg','image/jpg')
|
|
426
414
|
post :update, :id=>@generic_file.pid, :filedata=>file, :Filename=>"The world"
|
|
427
415
|
|
|
428
416
|
edited_file = GenericFile.find(@generic_file.pid)
|
|
@@ -45,7 +45,7 @@ describe SingleUseLinksViewerController do
|
|
|
45
45
|
describe "GET 'download'" do
|
|
46
46
|
it "and_return http success" do
|
|
47
47
|
controller.stub(:render)
|
|
48
|
-
expected_content = ActiveFedora::Base.find(@file.pid).content.content
|
|
48
|
+
expected_content = ActiveFedora::Base.find(@file.pid, cast: true).content.content
|
|
49
49
|
controller.should_receive(:send_file_headers!).with({:filename => 'world.png', :disposition => 'inline', :type => 'image/png' })
|
|
50
50
|
get :download, id:download_link_hash
|
|
51
51
|
response.body.should == expected_content
|
|
@@ -32,7 +32,7 @@ describe "Create and use single-use links" do
|
|
|
32
32
|
|
|
33
33
|
expect(page).to have_css '.download-link'
|
|
34
34
|
find('.download-link').click
|
|
35
|
-
expected_content = ActiveFedora::Base.find(@file.pid).content.content
|
|
35
|
+
expected_content = ActiveFedora::Base.find(@file.pid, cast: true).content.content
|
|
36
36
|
expect(page.body).to eq expected_content
|
|
37
37
|
end
|
|
38
38
|
end
|
data/spec/features/users_spec.rb
CHANGED
|
@@ -22,4 +22,10 @@ describe "User Profile" do
|
|
|
22
22
|
page.should have_content "Your profile has been updated"
|
|
23
23
|
page.should have_content "curatorOfData"
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
it "should display all users" do
|
|
27
|
+
click_link "curator1@example.com"
|
|
28
|
+
click_link "View Users"
|
|
29
|
+
page.should have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
|
|
30
|
+
end
|
|
25
31
|
end
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.6.2" timestamp="10/14/13 11:13 AM">
|
|
3
|
+
<identification>
|
|
4
|
+
<identity format="Portable Network Graphics" mimetype="image/png" toolname="FITS" toolversion="0.6.2">
|
|
5
|
+
<tool toolname="Exiftool" toolversion="9.06" />
|
|
6
|
+
<tool toolname="Droid" toolversion="3.0" />
|
|
7
|
+
<tool toolname="ffident" toolversion="0.2" />
|
|
8
|
+
<version toolname="Droid" toolversion="3.0">1.0</version>
|
|
9
|
+
<externalIdentifier toolname="Droid" toolversion="3.0" type="puid">fmt/11</externalIdentifier>
|
|
10
|
+
</identity>
|
|
11
|
+
</identification>
|
|
12
|
+
<fileinfo>
|
|
13
|
+
<lastmodified toolname="Exiftool" toolversion="9.06" status="SINGLE_RESULT">2013:05:13 11:02:08-04:00</lastmodified>
|
|
14
|
+
<filepath toolname="OIS File Information" toolversion="0.1" status="SINGLE_RESULT">/Users/jfriesen/Repositories/sufia/spec/fixtures/world.png</filepath>
|
|
15
|
+
<filename toolname="OIS File Information" toolversion="0.1" status="SINGLE_RESULT">spec/fixtures/world.png</filename>
|
|
16
|
+
<size toolname="OIS File Information" toolversion="0.1" status="SINGLE_RESULT">4218</size>
|
|
17
|
+
<md5checksum toolname="OIS File Information" toolversion="0.1" status="SINGLE_RESULT">28da6259ae5707c68708192a40b3e85c</md5checksum>
|
|
18
|
+
<fslastmodified toolname="OIS File Information" toolversion="0.1" status="SINGLE_RESULT">1368457328000</fslastmodified>
|
|
19
|
+
</fileinfo>
|
|
20
|
+
<filestatus />
|
|
21
|
+
<metadata>
|
|
22
|
+
<image>
|
|
23
|
+
<compressionScheme toolname="Exiftool" toolversion="9.06" status="SINGLE_RESULT">Deflate/Inflate</compressionScheme>
|
|
24
|
+
<imageWidth toolname="Exiftool" toolversion="9.06" status="SINGLE_RESULT">50</imageWidth>
|
|
25
|
+
<imageHeight toolname="Exiftool" toolversion="9.06" status="SINGLE_RESULT">50</imageHeight>
|
|
26
|
+
</image>
|
|
27
|
+
</metadata>
|
|
28
|
+
</fits>
|
|
29
|
+
|
|
@@ -54,30 +54,20 @@ describe FileContentDatastream do
|
|
|
54
54
|
@subject.stub(:pid=>'my_pid')
|
|
55
55
|
@subject.stub(:dsVersionID=>'content.7')
|
|
56
56
|
end
|
|
57
|
-
it "should have the path" do
|
|
58
|
-
@subject.send(:fits_path).should be_present
|
|
59
|
-
end
|
|
60
57
|
it "should return an xml document", :unless => $in_travis do
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
f = File.new(fixture_path + '/world.png')
|
|
64
|
-
content = double("file")
|
|
65
|
-
content.stub(:read=>f.read)
|
|
66
|
-
content.stub(:rewind=>f.rewind)
|
|
67
|
-
@subject.should_receive(:content).exactly(5).times.and_return(f)
|
|
58
|
+
f = File.new(fixture_path + '/world.png', 'rb')
|
|
59
|
+
@subject.content = f.read
|
|
68
60
|
xml = @subject.extract_metadata
|
|
69
61
|
doc = Nokogiri::XML.parse(xml)
|
|
70
62
|
doc.root.xpath('//ns:imageWidth/text()', {'ns'=>'http://hul.harvard.edu/ois/xml/ns/fits/fits_output'}).inner_text.should == '50'
|
|
71
63
|
end
|
|
72
64
|
it "should return expected results when invoked via HTTP", :unless => $in_travis do
|
|
73
|
-
repo = double("repo")
|
|
74
|
-
repo.stub(:config=>{})
|
|
75
65
|
f = ActionDispatch::Http::UploadedFile.new(:tempfile => File.new(fixture_path + '/world.png'),
|
|
76
66
|
:filename => 'world.png')
|
|
77
67
|
content = double("file")
|
|
78
68
|
content.stub(:read=>f.read)
|
|
79
69
|
content.stub(:rewind=>f.rewind)
|
|
80
|
-
@subject.
|
|
70
|
+
@subject.stub(:content).and_return(f)
|
|
81
71
|
xml = @subject.extract_metadata
|
|
82
72
|
doc = Nokogiri::XML.parse(xml)
|
|
83
73
|
doc.root.xpath('//ns:identity/@mimetype', {'ns'=>'http://hul.harvard.edu/ois/xml/ns/fits/fits_output'}).first.value.should == 'image/png'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe Sufia::GenericFile
|
|
3
|
+
describe Sufia::GenericFile do
|
|
4
4
|
module VisibilityOverride
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
6
|
include Sufia::GenericFile::Permissions
|
|
@@ -13,7 +13,7 @@ describe Sufia::GenericFile::Visibility do
|
|
|
13
13
|
|
|
14
14
|
it 'allows for overrides of visibility' do
|
|
15
15
|
expect{
|
|
16
|
-
MockParent.new(visibility:
|
|
16
|
+
MockParent.new(visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE)
|
|
17
17
|
}.to_not raise_error
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -263,6 +263,7 @@ describe GenericFile do
|
|
|
263
263
|
end
|
|
264
264
|
end
|
|
265
265
|
it "should support to_solr" do
|
|
266
|
+
@file.stub(:pid).and_return('stubbed_pid')
|
|
266
267
|
@file.part_of = "Arabiana"
|
|
267
268
|
@file.contributor = "Mohammad"
|
|
268
269
|
@file.creator = "Allah"
|
|
@@ -303,7 +304,7 @@ describe GenericFile do
|
|
|
303
304
|
local[Solrizer.solr_name("desc_metadata__identifier")].should == ["urn:isbn:1234567890"]
|
|
304
305
|
local[Solrizer.solr_name("desc_metadata__based_near")].should == ["Medina, Saudi Arabia"]
|
|
305
306
|
local[Solrizer.solr_name("mime_type")].should == ["image/jpeg"]
|
|
306
|
-
local["noid_tsi"].should
|
|
307
|
+
local["noid_tsi"].should eq('stubbed_pid')
|
|
307
308
|
end
|
|
308
309
|
it "should support multi-valued fields in solr" do
|
|
309
310
|
@file.tag = ["tag1", "tag2"]
|
|
@@ -547,6 +548,10 @@ describe GenericFile do
|
|
|
547
548
|
describe "characterize" do
|
|
548
549
|
it "should return expected results when called", :unless => $in_travis do
|
|
549
550
|
@file.add_file(File.open(fixture_path + '/world.png'), 'content', 'world.png')
|
|
551
|
+
# Without the stub(:save), the after save callback was being triggered
|
|
552
|
+
# which resulted the characterize_if_changed method being called; which
|
|
553
|
+
# enqueued a job for characterizing
|
|
554
|
+
@file.stub(:save)
|
|
550
555
|
@file.characterize
|
|
551
556
|
doc = Nokogiri::XML.parse(@file.characterization.content)
|
|
552
557
|
doc.root.xpath('//ns:imageWidth/text()', {'ns'=>'http://hul.harvard.edu/ois/xml/ns/fits/fits_output'}).inner_text.should == '50'
|
data/spec/spec_helper.rb
CHANGED
|
@@ -19,11 +19,17 @@ $in_travis = !ENV['TRAVIS'].nil? && ENV['TRAVIS'] == 'true'
|
|
|
19
19
|
|
|
20
20
|
if $in_travis
|
|
21
21
|
# Monkey-patches the FITS runner to return the PDF FITS fixture
|
|
22
|
-
module Hydra
|
|
22
|
+
module Hydra
|
|
23
23
|
module Derivatives
|
|
24
24
|
module ExtractMetadata
|
|
25
|
-
def
|
|
26
|
-
|
|
25
|
+
def extract_metadata
|
|
26
|
+
return unless has_content?
|
|
27
|
+
Hydra::FileCharacterization.characterize(content, filename_for_characterization, :fits) do |config|
|
|
28
|
+
config[:fits] = lambda { |filename|
|
|
29
|
+
filename = File.expand_path("../fixtures/pdf_fits.xml", __FILE__)
|
|
30
|
+
File.read(filename)
|
|
31
|
+
}
|
|
32
|
+
end
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
end
|
|
@@ -65,4 +71,4 @@ module FactoryGirl
|
|
|
65
71
|
tmpl = FactoryGirl.build(handle)
|
|
66
72
|
tmpl.class.send("find_by_#{by}".to_sym, tmpl.send(by)) || FactoryGirl.create(handle)
|
|
67
73
|
end
|
|
68
|
-
end
|
|
74
|
+
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
class Batch < ActiveFedora::Base
|
|
2
|
-
include Hydra::
|
|
3
|
-
include Hydra::ModelMixins::RightsMetadata
|
|
2
|
+
include Hydra::AccessControls::Permissions
|
|
4
3
|
include Sufia::ModelMethods
|
|
5
4
|
include Sufia::Noid
|
|
6
5
|
|
|
@@ -9,10 +8,7 @@ class Batch < ActiveFedora::Base
|
|
|
9
8
|
belongs_to :user, :property => "creator"
|
|
10
9
|
has_many :generic_files, :property => :is_part_of
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
delegate :creator, :to => :descMetadata
|
|
14
|
-
delegate :part, :to => :descMetadata
|
|
15
|
-
delegate :status, :to => :descMetadata
|
|
11
|
+
has_attributes :title, :creator, :part, :status, datastream: :descMetadata, multiple: true
|
|
16
12
|
|
|
17
13
|
def self.find_or_create(pid)
|
|
18
14
|
begin
|
|
@@ -28,6 +28,7 @@ module Sufia
|
|
|
28
28
|
config.autoload_paths += %W(
|
|
29
29
|
#{config.root}/lib/sufia/models/jobs
|
|
30
30
|
#{config.root}/app/models/datastreams
|
|
31
|
+
#{config.root}/app/models/concerns
|
|
31
32
|
)
|
|
32
33
|
|
|
33
34
|
rake_tasks do
|
|
@@ -42,6 +43,7 @@ module Sufia
|
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
initializer 'requires' do
|
|
46
|
+
require 'activerecord-import'
|
|
45
47
|
require 'hydra/derivatives'
|
|
46
48
|
require 'sufia/models/model_methods'
|
|
47
49
|
require 'sufia/models/noid'
|
|
@@ -54,7 +56,6 @@ module Sufia
|
|
|
54
56
|
require 'sufia/models/generic_file/mime_types'
|
|
55
57
|
require 'sufia/models/generic_file/thumbnail'
|
|
56
58
|
require 'sufia/models/generic_file'
|
|
57
|
-
require 'sufia/models/user'
|
|
58
59
|
require 'sufia/models/user_local_directory_behavior'
|
|
59
60
|
require 'sufia/models/id_service'
|
|
60
61
|
require 'sufia/models/solr_document_behavior'
|
|
@@ -3,9 +3,9 @@ module Sufia
|
|
|
3
3
|
module Characterization
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
included do
|
|
6
|
-
has_metadata
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
has_metadata "characterization", :type => FitsDatastream
|
|
7
|
+
has_attributes :mime_type, datastream: :characterization, multiple: false
|
|
8
|
+
has_attributes :format_label, :file_size, :last_modified,
|
|
9
9
|
:filename, :original_checksum, :rights_basis,
|
|
10
10
|
:copyright_basis, :copyright_note,
|
|
11
11
|
:well_formed, :valid, :status_message,
|
|
@@ -20,7 +20,7 @@ module Sufia
|
|
|
20
20
|
:gps_timestamp, :latitude, :longitude,
|
|
21
21
|
:character_set, :markup_basis,
|
|
22
22
|
:markup_language, :duration, :bit_depth,
|
|
23
|
-
:sample_rate, :channels, :data_format, :offset
|
|
23
|
+
:sample_rate, :channels, :data_format, :offset, datastream: :characterization, multiple: true
|
|
24
24
|
|
|
25
25
|
end
|
|
26
26
|
|