fcrepo_admin 0.5.4 → 0.5.5.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 846f4e519831674baf94f1db10f8c40196136d58
4
- data.tar.gz: 643de27ff77646f00ab3fde0b5d73e3a79da4157
3
+ metadata.gz: c10e6b3628d01fdcc937e5c5c12e4704d2e06622
4
+ data.tar.gz: 554f2f1bad6bb56761a5968bc049a6b6c36d21bf
5
5
  SHA512:
6
- metadata.gz: c2f5c11df23df0a4fc79ee771e95fa1a3537189d7c6532cc32feb11554524815b191a484ff0bb5e5b252a7ae3e61c3fc4531553d7cdf8e0890e26cbdf24b6b06
7
- data.tar.gz: 045a7e428c0932f767175815aea618456879a57dbd7453894bf3c6e60bca27b041bf0f0a7ecd83e600c5618a597a9ff338995a1c0f71c66c3432e6126188969a
6
+ metadata.gz: ec451e2d153537b2a865ac90faa40cc6eacf3ad6cc339a4ee6e4c17201ce913fe5a36e6bc0b4a058cbb5c234462902a2c967b58c47bc4948265c41b17e302248
7
+ data.tar.gz: c9a962d12ad4f1b85ae5b8d7c3fe8fa8c58a7b45a6f873121fcbf92b44575b0f4e854f42b8fea7ca8bcc1e0c84597851f30e743d6a8af8785177d78895755620
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /.bundle
2
2
  Gemfile.lock
3
+ jetty
3
4
  pkg
4
5
  spec/internal/db/*.sqlite3
5
6
  spec/internal/log/*.log
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ script: "rake fcrepo_admin:ci"
data/HISTORY.md CHANGED
@@ -1,3 +1,9 @@
1
+ #### 0.5.5 (2013-06-07)
2
+
3
+ * Upgraded Rubydora to version 1.6.5 (for Rubydora::DigitalObject#object_xml)
4
+ * Datastream downloads now routed through FcrpeoAdmin::DownloadController, which uses Hydra::Controller::DownloadBehavior.
5
+ * Added fcrepo_admin:ci rake task for CI build and hooked into Travis.
6
+
1
7
  #### 0.5.4 (2013-05-24)
2
8
 
3
9
  * Changed config setting `associated_objects_sort_param` (v0.5.3) to `association_collection_query_sort_param`.
data/README.md CHANGED
@@ -4,6 +4,8 @@ A Rails engine providing an administrative interface to a Fedora Commons reposit
4
4
 
5
5
  ### Status
6
6
 
7
+ [![Build Status](https://travis-ci.org/projecthydra/fcrepo-admin.png?branch=master)](https://travis-ci.org/projecthydra/fcrepo-admin)
8
+
7
9
  This project should be considered *experimental*. Versions earlier than 1.0 may change API and/or UI without notice
8
10
  or regard for backward compatibility.
9
11
 
@@ -182,7 +184,7 @@ end
182
184
 
183
185
  #### Associations
184
186
 
185
- Due to issues with Rails partials and relative paths, in order to use Blacklight's default document index view behavior
187
+ Due to the way Rails resolves relative paths to partials, in order to use Blacklight's default document index view behavior
186
188
  on the associations show page and avoid missing template errors, fcrepo_admin provides a custom document partial at
187
189
  `fcrepo_admin/catalog/document` that renders the partial at `catalog/document`, for which Blacklight provides a default.
188
190
  If you have a custom document partial at a different path that you want to use for the document list on the associations
@@ -196,6 +198,14 @@ this content in that file:
196
198
  replacing the partial path as appropriate. If anyone has a better solution or knows of a way to avoid providing the
197
199
  document partial in fcrepo_admin admin, please submit a pull request.
198
200
 
201
+ #### Blacklight document actions
202
+
203
+ Blacklight's default show page for a document (i.e., Solr document for, in this case, an ActiveFedora object) includes a menu
204
+ of actions, including a bookmark function. In order to provide the most flexible interface with a focus on repository "administrative"
205
+ functions, we have not included this content in the default fcrepo_admin views. However, since the fcrepo_admin object show view
206
+ includes the Solr document in its context, you could re-add this functionality by overriding the default template at
207
+ `fcrepo_admin/objects/show.html.erb` or by overriding the catalog show partial which that views renders.
208
+
199
209
  #### Read-only mode
200
210
 
201
211
  To suppress mutating behaviors (i.e, routes, nav items, etc.) regardless of user permissions,
data/Rakefile CHANGED
@@ -6,6 +6,9 @@ rescue LoadError
6
6
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
7
  end
8
8
 
9
+ require 'jettywrapper'
10
+
11
+ ENGINE_PATH = File.dirname(__FILE__)
9
12
  APP_RAKEFILE = File.expand_path("../spec/internal/Rakefile", __FILE__)
10
13
  load 'rails/tasks/engine.rake'
11
14
 
@@ -1,5 +1,3 @@
1
- require 'mime/types'
2
-
3
1
  module FcrepoAdmin
4
2
  class DatastreamsController < ApplicationController
5
3
 
@@ -26,12 +24,6 @@ module FcrepoAdmin
26
24
  def history
27
25
  end
28
26
 
29
- def download
30
- # XXX Replace with Hydra download behavior?
31
- mimetypes = MIME::Types[@datastream.mimeType]
32
- send_data @datastream.content, :disposition => 'attachment', :type => @datastream.mimeType, :filename => "#{@datastream.pid.sub(/:/, '_')}_#{@datastream.dsid}.#{mimetypes.first.extensions.first}"
33
- end
34
-
35
27
  def edit
36
28
  unless @datastream.content_is_editable?
37
29
  render :text => "Datastream content is not editable", :status => 403
@@ -0,0 +1,30 @@
1
+ require 'mime/types'
2
+
3
+ module FcrepoAdmin
4
+ class DownloadController < ApplicationController
5
+
6
+ include Hydra::Controller::DownloadBehavior
7
+
8
+ protected
9
+
10
+ def load_asset
11
+ @asset = ActiveFedora::Base.load_instance_from_solr(params[:object_id])
12
+ end
13
+
14
+ def datastream_to_show
15
+ asset.datastreams[params[:id]]
16
+ end
17
+
18
+ # Pattern: pid__dsid.ext (replacing colon in pid with underscore)
19
+ def datastream_name
20
+ "#{datastream.pid.sub(/:/, '_')}__#{datastream.dsid}.#{datastream_extension}"
21
+ end
22
+
23
+ private
24
+
25
+ def datastream_extension
26
+ MIME::Types[datastream.mimeType].first.extensions.first rescue 'bin'
27
+ end
28
+
29
+ end
30
+ end
@@ -1,10 +1,5 @@
1
- <div class="document row">
2
- <div class="span7">
3
- <%= render :partial => 'catalog/show_default', :locals => {:document => @document} %>
4
- </div>
5
- <div class="span2">
6
- <%= render_show_doc_actions @document %>
7
- </div>
1
+ <div class="document">
2
+ <%= render_document_partial @document, :show %>
8
3
  </div>
9
4
  <div class="row">
10
5
  <div class="span5">
@@ -14,7 +14,7 @@ FcrepoAdmin::Engine.routes.draw do
14
14
  member do
15
15
  get 'content'
16
16
  get 'upload' unless FcrepoAdmin.read_only
17
- get 'download'
17
+ get 'download' => 'download#show'
18
18
  get 'history'
19
19
  end
20
20
  end
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.require_paths = ["lib"]
26
26
 
27
+ s.add_dependency "rubydora", ">= 1.6.5"
27
28
  s.add_dependency "hydra-head", "~> 6.0"
28
29
  s.add_dependency "active-fedora", "~> 6.1"
29
30
  s.add_dependency "blacklight"
@@ -29,8 +29,7 @@ ActiveFedora::Base.class_eval do
29
29
  end
30
30
 
31
31
  def object_xml
32
- # XXX https://github.com/projecthydra/rubydora/pull/26
33
- inner_object.repository.object_xml(:pid => pid)
32
+ inner_object.object_xml
34
33
  end
35
34
 
36
35
  end
@@ -17,7 +17,7 @@ module FcrepoAdmin::Helpers
17
17
  end
18
18
  end
19
19
 
20
- # We attempt to use Blacklight's #paginate_rsolr_response, but it causes a routing error
20
+ # We attempted to use Blacklight's #paginate_rsolr_response, but it causes a routing error
21
21
  # b/c Kaminari as of version 0.14.1 cannot handle namespace-prefixed routes.
22
22
  # The fallback rendering bypasses Kaminari, but doesn't look so good on a large page set.
23
23
  # See https://github.com/amatsuda/kaminari/pull/322.
@@ -1,7 +1,7 @@
1
1
  module FcrepoAdmin::Helpers
2
2
  module BlacklightHelperBehavior
3
3
 
4
- def link_to_document(doc, opts={:label=>nil, :counter => nil, :results_view => true})
4
+ def link_to_document(doc, opts = {:label => nil, :counter => nil, :results_view => true})
5
5
  opts[:label] ||= blacklight_config.index.show_link.to_sym
6
6
  label = render_document_index_label doc, opts
7
7
  link_to label, fcrepo_admin.object_path(doc.id)
@@ -1,3 +1,3 @@
1
1
  module FcrepoAdmin
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5.pre"
3
3
  end
@@ -17,10 +17,6 @@ describe FcrepoAdmin::DatastreamsController do
17
17
  response.should render_template(:content)
18
18
  end
19
19
  end
20
- context "#download" do
21
- subject { get :download, :object_id => object, :id => object.descMetadata, :use_route => 'fcrepo_admin' }
22
- it { should be_successful }
23
- end
24
20
  context "change methods" do
25
21
  let(:user) { FactoryGirl.create(:user) }
26
22
  before do
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe FcrepoAdmin::DownloadController do
4
+ let(:object) { FactoryGirl.create(:item) }
5
+ after { object.delete }
6
+ context "#show" do
7
+ it "should have the right content and headers" do
8
+ get :show, :object_id => object.pid, :id => object.descMetadata, :use_route => 'fcrepo_admin'
9
+ response.headers['Content-Disposition'].should == "inline; filename=\"#{object.pid.sub(/:/, '_')}__descMetadata.xml\""
10
+ end
11
+ end
12
+ end
@@ -1,22 +1,30 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe FcrepoAdmin::ObjectsController do
4
- let!(:object) { FactoryGirl.create(:item) }
5
- after { object.delete }
4
+ before { @object = FactoryGirl.create(:item) }
5
+ after { @object.delete }
6
6
  context "#show" do
7
- subject { get :show, :id => object, :use_route => 'fcrepo_admin' }
8
- it { should render_template(:show) }
7
+ context "html format" do
8
+ subject { get :show, :id => @object, :use_route => 'fcrepo_admin' }
9
+ it { should render_template(:show) }
10
+ end
11
+ context "xml format" do
12
+ subject { get :show, :id => @object.pid, :format => 'xml', :use_route => 'fcrepo_admin' }
13
+ its(:body) { should eq(@object.object_xml) }
14
+ end
9
15
  end
10
16
  context "#audit_trail" do
11
- subject { get :audit_trail, :id => object, :use_route => 'fcrepo_admin' }
12
- it { should render_template(:audit_trail) }
13
- end
14
- context "#audit_trail?download=true" do
15
- subject { get :audit_trail, :id => object, :download => 'true', :use_route => 'fcrepo_admin' }
16
- its(:response_code) { should eq(200) }
17
+ context "html format" do
18
+ subject { get :audit_trail, :id => @object, :use_route => 'fcrepo_admin' }
19
+ it { should render_template(:audit_trail) }
20
+ end
21
+ context "xml format" do
22
+ subject { get :audit_trail, :id => @object.pid, :format => 'xml', :use_route => 'fcrepo_admin' }
23
+ its(:body) { should eq(@object.audit_trail.to_xml) }
24
+ end
17
25
  end
18
26
  context "#permissions" do
19
- subject { get :permissions, :id => object, :use_route => 'fcrepo_admin' }
27
+ subject { get :permissions, :id => @object, :use_route => 'fcrepo_admin' }
20
28
  it { should render_template(:permissions) }
21
29
  end
22
30
  end
@@ -2,6 +2,8 @@
2
2
  # Add your own tasks in files placed in lib/tasks ending in .rake,
3
3
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
4
 
5
+ require 'jettywrapper'
6
+
5
7
  require File.expand_path('../config/application', __FILE__)
6
8
 
7
9
  Dummy::Application.load_tasks
File without changes
@@ -1,4 +1,15 @@
1
1
  namespace :fcrepo_admin do
2
+ desc "CI Build"
3
+ task :ci do
4
+ ENV['environment'] = "test"
5
+ Rake::Task["jetty:clean"].invoke
6
+ jetty_params = Jettywrapper.load_config
7
+ jetty_params[:startup_wait] = 60
8
+ jetty_params[:jetty_home] = File.expand_path(File.dirname(__FILE__) + '/../jetty')
9
+ Jettywrapper.wrap(jetty_params) do
10
+ Rake::Task['spec'].invoke
11
+ end
12
+ end
2
13
  namespace :solr do
3
14
  desc "Deletes everything from the Solr index"
4
15
  task :clean => :environment do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcrepo_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chandek-Stark
@@ -11,8 +11,22 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-05-24 00:00:00.000000000 Z
14
+ date: 2013-06-07 00:00:00.000000000 Z
15
15
  dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rubydora
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.6.5
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.6.5
16
30
  - !ruby/object:Gem::Dependency
17
31
  name: hydra-head
18
32
  requirement: !ruby/object:Gem::Requirement
@@ -236,6 +250,7 @@ extra_rdoc_files:
236
250
  files:
237
251
  - .gitignore
238
252
  - .rspec
253
+ - .travis.yml
239
254
  - Gemfile
240
255
  - HISTORY.md
241
256
  - LICENSE
@@ -243,6 +258,7 @@ files:
243
258
  - Rakefile
244
259
  - app/controllers/fcrepo_admin/associations_controller.rb
245
260
  - app/controllers/fcrepo_admin/datastreams_controller.rb
261
+ - app/controllers/fcrepo_admin/download_controller.rb
246
262
  - app/controllers/fcrepo_admin/objects_controller.rb
247
263
  - app/helpers/fcrepo_admin/associations_helper.rb
248
264
  - app/helpers/fcrepo_admin/datastreams_helper.rb
@@ -298,10 +314,9 @@ files:
298
314
  - lib/fcrepo_admin/helpers/objects_helper_behavior.rb
299
315
  - lib/fcrepo_admin/solr_document_extension.rb
300
316
  - lib/fcrepo_admin/version.rb
301
- - lib/tasks/.gitkeep
302
- - lib/tasks/fcrepo_admin.rake
303
317
  - spec/controllers/associations_controller_spec.rb
304
318
  - spec/controllers/datastreams_controller_spec.rb
319
+ - spec/controllers/download_controller_spec.rb
305
320
  - spec/controllers/objects_controller_spec.rb
306
321
  - spec/factories/fcrepo_admin_factories.rb
307
322
  - spec/factories/user_factories.rb
@@ -368,6 +383,8 @@ files:
368
383
  - spec/internal/spec/fixtures/files/descMetadata.xml
369
384
  - spec/internal/spec/fixtures/files/hydra.jpg
370
385
  - spec/spec_helper.rb
386
+ - tasks/.gitkeep
387
+ - tasks/fcrepo_admin.rake
371
388
  homepage: http://projecthydra.org
372
389
  licenses:
373
390
  - BSD Simplified
@@ -383,9 +400,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
383
400
  version: 1.9.3
384
401
  required_rubygems_version: !ruby/object:Gem::Requirement
385
402
  requirements:
386
- - - '>='
403
+ - - '>'
387
404
  - !ruby/object:Gem::Version
388
- version: '0'
405
+ version: 1.3.1
389
406
  requirements: []
390
407
  rubyforge_project:
391
408
  rubygems_version: 2.0.3
@@ -395,6 +412,7 @@ summary: Hydra-based Fedora Commons repository admin tool.
395
412
  test_files:
396
413
  - spec/controllers/associations_controller_spec.rb
397
414
  - spec/controllers/datastreams_controller_spec.rb
415
+ - spec/controllers/download_controller_spec.rb
398
416
  - spec/controllers/objects_controller_spec.rb
399
417
  - spec/factories/fcrepo_admin_factories.rb
400
418
  - spec/factories/user_factories.rb