Skip to content

Commit 412c120

Browse files
committed
Blacklight 2.1
1 parent 2bac616 commit 412c120

File tree

438 files changed

+9506
-1226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

438 files changed

+9506
-1226
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
.log
3+
log
4+
tmp
5+
logs
6+
*.sqlite3

rails/README

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ March 24, 2009
1010
You also need the marc gem for this demo:
1111
sudo gem install marc
1212

13-
1413
===Create database.yml and solr.yml configuration files
1514

1615
cp config/database.example config/database.yml
1716
cp config/solr.example config/solr.yml
1817

18+
===Create the initializers
19+
20+
cp config/initializers/blacklight_config.rb.example config/initializers/blacklight_config.rb
21+
1922
===Run the migrations:
2023

2124
cd rails

rails/Rakefile

+113-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,119 @@
44
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
55

66
require 'rake'
7+
require 'rake/clean'
78
require 'rake/testtask'
89
require 'rake/rdoctask'
10+
require 'tasks/rails'
11+
12+
# The name of your project
13+
PROJECT = "Blacklight"
14+
# Your name, used in packaging.
15+
MY_NAME = "Bess Sadler"
16+
# Your email address, used in packaging.
17+
MY_EMAIL = "[email protected]"
18+
# Short summary of your project, used in packaging.
19+
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, including TEI, EAD, and GDMS. Blacklight was developed at the University of Virginia Library and is made public under an Apache 2.0 license."
20+
# The project's package name (as opposed to its display name). Used for
21+
# RubyForge connectivity and packaging.
22+
UNIX_NAME = "blacklight"
23+
# Your RubyForge user name.
24+
RUBYFORGE_USER = ENV["RUBYFORGE_USER"] || "eos8d"
25+
# Directory on RubyForge where your website's files should be uploaded.
26+
RUBYFORGE_PATH = "/var/www/gforge-projects/blacklight/"
27+
# Output directory for the rdoc html files.
28+
# If you don't have a custom homepage, and want to use the RDoc
29+
# index.html as homepage, just set it to WEBSITE_DIR.
30+
RDOC_HTML_DIR = "doc/plugins/blacklight/"
31+
PROJECT_VERSION = "2.0.0" # e.g., "1.0.2"
32+
# where do our package files go?
33+
target = './dist'
34+
# Clobber the package files when re-building
35+
CLOBBER.include("#{target}/*")
36+
# Additional RDoc formatted files, besides the Ruby source files.
37+
RDOC_FILES = FileList["README.rdoc", "Changes.rdoc"]
38+
CURRENT_SVN_BRANCH = "http://blacklight.rubyforge.org/svn/branches/rails-engines/trunk/"
39+
40+
41+
# Run the rspec for the plugins if rake is invoked without arguments.
42+
# task "default" => ["spec:plugins"]
43+
# task "test" => ["spec:plugins"]
44+
45+
desc "Generate rdoc for the plugins."
46+
task "rdoc" => ["doc:plugins"]
47+
48+
desc "Upload website to RubyForge. scp will prompt for your RubyForge password."
49+
task "publish-rdoc" => ["rdoc"] do
50+
rubyforge_path = "/var/www/gforge-projects/#{UNIX_NAME}/"
51+
sh "scp -r #{RDOC_HTML_DIR}/* " +
52+
"#{RUBYFORGE_USER}@rubyforge.org:#{RUBYFORGE_PATH}",
53+
:verbose => true
54+
end
55+
56+
# The "prepare-release" task makes sure your tests run, and then generates
57+
# files for a new release.
58+
desc "Run tests, generate RDoc and create packages."
59+
task "prepare-release" => ["clobber"] do
60+
puts "Preparing release of #{PROJECT} version #{PROJECT_VERSION}"
61+
Rake::Task["test"].invoke
62+
Rake::Task["rdoc"].invoke
63+
Rake::Task["package"].invoke
64+
end
65+
66+
desc "prepare a package"
67+
task "package" do
68+
puts "building release... "
69+
# check for dist folder
70+
mkdir_p target
71+
# clean up any previous checkouts
72+
puts "removing previous package files..."
73+
sh "rm -rf #{target}/*"
74+
# svn export the subversion url
75+
puts "exporting svn contents from #{CURRENT_SVN_BRANCH} to #{target}/#{UNIX_NAME}-#{PROJECT_VERSION}"
76+
sh "svn export #{CURRENT_SVN_BRANCH} #{target}/#{UNIX_NAME}-#{PROJECT_VERSION}"
77+
# gzip the whole thing and name it with the version number
78+
puts "zipping #{UNIX_NAME}-#{PROJECT_VERSION}.tgz"
79+
sh "cd #{target}; tar czvf #{UNIX_NAME}-#{PROJECT_VERSION}.tgz #{UNIX_NAME}-#{PROJECT_VERSION}"
80+
end
81+
82+
task "rubyforge-setup" do
83+
unless File.exist?(File.join(ENV["HOME"], ".rubyforge"))
84+
puts "rubyforge will ask you to edit its config.yml now."
85+
puts "Please set the `username' and `password' entries"
86+
puts "to your RubyForge username and RubyForge password!"
87+
puts "Press ENTER to continue."
88+
$stdin.gets
89+
sh "rubyforge setup", :verbose => true
90+
sh "rubyforge config blacklight", :verbose => true
91+
puts "you might need to put these lines in ~/.rubyforge/auto-config.yml:
92+
processor_ids:
93+
Any: 8000
94+
"
95+
end
96+
end
97+
98+
99+
task "rubyforge-login" => ["rubyforge-setup"] do
100+
# Note: We assume that username and password were set in
101+
# rubyforge's config.yml.
102+
sh "rubyforge login", :verbose => true
103+
end
104+
105+
task "publish-packages" => ["prepare-release", "rubyforge-login"] do
106+
# Upload packages under pkg/ to RubyForge
107+
# This task makes some assumptions:
108+
# * You have already created a package on the "Files" tab on the
109+
# RubyForge project page. See pkg_name variable below.
110+
# * You made entries under package_ids and group_ids for this
111+
# project in rubyforge's config.yml. If not, eventually read
112+
# "rubyforge --help" and then run "rubyforge setup".
113+
pkg_name = ENV["PKG_NAME"] || UNIX_NAME
114+
cmd = "rubyforge add_release #{UNIX_NAME} #{pkg_name} " +
115+
"#{PROJECT_VERSION} #{UNIX_NAME}-#{PROJECT_VERSION}"
116+
cd "#{target}" do
117+
#puts "#{cmd}.tgz"
118+
sh(cmd + ".tgz", :verbose => true)
119+
end
120+
end
121+
9122

10-
require 'tasks/rails'

rails/config/CONFIG_README

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
You will need:
2+
3+
1. database.yml (copy database.example; if you want to use MySQL, instead
4+
of sqlite3, see
5+
http://wiki.blacklightopac.org/doku.php?id=installing_the_demo_app )
6+
7+
2. solr.yml (copy solr.example)
8+
9+
10+
in initializers sub-directory:
11+
12+
3. blacklight_config.rb (copy initializers blacklight_config.rb.example)

rails/config/environment.rb

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
# Only load the plugins named here, in the order given. By default, all plugins
2626
# in vendor/plugins are loaded in alphabetical order.
2727
# :all can be used as a placeholder for all plugins not explicitly named
28+
29+
config.plugin_paths += ["#{RAILS_ROOT}/vendor/plugins/blacklight/vendor/plugins"]
2830
config.plugins = %W(engines blacklight acts_as_taggable_on_steroids simplest_auth resource_controller)
2931

3032
# Add additional load paths for your own custom dirs

rails/config/initializers/blacklight.rb.example

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Please see vendor/plugins/blacklight/config/initializers/blacklight_config.rb for an example.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
Blacklight.configure(:shared) do |config|
2+
3+
# solr field contents given special treatment in the show (single result) view
4+
config[:show] = {
5+
:html_title => "title_245a_display",
6+
:heading => "title_full_display",
7+
:display_type => "format_display"
8+
}
9+
10+
# solr field contents given special treatment in the index (search results) view
11+
config[:index] = {
12+
:show_link => "title_display",
13+
:num_per_page => 20,
14+
:record_display_type => "format_display"
15+
}
16+
17+
# solr fields that will be treated as facets by the blacklight application
18+
config[:facet] = {
19+
:field_names => [
20+
"access_facet",
21+
"building_facet",
22+
"format_facet",
23+
"lc_1letter_facet",
24+
"dewey_1digit_facet",
25+
"author_person_facet",
26+
"author_combined_facet",
27+
# "author_corp_facet",
28+
# "author_meeting_facet",
29+
"language_facet",
30+
"topic_facet",
31+
"pub_date_group_facet",
32+
"era_facet",
33+
"geographic_facet"
34+
],
35+
:labels => {
36+
"access_facet" => "Access",
37+
"building_facet" => "Library",
38+
"format_facet" => "Format",
39+
"lc_1letter_facet" => "Call Number (Library of \n Congress)",
40+
"dewey_1digit_facet" => "Call Number (Dewey)",
41+
"author_person_facet" => "Author (Person)",
42+
"author_combined_facet" => "Author (All)",
43+
# "author_corp_facet" => "Author (Corporate)",
44+
# "author_meeting_facet" => "Author (Meeting)",
45+
"language_facet" => "Language",
46+
"topic_facet" => "Topic",
47+
"pub_date_group_facet" => "Year",
48+
"era_facet" => "Era",
49+
"geographic_facet" => "Region"
50+
}
51+
}
52+
53+
# solr fields to be displayed in the index (search results) view
54+
config[:index_fields] = {:field_names => [
55+
"title_display", "vern_title_display",
56+
"author_person_display", "vern_author_person_display",
57+
"publish_date_display",
58+
"format_display"
59+
]}
60+
# solr fields to be displayed in the index (search results) view
61+
config[:index_fields] = {
62+
:field_names => [
63+
"title_245a_display",
64+
"title_display",
65+
"vern_title_display",
66+
"title_uniform_display",
67+
"vern_title_uniform_display",
68+
"author_person_display",
69+
"vern_author_person_display",
70+
"author_corp_display",
71+
"vern_author_corp_display",
72+
"author_meeting_display",
73+
"vern_author_meeting_display",
74+
"publish_date_display",
75+
"format_display"
76+
],
77+
:labels => {
78+
"title_245a_display" => "",
79+
"title_display" => "Title:",
80+
"vern_title_display" => "Title:",
81+
"title_uniform_display" => "Title:",
82+
"vern_title_uniform_display" => "Title:",
83+
"author_person_display" => "Author/Creator:",
84+
"vern_author_person_display" => "Author/Creator:",
85+
"author_corp_display" => "Corporate Author:",
86+
"vern_author_corp_display" => "Corporate Author:",
87+
"author_meeting_display" => "Meeting Author:",
88+
"vern_author_meeting_display" => "Meeting Author:",
89+
"publish_date_display" => "Published:",
90+
"format_display" => "Format:"
91+
}
92+
}
93+
94+
# solr fields to be displayed in the show (single result) view
95+
config[:show_fields] = {
96+
:field_names => [
97+
"title_full_display",
98+
"vern_title_full_display",
99+
"vern_uniform_display",
100+
"vern_title_uniform_display",
101+
"title_variant_display",
102+
"vern_title_variant_display",
103+
"author_person_full_display",
104+
"vern_author_person_full_display",
105+
"author_corp_display",
106+
"vern_author_corp_display",
107+
"author_meeting_display",
108+
"vern_author_meeting_display",
109+
"publication_display",
110+
"vern_publication_display",
111+
"format_display",
112+
"physical_display",
113+
"series_title_display",
114+
"vern_series_title_display",
115+
"edition_display",
116+
"vern_edition_display"
117+
],
118+
:labels => {
119+
"title_full_display" => "Title:",
120+
"vern_title_full_display" => "Title:",
121+
"title_uniform_display" => "Uniform Title:",
122+
"vern_title_uniform_display" => "Uniform Title:",
123+
"title_variant_display" => "Variant Title",
124+
"vern_title_variant_display" => "Variant Title",
125+
"author_person_full_display" => "Author/Creator:",
126+
"vern_author_person_full_display" => "Author/Creator:",
127+
"author_corp_display" => "Corporate Author:",
128+
"vern_author_corp_display" => "Corporate Author:",
129+
"author_meeting_display" => "Meeting Author:",
130+
"vern_author_meeting_display" => "Meeting Author:",
131+
"publication_display" => "Published:",
132+
"vern_publication_display" => "Published:",
133+
"format_display" => "Format:",
134+
"physical_display" => "Physical Description:",
135+
"series_title_display" => "Series:",
136+
"vern_series_title_display" => "Series:",
137+
"edition_display" => "Edition:",
138+
"vern_edition_display" => "Edition:"
139+
}
140+
}
141+
142+
# type of raw data in index. Currently marcxml and marc21 are supported.
143+
config[:raw_storage_type] = "marc21"
144+
# name of solr field containing raw data
145+
config[:raw_storage_field] = "marc_raw_display"
146+
147+
# "fielded" search select (pulldown)
148+
# label in pulldown is followed by the name of a SOLR request handler as
149+
# defined in solr/conf/solrconfig.xml
150+
config[:search_fields] ||= []
151+
config[:search_fields] << ['Everything', 'search']
152+
config[:search_fields] << ['Author', 'search_author']
153+
config[:search_fields] << ['Title', 'search_title']
154+
# config[:search_fields] << ['ISBN/ISSN', 'search_isn'] # waiting for new solrconfig.xml
155+
156+
# "sort results by" select (pulldown)
157+
# label in pulldown is followed by the name of the SOLR field to sort by and
158+
# whether the sort is ascending or descending (it must be asc or desc
159+
# except in the relevancy case).
160+
config[:sort_fields] ||= []
161+
config[:sort_fields] << ['relevance', '']
162+
# config[:sort_fields] << ['year', 'pub_date_sort desc'] # waiting for reindex
163+
config[:sort_fields] << ['author', 'author_sort asc']
164+
config[:sort_fields] << ['title', 'title_sort asc']
165+
end
166+

rails/config/solr.example

-27
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,3 @@ test:
55
production:
66
url: http://127.0.0.1:8983/solr
77

8-
display_fields:
9-
show_view_html_title: title_t
10-
show_view_record_heading: title_t
11-
record_display_type: format_code_t
12-
index_view_show_link: title_t
13-
index_view_num_per_page: 10
14-
marc_storage_field: marc_display
15-
16-
facet_fields:
17-
- format_facet
18-
- geographic_subject_facet
19-
- language_facet
20-
- subject_era_facet
21-
22-
index_view_fields:
23-
- title_t
24-
- author_t
25-
- format_facet
26-
- language_facet
27-
- published_t
28-
29-
show_view_fields:
30-
- title_t
31-
- author_t
32-
- format_facet
33-
- language_facet
34-
- published_t

0 commit comments

Comments
 (0)