forked from flyingzumwalt/salt
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit of modified blacklight
- Loading branch information
Matthew Zumwalt
committed
Oct 13, 2009
0 parents
commit 588dc6d
Showing
2,335 changed files
with
225,355 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,3 @@ | ||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | ||
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | ||
load 'config/deploy' |
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,101 @@ | ||
= The Blacklight demo app | ||
|
||
This is documentation for the blacklight demo application. Blacklight comes distributed as a rails engines plugin and as a demo application that implements that plugin. A typical use case is to install the demo application, customize it, and then upgrade the enclosed plugin as needed in order to take advantage of bug fixes and new functionality, while still maintaining your local customizations. Documentation like this is generated by running 'rake rdoc' against a Rakefile and a DEMO_README file, and it is recommended that you use this rdoc system as a way of documenting your local customizations too. | ||
|
||
See: vendor/plugins/blacklight for more detailed info about the plugin itself. | ||
|
||
= Installation instructions for the demo application | ||
|
||
June 25, 2009 | ||
release 2.2 | ||
|
||
== Be sure to install the {pre-requisites}[link:files/vendor/plugins/blacklight/PRE-REQUISITES_rdoc.html] first | ||
|
||
The demo app comes with Solr and the Jetty application server embedded. But be sure you have a Java version installed recent enough to meet the {Solr requirements}[link:http://wiki.apache.org/solr/FAQ#head-d0235ca79aa77fd73507d37b82462abd2a848a46]. We recommend using a Sun JRE. | ||
|
||
== Installation of the demo app | ||
|
||
===Checkout and setup the demo application | ||
|
||
====Checkout a copy of the demo app (which comes with the blacklight plugin pre-installed). | ||
You have a couple of choices here. You can either download a release from rubyforge here: http://rubyforge.org/projects/blacklight/, or if you're feeling cutting-edge, you can check out from subversion: | ||
* Anonymously: | ||
svn co http://blacklight.rubyforge.org/svn/trunk/ bl-demo | ||
* If you have commit rights: | ||
svn co svn+ssh://username@rubyforge.org/var/svn/blacklight/trunk/ bl-demo | ||
|
||
====Move into the rails dir: | ||
cd bl-demo/rails | ||
|
||
====Copy the database and other configuration files: | ||
cp config/database.example config/database.yml | ||
cp config/solr.example config/solr.yml | ||
cp vendor/plugins/blacklight/config/initializers/blacklight_config.rb ./config/initializers/ | ||
|
||
====Setup your database (for storing user accounts and bookmarks) | ||
|
||
The default database settings are configured to use sqlite3. If you want to use mysql instead, create a database called blacklight_development: | ||
|
||
mysqladmin create blacklight_development # your command will vary | ||
|
||
Then put this into your config/database.yml file instead of the default settings: | ||
|
||
development: | ||
adapter: mysql | ||
database: blacklight_demo_development | ||
username: demo | ||
password: ***** | ||
host: localhost | ||
socket: /opt/local/var/run/mysql5/mysqld.sock | ||
|
||
Regardless of which database you're using, you'll need to run the database migrations: | ||
|
||
rake db:migrate | ||
|
||
====Possible Issues with Gems | ||
Some installation sites have reported difficulties with gems at installation time. There is a section about this in {README.rdoc}[link:files/vendor/plugins/blacklight/README_rdoc.html] | ||
|
||
====Start Solr | ||
|
||
Now start Solr via Jetty. Change into the bl-demo/jetty directory: | ||
|
||
cd ../jetty | ||
java -jar start.jar | ||
|
||
You should see a bunch of logging and should stop after a few seconds. Solr should now be running and you can test it by browsing to: | ||
http://localhost:8983/solr | ||
|
||
====Index the test data | ||
Now open a new terminal window and move into the rails dir again: | ||
cd bl-demo/rails | ||
And kick off the rake task to index some test data: | ||
rake solr:marc:index MARC_FILE=../data/test_data.utf8.mrc | ||
You should see all of the records being indexed. | ||
Look at the Jetty terminal window, verify that Solr is receiving the data -- there should be lots of logging activity. | ||
After it is finished, check http://localhost:8983/solr/admin/stats.jsp. In the "CORE" section, numDocs should not be 0. | ||
|
||
You can also index some test EAD files: | ||
rake app:index:ead_dir FILE=../data/ead/*.xml | ||
|
||
====Start Rails | ||
|
||
When the indexing is done, fire up Rails: | ||
|
||
ruby ./script/server | ||
|
||
Browse to: | ||
http://localhost:3000/ | ||
|
||
====(optional) Index more data | ||
Once you have the basic application working, you can index more data. The command is the same, just point at a different data file, for example: | ||
rake solr:marc:index MARC_FILE=../data/lc_records.utf8.mrc | ||
|
||
That rake task indexes your data with SolrMarc, a java app included in the demo distribution. If you're interested in seeing what it's doing, just add ":info" on the end of the task, and it will tell you about the action it would perform, but not perform it (a 'dry run'). | ||
rake solr:marc:index:info MARC_FILE=../data/lc_records.utf8.mrc | ||
|
||
You can download more sample sets here: http://www.archive.org/search.php?query=mediatype%3A%22data%22%20MARC | ||
You could also point it at a set of exported MaRC records from your own library. | ||
|
||
If you want to extensively change how the indexing assigns Marc data to Solr fields, we recommend a starting point of the GenericBlacklight example code from the SolrMarc project. See http://code.google.com/p/solrmarc/. There are helpful wikis there. | ||
|
||
NOTE: the indexing code provided with the Blacklight project is the GenericBlacklight example in the SolrMarc project. |
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 2008 Rector and Visitors of the University of Virginia | ||
# | ||
# 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,135 @@ | ||
# 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/clean' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
require 'tasks/rails' | ||
|
||
# The name of your project | ||
PROJECT = "Blacklight" | ||
# Your name, used in packaging. | ||
MY_NAME = "Bess Sadler" | ||
# Your email address, used in packaging. | ||
MY_EMAIL = "bess@virginia.edu" | ||
# Short summary of your project, used in packaging. | ||
PROJECT_SUMMARY = "Blacklight is open source discovery software. Libraries (or anyone else) may use blacklight to enable searching and browsing of their collections online. Blacklight uses Solr to index and search text and/or metadata, and it has a highly configurable Ruby on Rails front-end. Currently, Blacklight can index, search, and provide faceted browsing for MaRC records and several kinds of XML documents. Blacklight was developed at the University of Virginia Library and is made public under an Apache 2.0 license." | ||
# The project's package name (as opposed to its display name). Used for | ||
# RubyForge connectivity and packaging. | ||
UNIX_NAME = "blacklight" | ||
# Your RubyForge user name. | ||
RUBYFORGE_USER = ENV["RUBYFORGE_USER"] || "eos8d" | ||
# Directory on RubyForge where your website's files should be uploaded. | ||
RUBYFORGE_PATH = "/var/www/gforge-projects/blacklight/" | ||
# Output directory for the rdoc html files. | ||
# If you don't have a custom homepage, and want to use the RDoc | ||
# index.html as homepage, just set it to WEBSITE_DIR. | ||
RDOC_HTML_DIR = "doc" | ||
PROJECT_VERSION = "2.2" # e.g., "1.0.2" | ||
# where do our package files go? | ||
target = './dist' | ||
# Clobber the package files when re-building | ||
CLOBBER.include("#{target}/*") | ||
# Additional RDoc formatted files, besides the Ruby source files. | ||
CURRENT_SVN_BRANCH = "http://blacklight.rubyforge.org/svn/branches/rails-engines/trunk/" | ||
|
||
|
||
# Run the rspec for the plugins if rake is invoked without arguments. | ||
# task "default" => ["spec:plugins"] | ||
# task "test" => ["spec:plugins"] | ||
|
||
desc "Generate rdoc for the demo app and the blacklight plugin." | ||
task "rdoc" | ||
# require 'hanna/rdoctask' | ||
Rake::RDocTask.new('rdoc') do |t| | ||
t.rdoc_files.include('DEMO_README', 'LICENSE') | ||
t.rdoc_files.include('vendor/plugins/blacklight/*.rdoc') | ||
t.rdoc_files.include('lib/**/*.rb', 'config/initializers/blacklight_config.rb') | ||
t.rdoc_files.include('vendor/plugins/blacklight/app/controllers', 'vendor/plugins/blacklight/app/helpers', 'vendor/plugins/blacklight/app/models') | ||
t.rdoc_files.include('vendor/plugins/blacklight/lib') | ||
#t.rdoc_files.include('vendor/plugins/blacklight/vendor/gems') | ||
t.options << "--exclude=vendor/plugins/blacklight/lib/experiments" | ||
|
||
t.main = 'vendor/plugins/blacklight/README_PROJECT.rdoc' | ||
t.title = "Blacklight Documentation" | ||
t.rdoc_dir = 'doc' | ||
end | ||
|
||
desc "Upload website to RubyForge. scp will prompt for your RubyForge password." | ||
task "publish-rdoc" => ["rdoc"] do | ||
rubyforge_path = "/var/www/gforge-projects/#{UNIX_NAME}/" | ||
sh "scp -r #{RDOC_HTML_DIR}/* " + | ||
"#{RUBYFORGE_USER}@rubyforge.org:#{RUBYFORGE_PATH}", | ||
:verbose => true | ||
end | ||
|
||
# The "prepare-release" task makes sure your tests run, and then generates | ||
# files for a new release. | ||
desc "Run tests, generate RDoc and create packages." | ||
task "prepare-release" => ["clobber"] do | ||
puts "Preparing release of #{PROJECT} version #{PROJECT_VERSION}" | ||
Rake::Task["test"].invoke | ||
Rake::Task["rdoc"].invoke | ||
Rake::Task["package"].invoke | ||
end | ||
|
||
desc "prepare a package" | ||
task "package" do | ||
puts "building release... " | ||
# check for dist folder | ||
mkdir_p target | ||
# clean up any previous checkouts | ||
puts "removing previous package files..." | ||
sh "rm -rf #{target}/*" | ||
# svn export the subversion url | ||
puts "exporting svn contents from #{CURRENT_SVN_BRANCH} to #{target}/#{UNIX_NAME}-#{PROJECT_VERSION}" | ||
sh "svn export #{CURRENT_SVN_BRANCH} #{target}/#{UNIX_NAME}-#{PROJECT_VERSION}" | ||
# gzip the whole thing and name it with the version number | ||
puts "zipping #{UNIX_NAME}-#{PROJECT_VERSION}.tgz" | ||
sh "cd #{target}; tar czvf #{UNIX_NAME}-#{PROJECT_VERSION}.tgz #{UNIX_NAME}-#{PROJECT_VERSION}" | ||
end | ||
|
||
task "rubyforge-setup" do | ||
unless File.exist?(File.join(ENV["HOME"], ".rubyforge")) | ||
puts "rubyforge will ask you to edit its config.yml now." | ||
puts "Please set the `username' and `password' entries" | ||
puts "to your RubyForge username and RubyForge password!" | ||
puts "Press ENTER to continue." | ||
$stdin.gets | ||
sh "rubyforge setup", :verbose => true | ||
sh "rubyforge config blacklight", :verbose => true | ||
puts "you might need to put these lines in ~/.rubyforge/auto-config.yml: | ||
processor_ids: | ||
Any: 8000 | ||
" | ||
end | ||
end | ||
|
||
|
||
task "rubyforge-login" => ["rubyforge-setup"] do | ||
# Note: We assume that username and password were set in | ||
# rubyforge's config.yml. | ||
sh "rubyforge login", :verbose => true | ||
end | ||
|
||
task "publish-packages" => ["prepare-release", "rubyforge-login"] do | ||
# Upload packages under pkg/ to RubyForge | ||
# This task makes some assumptions: | ||
# * You have already created a package on the "Files" tab on the | ||
# RubyForge project page. See pkg_name variable below. | ||
# * You made entries under package_ids and group_ids for this | ||
# project in rubyforge's config.yml. If not, eventually read | ||
# "rubyforge --help" and then run "rubyforge setup". | ||
pkg_name = ENV["PKG_NAME"] || UNIX_NAME | ||
cmd = "rubyforge add_release #{UNIX_NAME} #{pkg_name} " + | ||
"#{PROJECT_VERSION} #{UNIX_NAME}-#{PROJECT_VERSION}" | ||
cd "#{target}" do | ||
#puts "#{cmd}.tgz" | ||
sh(cmd + ".tgz", :verbose => true) | ||
end | ||
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,14 @@ | ||
You will need: | ||
|
||
1. database.yml (copy database.example; if you want to use MySQL, instead | ||
of sqlite3, see | ||
http://wiki.blacklightopac.org/doku.php?id=installing_the_demo_app ) | ||
|
||
2. solr.yml (copy solr.example) | ||
|
||
|
||
in initializers sub-directory: | ||
|
||
3. blacklight_config.rb | ||
(copy vendor/plugin/blacklight/config/initializers/blacklight_config.rb | ||
and modify to match your solr index fields and display needs) |
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,110 @@ | ||
# Don't change this file! | ||
# Configure your app in config/environment.rb and config/environments/*.rb | ||
|
||
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) | ||
|
||
module Rails | ||
class << self | ||
def boot! | ||
unless booted? | ||
preinitialize | ||
pick_boot.run | ||
end | ||
end | ||
|
||
def booted? | ||
defined? Rails::Initializer | ||
end | ||
|
||
def pick_boot | ||
(vendor_rails? ? VendorBoot : GemBoot).new | ||
end | ||
|
||
def vendor_rails? | ||
File.exist?("#{RAILS_ROOT}/vendor/rails") | ||
end | ||
|
||
def preinitialize | ||
load(preinitializer_path) if File.exist?(preinitializer_path) | ||
end | ||
|
||
def preinitializer_path | ||
"#{RAILS_ROOT}/config/preinitializer.rb" | ||
end | ||
end | ||
|
||
class Boot | ||
def run | ||
load_initializer | ||
Rails::Initializer.run(:set_load_path) | ||
end | ||
end | ||
|
||
class VendorBoot < Boot | ||
def load_initializer | ||
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" | ||
Rails::Initializer.run(:install_gem_spec_stubs) | ||
Rails::GemDependency.add_frozen_gem_path | ||
end | ||
end | ||
|
||
class GemBoot < Boot | ||
def load_initializer | ||
self.class.load_rubygems | ||
load_rails_gem | ||
require 'initializer' | ||
end | ||
|
||
def load_rails_gem | ||
if version = self.class.gem_version | ||
gem 'rails', version | ||
else | ||
gem 'rails' | ||
end | ||
rescue Gem::LoadError => load_error | ||
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) | ||
exit 1 | ||
end | ||
|
||
class << self | ||
def rubygems_version | ||
Gem::RubyGemsVersion rescue nil | ||
end | ||
|
||
def gem_version | ||
if defined? RAILS_GEM_VERSION | ||
RAILS_GEM_VERSION | ||
elsif ENV.include?('RAILS_GEM_VERSION') | ||
ENV['RAILS_GEM_VERSION'] | ||
else | ||
parse_gem_version(read_environment_rb) | ||
end | ||
end | ||
|
||
def load_rubygems | ||
require 'rubygems' | ||
min_version = '1.3.1' | ||
unless rubygems_version >= min_version | ||
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) | ||
exit 1 | ||
end | ||
|
||
rescue LoadError | ||
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) | ||
exit 1 | ||
end | ||
|
||
def parse_gem_version(text) | ||
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ | ||
end | ||
|
||
private | ||
def read_environment_rb | ||
File.read("#{RAILS_ROOT}/config/environment.rb") | ||
end | ||
end | ||
end | ||
end | ||
|
||
# All that for this: | ||
Rails.boot! |
Oops, something went wrong.