h1. Hydra-Head Hydra-Head is a Rails Engines plugin containing the core code for a Hydra application. The full hydra stack includes the following: - "Blacklight":http://projectblacklight.org/ (a rails engines plugin) for the User Interface - "Solr":http://lucene.apache.org/solr/ (a java application, also ported to other languages) for the Search Engine - "ActiveFedora":https://github.com/mediashelf/active_fedora (a ruby gem) to let the rails application talk to fedora - "OM (Opinionated Metadata)":https://github.com/mediashelf/om (a ruby gem) to streamline the metadata configuration - "Solrizer":https://github.com/projecthydra/solrizer (a ruby gem) to write content to the Solr index - "SolrizerFedora":https://github.com/projecthydra/solrizer-fedora (a ruby gem) to write Fedora content to the Solr index. - HydraHead (a rails engines plugin) to glue it all together For a more thorough overview of the Hydra framework, see "HYDRA_OVERVIEW.textile":https://github.com/projecthydra/hydrangea/blob/master/HYDRA_OVERVIEW.textile. This is a Ruby on Rails 3 gem. h2. Installation/Setup h3. Install Rails, Bundler and Devise
gem install 'rails'
gem install 'bundler'
gem install 'devise'
h3. Generate a new rails application:
rails new my_hydra_head
cd my_hydra_head
h3. Init the git Repository First, put a .gitignore file into the root of your project to keep your repository clean. You could start with the ".gitignore file from the hydra-head gem":https://github.com/projecthydra/hydra-head/blob/master/.gitignore Now init the git repository and add the initial set of files
  git init
  git add .
  git commit -m"Initial Commit: empty rails app"
h3. Add the blacklight and hydra-head gems: First, add them to the Gemfile of your application:
  source 'http://rubygems.org'

  gem 'rails', '~>3.0.4'

  gem 'blacklight', '~> 3.0.0'
  gem 'hydra-head', '3.0.0pre1'

  # We will assume that you're using sqlite3 for testing/demo, 
  # but in a production setup you probably want to use a real sql database like mysql or postgres
  gem 'sqlite3-ruby', :require => 'sqlite3'

  #  We will assume you're using devise in tutorials/documentation. 
  # You are free to implement your own User/Authentication solution in its place.
  gem 'devise'

  # For testing.  You will probably want to use all of these to run the tests you write for your hydra head
  group :development, :test do 
         gem 'solrizer-fedora', '>=1.0.1'
         gem 'ruby-debug'
         gem 'rspec'
         gem 'rspec-rails', '>=2.5.0'
         gem 'mocha'
         #gem 'generator_spec'
         gem 'cucumber-rails'
         gem 'database_cleaner'
         gem 'capybara'
         #gem 'webrat'
         #gem 'aruba'
         gem 'bcrypt-ruby'
  end
To install all of the dependencies, run:
bundle install
This will take a _very_ long time the first time you run it. IF you become impatient, hit Ctl+C then enter this:
  gem install blacklight
  gem install hydra-head -v 3.0.0pre1
Then re-run bundle install and it will run slightly faster. h3. Run the generators and migrations: Run the blacklight generator
rails g blacklight -devise
Run the hydra-head generator
rails g hydra:head -df
Run the database migrations
rake db:migrate
rake db:migrate RAILS_ENV=test
If you will be writing cucumber tests, run the cucumber generator
rails g cucumber:install
h3. Add all the generated code to the Git repository
  git add .
  git commit -m"Ran Blacklight, Hydra-Head, and Cucumber Generators"
h3. The Hydra Jetty The Hydra project provides a copy of Jetty with Fedora and Solr pre-installed. This is useful for running tests against and for running your code against while you're actively working on your hydra head. Most projects add hydra jetty to their code as a git submodule
  git submodule add git://github.com/projecthydra/hydra-jetty.git jetty
  git commit -m"added jetty submodule"
  cd jetty
  git fetch --tags
  git checkout last_solr_multicore
  git checkout -b last_solr_multicore
  cd ..
  git add jetty
  git commit -m "Pinned jetty to last_solr_multicore"
Now that you've added the submodule to your git repository, whenever you grab a new working copy of the code, you can get hydra-jetty by running:
git submodule init
git submodule update
h2. Run tests to make sure everything is installed properly *TODO* h2. Modifying and Testing the Gem For those developers who want to or need to work on the hydra-head gem itself, see the "Instructions for Contributors":http://hudson.projecthydra.org/job/hydra-head-rails3-plugin/Documentation/file.TESTING.html h2. Acknowledgements h3. Design & Strategic Contributions The Hydra Framework would not exist without the extensive design effort undertaken by representatives of repository initiatives from Stanford University, University of Virginia, University of Hull and MediaShelf LLC. Contributors to that effort include Tom Cramer, Lynn McRae, Martha Sites, Richard Green, Chris Awre, and Matt Zumwalt. Thorny Staples from Fedora Commons & DuraSpace deserves special thanks for putting all of these people in the same room together.