Skip to content

Instantly share code, notes, and snippets.

@danhorst
Created February 22, 2010 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danhorst/311299 to your computer and use it in GitHub Desktop.
Save danhorst/311299 to your computer and use it in GitHub Desktop.
blacklight installation
When I first tried to install blacklight not everything went smoothly.
These instructions are based on the documentation provided here:
http://github.com/projectblacklight/blacklight/blob/master/doc/README_INSTALLATION.rdoc
Install the dependencies:
-------------------------
$ sudo gem install rails
$ sudo gem install test-unit --version=1.2.3
$ sudo gem install authlogic --version=2.1.2
$ sudo gem install marc --version=0.3.0
$ sudo gem install will_paginate --version=2.3.11
$ sudo gem install rsolr --version=0.12.1
$ sudo gem install rsolr-ext --version=0.12.0
If using Ruby 1.8.x
$ sudo gem install sqlite3
If using Ruby 1.9.x
$ sudo gem install sqlite3-ruby
Install the example project
---------------------------
$ rails ./blacklight-app -m http://github.com/projectblacklight/blacklight/raw/v2.4.2/template.rb
Configure sqlite
----------------
Check which version of ruby you are running:
$ ruby --version
If you are using ruby 1.9.x no action is required.
If you are using ruby 1.8.x:
Uncomment the following line in config/environment.rb (line 26)
# config.gem "sqlite3-ruby", :lib => "sqlite3"
Then run the following rake task:
$ sudo rake gems:install
This will install the sqlite3-ruby gem.
To start the example application:
---------------------------------
Start SOLR:
$ cd jetty && java -jar start.jar
Start Rails in a separate terminal
$ ruby script/server
Visit http://localhost:3000 in your browser of choice.
Fixing Rails 2.3.5 for Ruby 1.8.7
---------------------------------
The secure_compare method in ActiveSupport MessageVerifier fires the method intended for Ruby 1.9 when using Ruby 1.8.7 (Ruby 1.8.6 has an alternate method definition that functions as expected).
I solved this by updating the secure_compare method in the active_support-2.3.5 gem with the method as it is defined in edge rails. Before this can be done GEM_HOME must be determined.
The GEM_HOME folder could be in one of several places depending or your system configuration. Mine is in:
/usr/lib/ruby/gems/1.8/gems
It may be in:
/usr/local/lib/ruby/gems/1.8/gems
Or somewhere else.
If you installed the gems without using sudo they were most likely installed in:
~/.gem/ruby/1.8/gems
Once the location of the gems has been determined you must replace lines 43-72 of:
GEM_HOME/active_support-2.3.5/lib/active_support/message_verifier.rb
With lines 47-55 of:
http://github.com/rails/rails/blob/master/activesupport/lib/active_support/message_verifier.rb
def secure_compare(a, b)
return false unless a.bytesize == b.bytesize
l = a.unpack "C#{a.bytesize}"
res = 0
b.each_byte { |byte| res |= byte ^ l.shift }
res == 0
end
Fixing Rails 2.3.5 for Ruby 1.9.1
---------------------------------
Rails Templates are prone to failure when different parts of a page use disparate character encodings.
This error is known:
https://rails.lighthouseapp.com/projects/8994/tickets/2188-i18n-fails-with-multibyte-strings-in-ruby-19-similar-to-2038
And this monkey patch takes care of it nicely:
http://gist.github.com/339265
To index the provided data:
---------------------------
Add the sqlite3-ruby gem config to the blacklight plugin environment
cd vendor/plugins/blacklight
Add the following to config/environment.rb (within the blacklight plugin) at line 96:
# for ruby 1.8.x only
config.gem 'sqlite3-ruby', :lib => 'sqlite3'
There is a problem with pathing somewhere in the rake task. To bypass this symlink the data and jetty folders from blacklight-app to the blacklight plugin:
rm -rf data && ln -s ../../../data data
rm -rf jetty && ln -s ../../../jetty jetty
rake solr:marc:index_test_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment