Mahonia aquifolium: Electronic Theses & Dissertations
|
- Change to your working directory for new development projects
cd .
- Clone this repo
git clone https://github.com/curationexperts/mahonia.git
- Change to the application directory
cd mahonia
bundle install
under project's current ruby (2.4.2)- Start redis
redis-server &
note: use&
to start in the background, or run redis in a new terminal session - 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 docreate role [username] with createdb login
. Then dobundle exec rake db:setup
to create the databases. - Start solr and fedora (in new tabs)
bundle exec solr_wrapper
andbundle exec fcrepo_wrapper
. - 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
.
(See https://github.com/samvera/hyrax/wiki/Making-Admin-Users-in-Hyrax for more details)
- 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
- 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=>[]}