-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d190caf
Showing
646 changed files
with
36,211 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
log/*.log | ||
tmp/* | ||
db/*.sqlite3 | ||
coverage/* | ||
coverage.data | ||
public/workspace/* | ||
public/workspace | ||
workspace/* | ||
.bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rvm use 1.8.7@eems --create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Copyright (c) 2011. The Board of Trustees of the Leland Stanford Junior University. All rights reserved. | ||
|
||
Redistribution and use of this distribution in source and binary forms, with or without modification, are permitted | ||
provided that: The above copyright notice and this permission notice appear in all copies and supporting documentation; | ||
The name, identifiers, and trademarks of The Board of Trustees of the Leland Stanford Junior University are not used in | ||
advertising or publicity without the express prior written permission of The Board of Trustees of the Leland Stanford | ||
Junior University; Recipients acknowledge that this distribution is made available as a research courtesy, "as is", | ||
potentially with defects, without any obligation on the part of The Board of Trustees of the Leland Stanford Junior | ||
University to provide support, services, or repair; | ||
|
||
THE BOARD OF TRUSTEES OF THE LELAND STANFORD JUNIOR UNIVERSITY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD | ||
TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE, AND IN NO EVENT SHALL THE BOARD OF TRUSTEES OF THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY SPECIAL, | ||
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH | ||
THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
source "http://rubygems.org" | ||
|
||
gem 'active-fedora', '1.2.8' | ||
gem 'authlogic', '2.1.2' | ||
gem 'curb' | ||
gem 'delayed_job', '2.0.3' | ||
gem "facets", "2.8.4" | ||
gem 'json' | ||
gem "marc", "0.3.0" | ||
gem "rails", "2.3.10" | ||
gem "rsolr", "0.12.1" | ||
gem "rsolr-ext", "0.12.0" | ||
gem "sqlite3-ruby", "1.2.5" | ||
gem "will_paginate", "2.3.11" | ||
|
||
group :development do | ||
gem "awesome_print" | ||
gem "mongrel" | ||
gem "ruby-debug" | ||
end | ||
|
||
group :test do | ||
gem 'rcov' | ||
gem 'rspec-rails', "< 2.0" | ||
gem 'rspec', "< 2.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
actionmailer (2.3.10) | ||
actionpack (= 2.3.10) | ||
actionpack (2.3.10) | ||
activesupport (= 2.3.10) | ||
rack (~> 1.1.0) | ||
active-fedora (1.2.8) | ||
activeresource (< 3.0.0) | ||
mime-types (>= 1.16) | ||
multipart-post | ||
nokogiri | ||
om (>= 1.0) | ||
solr-ruby (>= 0.0.6) | ||
solrizer (>= 0.3.0) | ||
xml-simple (>= 1.0.12) | ||
activerecord (2.3.10) | ||
activesupport (= 2.3.10) | ||
activeresource (2.3.10) | ||
activesupport (= 2.3.10) | ||
activesupport (2.3.10) | ||
authlogic (2.1.2) | ||
activesupport | ||
awesome_print (0.3.1) | ||
builder (3.0.0) | ||
cgi_multipart_eof_fix (2.5.0) | ||
columnize (0.3.2) | ||
curb (0.7.10) | ||
daemons (1.1.0) | ||
delayed_job (2.0.3) | ||
daemons | ||
facets (2.8.4) | ||
fastthread (1.0.7) | ||
gem_plugin (0.2.3) | ||
json (1.4.6) | ||
linecache (0.43) | ||
marc (0.3.0) | ||
mediashelf-loggable (0.4.0) | ||
mime-types (1.16) | ||
mongrel (1.1.5) | ||
cgi_multipart_eof_fix (>= 2.4) | ||
daemons (>= 1.0.3) | ||
fastthread (>= 1.0.1) | ||
gem_plugin (>= 0.2.3) | ||
multipart-post (1.1.0) | ||
nokogiri (1.4.3.1) | ||
om (1.0.2) | ||
facets | ||
facets | ||
nokogiri | ||
nokogiri (>= 1.4.2) | ||
rack (1.1.0) | ||
rails (2.3.10) | ||
actionmailer (= 2.3.10) | ||
actionpack (= 2.3.10) | ||
activerecord (= 2.3.10) | ||
activeresource (= 2.3.10) | ||
activesupport (= 2.3.10) | ||
rake (>= 0.8.3) | ||
rake (0.8.7) | ||
rcov (0.9.9) | ||
rsolr (0.12.1) | ||
builder (>= 2.1.2) | ||
rsolr-ext (0.12.0) | ||
rsolr (>= 0.12.1) | ||
rspec (1.3.1) | ||
rspec-rails (1.3.3) | ||
rack (>= 1.0.0) | ||
rspec (= 1.3.1) | ||
ruby-debug (0.10.4) | ||
columnize (>= 0.1) | ||
ruby-debug-base (~> 0.10.4.0) | ||
ruby-debug-base (0.10.4) | ||
linecache (>= 0.3) | ||
solr-ruby (0.0.8) | ||
solrizer (0.3.2) | ||
mediashelf-loggable | ||
nokogiri | ||
nokogiri | ||
om | ||
solr-ruby | ||
sqlite3-ruby (1.2.5) | ||
will_paginate (2.3.11) | ||
xml-simple (1.0.13) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
active-fedora (= 1.2.8) | ||
authlogic (= 2.1.2) | ||
awesome_print | ||
curb | ||
delayed_job (= 2.0.3) | ||
facets (= 2.8.4) | ||
json | ||
marc (= 0.3.0) | ||
mongrel | ||
rails (= 2.3.10) | ||
rcov | ||
rsolr (= 0.12.1) | ||
rsolr-ext (= 0.12.0) | ||
rspec (< 2.0) | ||
rspec-rails (< 2.0) | ||
ruby-debug | ||
sqlite3-ruby (= 1.2.5) | ||
will_paginate (= 2.3.11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
########################################################################################################### | ||
# Copyright (c) 2011. The Board of Trustees of the Leland Stanford Junior University. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
h1. EEMs - Everyday Electronic Materials | ||
|
||
A pre-Hydra, ActiveFedora/Blacklight Ruby on Rails application | ||
|
||
h2. Installation | ||
|
||
h3. Prerequisites | ||
|
||
* rvm with MRI 1.8.7 | ||
* bundler | ||
* packages and header files in order to build the following gems | ||
** curb - needs curl and curl header files | ||
** nokogiri - libxml2 | ||
* Fedora | ||
* Solr | ||
|
||
|
||
h3. Instructions to get development instance running | ||
|
||
* source the .rvmrc - It will create an rvm gemset _1.8.7@eems_, you can change this if you want | ||
** @$ source .rvmrc@ | ||
* Use bundler to install gems - install any missing packages if needed | ||
** @$ bundle install@ | ||
* Point to your Fedora instance: modify the *FEDORA_URL* constant in @conf/environments/development.rb@ | ||
* Point to your Solr instance: modify @config/solr.yml@ and @config/initializers/fedora_repository.rb@ | ||
* Copy @solr/schema.xml@ and @solr/solrconfig.xml@ to *$SOLR_HOME/conf* | ||
* Create the development sqlite database | ||
** @$ rake db:migrate@ | ||
* Create the test sqlite database | ||
** @$ rake db:test:clone@ | ||
* Make sure all the tests pass | ||
** @$ rake spec@ | ||
* Start delayed_job | ||
** @$ startjob.sh development@ | ||
* Start the app | ||
** @$ script/server@ | ||
|
||
h2. Typical Use Case | ||
|
||
h3. Create an Eem using the browser widget to point to the URL of a pdf | ||
|
||
* Login to the app by opening http://localhost:3000 in your browser | ||
* Create bookmark/browser button by dragging the "EEMs-dev Widget" button to your browser's bookmark toolbar | ||
* Navigate to a web page with a freely downloadable pdf, not behind a password. e.g. http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm | ||
* Click the "EEMs Widget" browser button | ||
* Fill in details. In particular, drag the link for "1-column for viewing online" to the "Direct link to file:" input field. The widget should populate the input field with the URL to the PDF | ||
* Click "Send to Dashboard" | ||
|
||
You should now see a facet with your username in the Selector facet. You can drill down to the details of the Eem you created. The Eem is editable until the "Send to Technical Services" Action link is clicked. This should kick off background accessioning of the Eem. | ||
|
||
h2. High-level Code Overview during EEMs creation | ||
|
||
* An EemsUser is created and 'logged-in' via ApplicationController#set_current_user. For demonstration purposes, it is naively creating an eems_demo_user. You should replace/rewrite this method with your with institution specific authorization/authentication scheme | ||
* The browser widget is rendered from @public/javascripts/browser-widget-dialog.js@ | ||
* Clicking the Send or Save buttons in the browser widget POSTs a json request with the form data to EemsController#create | ||
* EemsController#create | ||
** Creates Eem and Part objects in Fedora | ||
** Creates a ContentFile object to temporarily keep track of pdf download progress. | ||
** Creates a Dor::DownloadJob object which does the work of fetching the pdf from the specified url using the curb gem on the server side. | ||
* DelayedJob then calls the Dor::DownloadJob#perform method to do the work in the backgroud. It updates download progress via ContentFile#update_progress | ||
* The widget displays download progress by calling ContentController#show, passing the id of the ContentFile | ||
* When the download finishes, a content datastream is created on the Part object, pointing to the downloaded pdf, logged to the ActionLog datastream in the Eem object. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require(File.join(File.dirname(__FILE__), 'config', 'boot')) | ||
|
||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
require 'tasks/rails' | ||
|
||
begin | ||
require 'delayed/tasks' | ||
rescue LoadError | ||
STDERR.puts "Run `rake gems:install` to install delayed_job" | ||
end | ||
|
||
task :clean do | ||
puts 'Cleaning old coverage.data' | ||
FileUtils.rm('coverage.data') if(File.exists? 'coverage.data') | ||
end | ||
|
||
Spec::Rake::SpecTask.new(:rcov) do |spec| | ||
spec.libs << 'lib' << 'spec' | ||
spec.pattern = 'spec/**/*_spec.rb' | ||
spec.rcov = true | ||
spec.rcov_opts = %w{--rails --exclude spec\/*,gems\/*,ruby\/* --aggregate coverage.data} | ||
end | ||
|
||
task :default => [:clean, :rcov] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
require 'vendor/plugins/blacklight/app/controllers/application_controller.rb' | ||
# Filters added to this controller apply to all controllers in the application. | ||
# Likewise, all the methods added will be available for all controllers. | ||
|
||
class ApplicationController < ActionController::Base | ||
|
||
before_filter :set_current_user | ||
|
||
helper :all # include all helpers, all the time | ||
protect_from_forgery # See ActionController::RequestForgeryProtection for details | ||
|
||
protected | ||
|
||
# For the purposes of distribution, this method will create an eems_demo_user for logging in. | ||
# It will be up to the developer to re-write this method | ||
def set_current_user | ||
# !!!!!!!!!!!!!!!!!!!!!!!! Setting a demo user | ||
# !!!!!!!!!!!!!!!!!!!!!!!! Replace these lines with institution specific authorization/authentication scheme | ||
unless EemsUser.user_authenticated?(session) | ||
user = EemsUser.new("Eems Demo User created in ApplicationController", 'eems_demo_user', 'privgroup unused') | ||
user.save_to_session(session) | ||
end | ||
end | ||
|
||
# Scrub sensitive parameters from your log | ||
# filter_parameter_logging :password | ||
private | ||
def require_fedora | ||
Fedora::Repository.register(FEDORA_URL, session[:user]) | ||
return true | ||
end | ||
def require_solr | ||
ActiveFedora::SolrService.register(SOLR_URL) | ||
end | ||
|
||
# underscores are escaped w/ + signs, which are unescaped by rails to spaces | ||
# html tags are escaped by converting < and > to < and > | ||
def unescape_keys(attrs) | ||
h=Hash.new | ||
attrs.each do |k,v| | ||
v = v.gsub(/</, '<') | ||
v = v.gsub(/>/, '>') | ||
h[k.gsub(/ /, '_')] = v | ||
end | ||
h | ||
end | ||
|
||
def escape_keys(attrs) | ||
h=Hash.new | ||
attrs.each do |k,v| | ||
h[k.gsub(/_/, '+')]=v | ||
end | ||
h | ||
end | ||
|
||
# !!!!!!!!!!!!!!!!!!!!!!!! These filters should be re-written/removed for institution specfic authentication/authorization | ||
def user_required | ||
true | ||
end | ||
|
||
# | ||
def authorized_user | ||
true | ||
end | ||
|
||
end |
Oops, something went wrong.