-
Notifications
You must be signed in to change notification settings - Fork 0
Upgrade guide from Rails 2 (HydraHead 2.x) to Rails 3
Security has been tightened in Rails3, forcing you to include _authenticity_token__ with all requests. If you have forms or javascript that submits requests without this token, Rails will destroy the user session, effectively logging the user out (see http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails). The easiest way to make sure this token is properly included in your forms is to generate the forms using the form_tag or form_for view helpers from Rails.
Fixtures are loaded from a directory within the test app_, which is updated when you run rake hyhead:setup_test_app so in order to update a fixture, you must change it in test_support/fixtures and then either re-run rake hyhead:setup_test_app or copy the fixture into tmp/test_app/testsupport/fixtures
We have switched from Webrat to Capybara as the driver for our Cucumber tests. If you have been writing your own cucumber tests (you should!) and want to stay in sync with the rest of the hydra developers, you should switch to Capybara and pull all of the step definitions from the hydra code into your local app.
Sometime soon, we hope to wrap our step definitions into the Hydra code itself so that you can use them without having to manually copy the files into your step_definitions directory. This will probably be done in a way that imitates the Factory Girl step definitions
Blacklight has switched to using devise instead of authlogic as its default user/authentication system. As part of this switch, no longer have a “login” attribute as their unique identifier. Instead, you must use email as the unique identifier. We have added a “login” method that
User attributes (first_name, last_name, full_name, affiliation and photo) have been removed from HydraHead.
- Removed Djatoka (JPEG 2000) support and the GetController
- removed fluid infusion javascript
- moved javascripts from the plugin directory. Update your views to remove “:plugin=>:hydra_repository”
- Our sample user “archivist1” is now “[email protected]”.
- Your cucumber features and rspec tests must use email addresses as the unique identifier for Users
Change your features and role_map YAML files accordingly.
The sureest and easiest path to upgrading a hydra head application from Rails 2 to Rails 3, is to start a new project from scratch.
- Create a new rails 3 project
- Add and
gem ‘blacklight’
to the Gemfilegem ‘hydra-head’
- run
bundle install
- cp -r old_project/vendor/plugin/old_project_plugin/app/* new_project/app
- cp -r old_project/vendor/plugin/old_project_plugin/lib/* new_project/lib
<<<<<<< HEAD - copy any tests (test, spec, feature, etc) from the old_project_plugin directory to the new project
- Run the generators
rails g blackight -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
- copy any tests (test, spec, feature, etc) from the old_project_plugin directory to the new project
- update your solrconfig.xml
- update your role_map_…yml files to use appropriate identifiers