hydra-core 5.0.0.pre15 → 5.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/hydra/blacklight_helper_behavior.rb +0 -4
- data/hydra-core.gemspec +2 -2
- data/lib/hydra-head/version.rb +1 -1
- data/lib/hydra/controller/controller_behavior.rb +0 -1
- data/lib/hydra/controller/repository_controller_behavior.rb +13 -1
- data/lib/hydra/model_methods.rb +4 -1
- data/spec/controllers/catalog_valid_html_spec.rb +6 -32
- data/spec/lib/model_methods_spec.rb +5 -0
- data/spec/lib/repository_controller_behavior_spec.rb +2 -0
- data/tasks/rspec.rake +1 -2
- metadata +8 -8
@@ -2,10 +2,6 @@ module Hydra
|
|
2
2
|
module BlacklightHelperBehavior
|
3
3
|
include Blacklight::BlacklightHelperBehavior
|
4
4
|
|
5
|
-
def document_partial_path_templates
|
6
|
-
["%2$s/%1$s"] + super
|
7
|
-
end
|
8
|
-
|
9
5
|
# Given a Fedora uri, generate a reasonable partial name
|
10
6
|
def document_partial_name(document)
|
11
7
|
display_type = document[blacklight_config.show.display_type]
|
data/hydra-core.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
|
22
22
|
gem.add_dependency "rails", '~>3.2.3'
|
23
|
-
gem.add_dependency "blacklight", '~> 4.0.0
|
23
|
+
gem.add_dependency "blacklight", '~> 4.0.0'
|
24
24
|
gem.add_dependency "devise"
|
25
|
-
gem.add_dependency "active-fedora", '~> 5.0.0
|
25
|
+
gem.add_dependency "active-fedora", '~> 5.0.0'
|
26
26
|
gem.add_dependency 'RedCloth', '=4.2.9'
|
27
27
|
gem.add_dependency 'block_helpers'
|
28
28
|
gem.add_dependency 'sanitize'
|
data/lib/hydra-head/version.rb
CHANGED
@@ -14,7 +14,6 @@ module Hydra::Controller::ControllerBehavior
|
|
14
14
|
included do
|
15
15
|
# Other modules to auto-include
|
16
16
|
include Hydra::AccessControlsEnforcement
|
17
|
-
include Hydra::Controller::RepositoryControllerBehavior
|
18
17
|
|
19
18
|
# Catch permission errors
|
20
19
|
rescue_from Hydra::AccessDenied do |exception|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# Hydra::RepositoryContollerBehavior is a controller layer mixin. It is in the controller scope: request params, session etc.
|
2
2
|
#
|
3
3
|
module Hydra::Controller::RepositoryControllerBehavior
|
4
|
+
extend Deprecation
|
5
|
+
self.deprecation_horizon = "hydra-access-controls 6.0"
|
4
6
|
|
5
7
|
# TODO, move these to a helper file.
|
6
8
|
def self.included(c)
|
@@ -14,20 +16,24 @@ module Hydra::Controller::RepositoryControllerBehavior
|
|
14
16
|
#
|
15
17
|
# This method converts pid strings into xhtml safe IDs, since xhmlt expects namespaces to be defined.
|
16
18
|
# I.E. hydrus:123 = hydrus_123
|
19
|
+
# @deprecated
|
17
20
|
def format_pid(pid)
|
18
21
|
pid.gsub(":", "_")
|
19
22
|
end
|
23
|
+
deprecation_deprecate :format_pid
|
20
24
|
|
21
25
|
|
22
|
-
|
26
|
+
# @deprecated
|
23
27
|
def solr_name(field_name, field_type = :text)
|
24
28
|
::ActiveFedora::SolrService.solr_name(field_name, field_type)
|
25
29
|
end
|
30
|
+
deprecation_deprecate :solr_name
|
26
31
|
|
27
32
|
|
28
33
|
# Returns a list of datastreams for download.
|
29
34
|
# Uses user's roles and "mime_type" value in submitted params to decide what to return.
|
30
35
|
# if you pass the optional argument of :canonical=>true, it will return the canonical datastream for this object (a single object not a hash of datastreams)
|
36
|
+
# @deprecated
|
31
37
|
def downloadables(fedora_object=@fedora_object, opts={})
|
32
38
|
if opts[:canonical]
|
33
39
|
mime_type = opts[:mime_type] ? opts[:mime_type] : "application/pdf"
|
@@ -57,14 +63,20 @@ module Hydra::Controller::RepositoryControllerBehavior
|
|
57
63
|
# puts "downloadables result: #{result}"
|
58
64
|
return result
|
59
65
|
end
|
66
|
+
deprecation_deprecate :downloadables
|
60
67
|
|
61
68
|
protected
|
69
|
+
|
70
|
+
# @deprecated
|
62
71
|
def load_document
|
63
72
|
@document = ActiveFedora::Base.find(params[:id], :cast=>true)
|
64
73
|
end
|
74
|
+
deprecation_deprecate :load_document
|
65
75
|
|
66
76
|
private
|
67
77
|
|
78
|
+
|
79
|
+
# @deprecated
|
68
80
|
def filter_datastreams_for_mime_type(datastreams_hash, mime_type)
|
69
81
|
result = Hash[]
|
70
82
|
datastreams_hash.each_pair do |dsid,ds|
|
data/lib/hydra/model_methods.rb
CHANGED
@@ -11,10 +11,13 @@ module Hydra::ModelMethods
|
|
11
11
|
#
|
12
12
|
# Adds metadata about the depositor to the asset
|
13
13
|
# Most important behavior: if the asset has a rightsMetadata datastream, this method will add +depositor_id+ to its individual edit permissions.
|
14
|
+
# @param [String, #user_key] depositor
|
14
15
|
#
|
15
|
-
def apply_depositor_metadata(
|
16
|
+
def apply_depositor_metadata(depositor)
|
16
17
|
prop_ds = self.datastreams["properties"]
|
17
18
|
rights_ds = self.datastreams["rightsMetadata"]
|
19
|
+
|
20
|
+
depositor_id = depositor.respond_to?(:user_key) ? depositor.user_key : depositor
|
18
21
|
|
19
22
|
if prop_ds
|
20
23
|
prop_ds.depositor = depositor_id unless prop_ds.nil?
|
@@ -53,48 +53,22 @@ describe CatalogController do
|
|
53
53
|
sign_in mock_user
|
54
54
|
end
|
55
55
|
|
56
|
-
#Article Data Type
|
57
|
-
it "Should have valid html when in Article Edit Show" do
|
58
|
-
controller.session[:viewing_context] = "edit"
|
59
|
-
get(:show, {:id=>"hydrangea:fixture_mods_article1"}, :action=>"edit")
|
60
|
-
document_check(response.body)
|
61
|
-
end
|
62
|
-
|
63
56
|
it "Should have valid html when in Article Browse Show" do
|
64
|
-
|
65
|
-
controller.session[:viewing_context] = "browse"
|
66
|
-
get(:show, {:id=>"hydrangea:fixture_mods_article1"}, :action=>"browse")
|
57
|
+
get(:show, {:id=>"hydrangea:fixture_mods_article1"})
|
67
58
|
document_check(response.body)
|
68
59
|
end
|
69
60
|
|
70
|
-
|
71
|
-
|
72
|
-
controller.session[:viewing_context] = "edit"
|
73
|
-
get(:show, {:id=>"hydrangea:fixture_mods_dataset1"}, :action=>"edit")
|
61
|
+
it "Should have valid html when in Dataset Browse Show" do
|
62
|
+
get(:show, {:id=>"hydrangea:fixture_mods_dataset1"})
|
74
63
|
document_check(response.body)
|
75
64
|
end
|
76
65
|
|
77
66
|
it "Should have valid html when in Dataset Browse Show" do
|
78
|
-
|
79
|
-
|
80
|
-
|
67
|
+
get(:show, {:id=>"hydrus:admin_class1"})
|
68
|
+
File.open('/tmp/out.xml', 'w') { |f| f << response.body }
|
69
|
+
document_check(response.body)
|
81
70
|
end
|
82
71
|
|
83
|
-
#APO datatype hydrus:admin_class1
|
84
|
-
it "Should have valid html when in Dataset Edit Show" do
|
85
|
-
controller.session[:viewing_context] = "edit"
|
86
|
-
get(:show, {:id=>"hydrus:admin_class1"}, :action=>"edit")
|
87
|
-
document_check(response.body)
|
88
|
-
end
|
89
|
-
|
90
|
-
it "Should have valid html when in Dataset Browse Show" do
|
91
|
-
controller.session[:viewing_context] = "browse"
|
92
|
-
get(:show, {:id=>"hydrus:admin_class1"}, :action=>"browse")
|
93
|
-
File.open('/tmp/out.xml', 'w') { |f| f << response.body }
|
94
|
-
document_check(response.body)
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
72
|
# The delete view should be the same for all data types
|
99
73
|
it "Should have valid html when in Dataset Delete" do
|
100
74
|
get(:show, {:id=>"hydrangea:fixture_mods_dataset1"}, :action=>"delete")
|
@@ -25,5 +25,10 @@ describe Hydra::ModelMethods do
|
|
25
25
|
subject.apply_depositor_metadata('chris')
|
26
26
|
subject.properties.depositor.should == ['chris']
|
27
27
|
end
|
28
|
+
it "should accept objects that respond_to? :user_key" do
|
29
|
+
stub_user = stub(:user, :user_key=>'monty')
|
30
|
+
subject.apply_depositor_metadata(stub_user)
|
31
|
+
subject.properties.depositor.should == ['monty']
|
32
|
+
end
|
28
33
|
end
|
29
34
|
end
|
@@ -11,6 +11,7 @@ describe Hydra::Controller::RepositoryControllerBehavior do
|
|
11
11
|
|
12
12
|
describe "load_document" do
|
13
13
|
it "should load the model for the pid" do
|
14
|
+
Deprecation.stub(:warn)
|
14
15
|
mock_model = mock("model")
|
15
16
|
subject.stub(:params).and_return( {:id => "object id"} )
|
16
17
|
ActiveFedora::Base.should_receive(:find).with("object id", :cast=>true).and_return(mock_model)
|
@@ -20,6 +21,7 @@ describe Hydra::Controller::RepositoryControllerBehavior do
|
|
20
21
|
|
21
22
|
describe "format_pid" do
|
22
23
|
it "convert pids into XHTML safe strings" do
|
24
|
+
Deprecation.stub(:warn)
|
23
25
|
pid = subject.format_pid("hydra:123")
|
24
26
|
pid.should match(/hydra_123/)
|
25
27
|
end
|
data/tasks/rspec.rake
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
ENV["RAILS_ROOT"] ||= 'spec/internal'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
2
|
|
5
3
|
desc "Run specs"
|
6
4
|
task :spec => [:generate, :fixtures] do |t|
|
7
5
|
Bundler.with_clean_env do
|
8
6
|
within_test_app do
|
9
7
|
system "rake myspec"
|
8
|
+
abort "Error running hydra-core" unless $?.success?
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.rc1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-12-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
requirements:
|
36
36
|
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: 4.0.0
|
38
|
+
version: 4.0.0
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 4.0.0
|
46
|
+
version: 4.0.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: devise
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
requirements:
|
68
68
|
- - ~>
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 5.0.0
|
70
|
+
version: 5.0.0
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
requirements:
|
76
76
|
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 5.0.0
|
78
|
+
version: 5.0.0
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
80
|
name: RedCloth
|
81
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
requirements:
|
180
180
|
- - '='
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: 5.0.0.
|
182
|
+
version: 5.0.0.rc1
|
183
183
|
type: :runtime
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -187,7 +187,7 @@ dependencies:
|
|
187
187
|
requirements:
|
188
188
|
- - '='
|
189
189
|
- !ruby/object:Gem::Version
|
190
|
-
version: 5.0.0.
|
190
|
+
version: 5.0.0.rc1
|
191
191
|
- !ruby/object:Gem::Dependency
|
192
192
|
name: sqlite3
|
193
193
|
requirement: !ruby/object:Gem::Requirement
|