Skip to content

linxola/rubyrary

Repository files navigation

Rubyrary

A library showcase website built with Ruby on Rails! To make it look beautiful, Bootstrap was used, along with Cloudinary to process book covers.

Screenshots

Main page
Book page

Features

  • 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.

Getting Started

Requirements:

In order to set up and run the project on your local machine you need this software installed:

  1. Ruby
  2. PostgreSQL
  3. Node.js and yarn

Installation:

Step 1

Clone the project from this repository to your projects folder:

$ cd <your_projects_root_folder>
$ git clone <link_to_rubyrary_repo>
$ cd rubyrary

Step 2

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

Step 3

Install PostgreSQL database.

In order to prevent possible problems with rake db or rails db commands when applying changes to the database, do this:

  1. 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
  1. Find the line with content like: local all postgres peer

  2. Comment it out and paste this line below: local all all md5

  3. Restart your Postgres server:

$ sudo systemctl restart postgresql.service

Step 4

Install NVM, if you don't have it yet.

With NVM, install Node.js:

$ nvm install --lts

Step 5

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

Step 6

Install bundler:

$ gem install bundler

Run bundler to install the project's dependencies:

$ bundle

Step 7

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>

Step 8

Create, migrate and seed the database:

$ rake db:create
$ rake db:migrate
$ rake db:seed

Congratulations, you have set up the project!


Usage

Server

$ rails s # start up
[ctrl + c] # shut down

When up, the project is available on http:://localhost:3000.

Console

$ rails c # start up
> exit # shut down

Code style

$ rubocop

About

A library showcase website

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published