Skip to content

curationexperts/mahonia

Repository files navigation

Mahonia

Mahonia aquifolium image Mahonia aquifolium: Electronic Theses & Dissertations

Build Status Coverage Status Dependency Status

Developer Setup

  1. Change to your working directory for new development projects cd .
  2. Clone this repo git clone https://github.com/curationexperts/mahonia.git
  3. Change to the application directory cd mahonia
  4. bundle install under project's current ruby (2.4.2)
  5. Start redis redis-server & note: use & to start in the background, or run redis in a new terminal session
  6. Setup your database. We use PostgreSQL. To support the test and development environments, you'll need have Postgres installed and running. Ensure that your current user can create databases in postgres. In the psql console do create role [username] with createdb login. Then do bundle exec rake db:setup to create the databases.
  7. Start solr and fedora (in new tabs) bundle exec solr_wrapper and bundle exec fcrepo_wrapper.
  8. Create a default admin set. To add a new work from the dashboard, you will need to setup a default admin set. You do this by running this rake task: rake hyrax:default_admin_set:create.

You can now run the test suite with bundle exec rake ci, or start a development server with bundle exec rake hydra:server.

How to create an admin user on the console

(See https://github.com/samvera/hyrax/wiki/Making-Admin-Users-in-Hyrax for more details)

  1. Connect to the rails console and follow this script (note that if you are on a production instance you'll need RAILS_ENV=production bundle exec rails c):
bundle exec rails c
2.4.2 > u = User.new
2.4.2 > u.email = "fake@example.com"
2.4.2 > u.display_name = "Jane Doe"
2.4.2 > u.password = "123456"
2.4.2 > u.save
 => true
2.4.2 > u.add_role("admin")
2.4.2 > u.admin?
 => true
  1. If the object won't save, or isn't working as expected, you can check the errors like this:
2.4.2 :015 > u = User.new
2.4.2 :016 > u.email = "fake@example.com"
2.4.2 :017 > u.save
 => false
2.4.2 :018 > u.errors.messages
 => {:email=>["has already been taken"], :password=>["can't be blank"], :orcid=>[]}