A library showcase website built with Ruby on Rails! To make it look beautiful, Bootstrap was used, along with Cloudinary to process book covers.
- All books in the library, apart from title and description, can have several authors, a cover and belong to one or several book groups.
- A public part that can be seen by even non-logged-in users:
- Users can see all the books listed with covers and brief info, filter them with group tags and open the detailed page of any book to see its cover, title, author and description.
- If the user is logged in and has basic access rights, they can also upload their books, edit info about them, and see & change their account data.
- Admin users in the public part can also edit and delete other people's books.
- An admin part that is visible only to authenticated users with the appropriate access rights:
- There are several sections: user administration and author administration.
- In the author administration section, admins are also able to see the books of the selected author.
- There are also several levels of admins: admin with the maximum level of rights, book moderator with rights limited to book editions, and group moderator with the rights only to change book groups.
In order to set up and run the project on your local machine you need this software installed:
- Ruby
- PostgreSQL
- Node.js and yarn
Clone the project from this repository to your projects folder:
$ cd <your_projects_root_folder>
$ git clone <link_to_rubyrary_repo>
$ cd rubyrary
Install one of the tools for ruby version management (if you don't have it yet) - RVM or rbenv
Install Ruby 3.0.2 version:
with RVM:
$ rvm install 3.0.2
$ rvm use 3.0.2
or with rbenv:
$ rbenv install 3.0.2
$ rbenv local 3.0.2
Install PostgreSQL database.
In order to prevent possible problems with rake db
or rails db
commands
when applying changes to the database, do this:
- Open the postgres config file with your text editor (nano, vim etc...)
If you're on Debian / Ubuntu:
$ sudo <text_editor> /etc/postgresql/<version>/main/pg_hba.conf
If you're on Fedora:
$ sudo <text_editor> /var/lib/pgsql/data/pg_hba.conf
-
Find the line with content like:
local all postgres peer
-
Comment it out and paste this line below:
local all all md5
-
Restart your Postgres server:
$ sudo systemctl restart postgresql.service
Install NVM, if you don't have it yet.
With NVM, install Node.js:
$ nvm install --lts
After Node.js install, enable yarn through enabling Corepack:
$ corepack enable
Or through installing it with npm:
$ npm install --global yarn
Install necessary yarn dependencies:
$ yarn install
Install bundler:
$ gem install bundler
Run bundler to install the project's dependencies:
$ bundle
Install direnv to manage the ENV variables and create an .envrc
file with these ENV variables:
export DB_USERNAME=<value>
export DB_PASSWORD=<value>
export CLOUDINARY_NAME=<value>
export CLOUDINARY_KEY=<value>
export CLOUDINARY_SECRET=<value>
Create, migrate and seed the database:
$ rake db:create
$ rake db:migrate
$ rake db:seed
Congratulations, you have set up the project!
$ rails s # start up
[ctrl + c] # shut down
When up, the project is available on http:://localhost:3000.
$ rails c # start up
> exit # shut down
$ rubocop