hydra-core 10.0.2 → 10.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf418108dc7ef2c999d462beae784993deb8ba34
4
- data.tar.gz: 61515d84bc43ad0505fa3e4f37c8fd3ac234a8e5
3
+ metadata.gz: e4db5c43e5a0ac63927d082d58980a9402cdc1c4
4
+ data.tar.gz: d9e0725aa00fd1bb341b600ffc122b4f93b1a039
5
5
  SHA512:
6
- metadata.gz: a3cd4250ef891b4bfa604bc4ec328422e6eafe6dfa4ffea3f927136aa29903c90a4e9e2e977d34ada15763a5e3bdde51c924793e57ff9b9b7bb30c099cb21255
7
- data.tar.gz: 4eb5809a001a4f8a892c159e19f6851b40136520b4ab3c2c1e3eed918426a8fe04f9def02d0460dae1d0814dc93dc2d941d71e502905245d010ab77083a1b3d3
6
+ metadata.gz: f69bc9d11bd079d550c3023483e1e5a86304ff4712bd3d8b6dfc3945c064fb2ec0241447bef34baeee249be3ecfff3a54657208aa4993fb0fe0f216918e26d0e
7
+ data.tar.gz: 6ece1d5e44c0b69031b669de69b0821ef54804cdd1016890e97a2e8a79e0222d14928bcc5744ff7f8ed243fe8c29b6c9ba2e67c4835027144b5524079d5de3ff
@@ -87,8 +87,7 @@ module Hydra
87
87
  # render an HTTP HEAD response
88
88
  def content_head
89
89
  response.headers['Content-Length'] = file.size
90
- response.headers['Content-Type'] = file.mime_type
91
- head :ok
90
+ head :ok, content_type: file.mime_type
92
91
  end
93
92
 
94
93
  # render an HTTP Range response
@@ -10,12 +10,17 @@ module Hydra
10
10
  # @param [String, Array] display_type a value suggestive of a partial
11
11
  # @return [String] the name of the partial to render
12
12
  # @example
13
- # type_field_to_partial_name(["info:fedora/hull-cModel:genericContent"])
13
+ # type_field_to_partial_name(["GenericContent"])
14
14
  # => 'generic_content'
15
- # type_field_to_partial_name(["info:fedora/hull-cModel:text.pdf"])
15
+ # type_field_to_partial_name(["text.pdf"])
16
16
  # => 'text_pdf'
17
17
  def type_field_to_partial_name(document, display_type)
18
- Array(display_type).first.gsub(/^[^\/]+\/[^:]+:/,"").gsub("-","_").underscore.parameterize("_")
18
+ str = Array(display_type).join(' '.freeze).underscore
19
+ if Rails.version >= '5.0.0'
20
+ str.parameterize(separator: '_'.freeze)
21
+ else
22
+ str.parameterize('_'.freeze)
23
+ end
19
24
  end
20
25
  end
21
26
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.required_ruby_version = '>= 1.9.3'
20
20
 
21
- gem.add_dependency "rails", '~> 4.0'
21
+ gem.add_dependency "railties", '>= 4.0.0', '< 6'
22
22
  gem.add_dependency 'hydra-access-controls', version
23
23
 
24
24
  gem.add_development_dependency 'sqlite3', '~> 1.3'
@@ -1,3 +1,3 @@
1
1
  module HydraHead
2
- VERSION = "10.0.2"
2
+ VERSION = "10.1.0"
3
3
  end
@@ -96,8 +96,8 @@ describe CatalogController do
96
96
  end
97
97
  it "should convert it" do
98
98
  graph = RDF::Graph.new << RDF::Reader.for(:ntriples).new(response.body)
99
- title_statement = graph.query([nil, RDF::DC.title, nil]).first
100
- related_statement = graph.query([nil, RDF::DC.isReferencedBy, nil]).first
99
+ title_statement = graph.query([nil, RDF::Vocab::DC.title, nil]).first
100
+ related_statement = graph.query([nil, RDF::Vocab::DC.isReferencedBy, nil]).first
101
101
  expect(title_statement.subject).to eq RDF::URI("http://hydra.box/catalog/#{asset.id}")
102
102
  expect(related_statement.object).to eq RDF::URI("http://hydra.box/catalog/#{related.id}")
103
103
  end
@@ -74,7 +74,7 @@ describe DownloadsController do
74
74
  allow(ContentHolder).to receive(:default_file_path).and_return('buzz')
75
75
  get :show, id: obj
76
76
  expect(response).to be_successful
77
- expect(response.headers['Content-Type']).to eq "image/png"
77
+ expect(response.headers['Content-Type']).to start_with "image/png"
78
78
  expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"buzz.png\""
79
79
  expect(response.body).to eq 'fizz'
80
80
  end
@@ -83,7 +83,7 @@ describe DownloadsController do
83
83
  expect(DownloadsController.default_file_path).to eq "content"
84
84
  get :show, id: obj
85
85
  expect(response).to be_successful
86
- expect(response.headers['Content-Type']).to eq "image/png"
86
+ expect(response.headers['Content-Type']).to start_with "image/png"
87
87
  expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"world.png\""
88
88
  expect(response.body).to eq 'foobarfoobarfoobar'
89
89
  end
@@ -99,7 +99,7 @@ describe DownloadsController do
99
99
  it "should return it" do
100
100
  get :show, id: obj, file: "descMetadata"
101
101
  expect(response).to be_successful
102
- expect(response.headers['Content-Type']).to eq "text/plain"
102
+ expect(response.headers['Content-Type']).to start_with "text/plain"
103
103
  expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"metadata.xml\""
104
104
  expect(response.body).to eq "It's a stream"
105
105
  end
@@ -108,14 +108,14 @@ describe DownloadsController do
108
108
  it "should support setting disposition to inline" do
109
109
  get :show, id: obj, :disposition => "inline"
110
110
  expect(response).to be_successful
111
- expect(response.headers['Content-Type']).to eq "image/png"
111
+ expect(response.headers['Content-Type']).to start_with "image/png"
112
112
  expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"world.png\""
113
113
  expect(response.body).to eq 'foobarfoobarfoobar'
114
114
  end
115
115
  it "should allow you to specify filename for download" do
116
116
  get :show, id: obj, "filename" => "my%20dog.png"
117
117
  expect(response).to be_successful
118
- expect(response.headers['Content-Type']).to eq "image/png"
118
+ expect(response.headers['Content-Type']).to start_with "image/png"
119
119
  expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"my%20dog.png\""
120
120
  expect(response.body).to eq 'foobarfoobarfoobar'
121
121
  end
@@ -128,37 +128,42 @@ describe DownloadsController do
128
128
  parent.save!
129
129
  expect(controller).to receive(:authorize!).with(:download, instance_of(ActiveFedora::File)).and_return(true)
130
130
  end
131
+
131
132
  it "head request" do
132
133
  request.env["HTTP_RANGE"] = 'bytes=0-15'
133
134
  head :show, id: parent, file: 'webm'
134
135
  expect(response.headers['Content-Length']).to eq 16
135
136
  expect(response.headers['Accept-Ranges']).to eq 'bytes'
136
- expect(response.headers['Content-Type']).to eq 'video/webm'
137
+ expect(response.headers['Content-Type']).to start_with 'video/webm'
137
138
  end
138
- it "should send the whole thing" do
139
+
140
+ it "sends the whole thing" do
139
141
  request.env["HTTP_RANGE"] = 'bytes=0-15'
140
142
  get :show, id: '1234', file: 'webm'
141
143
  expect(response.body).to eq 'one1two2threfour'
142
144
  expect(response.headers["Content-Range"]).to eq 'bytes 0-15/16'
143
145
  expect(response.headers["Content-Length"]).to eq '16'
144
146
  expect(response.headers['Accept-Ranges']).to eq 'bytes'
145
- expect(response.headers['Content-Type']).to eq "video/webm"
147
+ expect(response.headers['Content-Type']).to start_with "video/webm"
146
148
  expect(response.headers["Content-Disposition"]).to eq "inline; filename=\"MyVideo.webm\""
147
149
  expect(response.status).to eq 206
148
150
  end
149
- it "should send the whole thing when the range is open ended" do
151
+
152
+ it "sends the whole thing when the range is open ended" do
150
153
  request.env["HTTP_RANGE"] = 'bytes=0-'
151
154
  get :show, id: '1234', file: 'webm'
152
155
  expect(response.body).to eq 'one1two2threfour'
153
156
  end
154
- it "should get a range not starting at the beginning" do
157
+
158
+ it "gets a range not starting at the beginning" do
155
159
  request.env["HTTP_RANGE"] = 'bytes=3-15'
156
160
  get :show, id: '1234', file: 'webm'
157
161
  expect(response.body).to eq '1two2threfour'
158
162
  expect(response.headers["Content-Range"]).to eq 'bytes 3-15/16'
159
163
  expect(response.headers["Content-Length"]).to eq '13'
160
164
  end
161
- it "should get a range not ending at the end" do
165
+
166
+ it "gets a range not ending at the end" do
162
167
  request.env["HTTP_RANGE"] = 'bytes=4-11'
163
168
  get :show, id: '1234', file: 'webm'
164
169
  expect(response.body).to eq 'two2thre'
@@ -14,20 +14,20 @@ describe BlacklightHelper do
14
14
  allow(helper).to receive(:blacklight_config).and_return(config)
15
15
  end
16
16
 
17
- it "should lop off everything before the first colin after the slash" do
18
- expect(helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:Presentation"])).to eq "presentation"
19
- expect(helper.document_partial_name('has_model_s' => ["info:fedora/hull-cModel:genericContent"])).to eq "generic_content"
17
+ it "changes camel case to underscored lowercase" do
18
+ expect(helper.document_partial_name('has_model_s' => ["Presentation"])).to eq "presentation"
19
+ expect(helper.document_partial_name('has_model_s' => ["GenericContent"])).to eq "generic_content"
20
20
  end
21
21
 
22
22
  context "with a single valued field" do
23
- let(:field_name) { 'active_fedora_model_ssi' }
23
+ let(:field_name) { 'has_model_s' }
24
24
  it "should support single valued fields" do
25
- expect(helper.document_partial_name('active_fedora_model_ssi' => "Chicken")).to eq "chicken"
25
+ expect(helper.document_partial_name('has_model_s' => "Chicken")).to eq "chicken"
26
26
  end
27
27
  end
28
28
 
29
- it "should handle periods" do
30
- expect(helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:text.PDF"])).to eq "text_pdf"
29
+ it "handles periods" do
30
+ expect(helper.document_partial_name('has_model_s' => ["text.PDF"])).to eq "text_pdf"
31
31
  end
32
32
  end
33
33
  end
@@ -20,7 +20,7 @@ ActiveFedora::Base.logger = Logger.new(STDOUT)
20
20
 
21
21
  require 'active_fedora/cleaner'
22
22
  RSpec.configure do |config|
23
- config.include Devise::TestHelpers, type: :controller
23
+ config.include Devise::Test::ControllerHelpers, type: :controller
24
24
  config.use_transactional_fixtures = true
25
25
  config.infer_spec_type_from_file_location!
26
26
 
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: 10.0.2
4
+ version: 10.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
@@ -9,36 +9,42 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-12 00:00:00.000000000 Z
12
+ date: 2016-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
15
+ name: railties
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 4.0.0
21
+ - - "<"
19
22
  - !ruby/object:Gem::Version
20
- version: '4.0'
23
+ version: '6'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: 4.0.0
31
+ - - "<"
26
32
  - !ruby/object:Gem::Version
27
- version: '4.0'
33
+ version: '6'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: hydra-access-controls
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
38
  - - '='
33
39
  - !ruby/object:Gem::Version
34
- version: 10.0.2
40
+ version: 10.1.0
35
41
  type: :runtime
36
42
  prerelease: false
37
43
  version_requirements: !ruby/object:Gem::Requirement
38
44
  requirements:
39
45
  - - '='
40
46
  - !ruby/object:Gem::Version
41
- version: 10.0.2
47
+ version: 10.1.0
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: sqlite3
44
50
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +158,6 @@ files:
152
158
  - spec/support/db/migrate/20111101221803_create_searches.rb
153
159
  - spec/support/matchers/helper_matcher.rb
154
160
  - spec/support/matchers/solr_matchers.rb
155
- - spec/test_app_templates/Gemfile.extra
156
161
  - spec/unit/hydra-head-engine_spec.rb
157
162
  - spec/unit/hydra-head_spec.rb
158
163
  homepage: http://projecthydra.org
@@ -198,7 +203,5 @@ test_files:
198
203
  - spec/support/db/migrate/20111101221803_create_searches.rb
199
204
  - spec/support/matchers/helper_matcher.rb
200
205
  - spec/support/matchers/solr_matchers.rb
201
- - spec/test_app_templates/Gemfile.extra
202
206
  - spec/unit/hydra-head-engine_spec.rb
203
207
  - spec/unit/hydra-head_spec.rb
204
- has_rdoc:
@@ -1,6 +0,0 @@
1
- gem 'rspec-rails', '~> 3.1', group: :test
2
- gem 'rspec-its'
3
- gem 'byebug' unless ENV['CI']
4
-
5
- gem 'rails', ENV.fetch('RAILS_VERSION', '4.2.6')
6
- gem 'blacklight', ENV.fetch('BLACKLIGHT_VERSION', '6.0.0')