Skip to content

wahanegi/clever-calculator

Repository files navigation

Welcome to the Clever Calculator app

Introduction

The Clever Calculator app is a customizable sales calculator for businesses. An admin section allows for a sales manager to create and modify products and services with default pricing. Members of their sales team can then assemble quotes for individual customers with a user-friendly interface.


Table of Contents


Technologies and System dependencies

  • Ruby 3.4.1
  • Rails 8.0.1
  • PostgreSQL 16.2
  • Bootstrap 5.3.3
  • React.js 19.0.0
  • esbuild 0.24.2 (for JavaScript bundling)

Additional Files

.ruby-version and .ruby-gemset are used to specify the Ruby version and gemset for consistency across environments.

Installation (MacOS)

Prerequisites

  1. Install the latest version of XCode from the App store, run the following command in terminal:

    xcode-select --install
    
  2. Install the latest version of Homebrew: http://brew.sh

  3. Install Dependencies for Compiling Ruby Install the required packages for building Ruby. On macOS, run:

    brew install openssl readline zlib
    
  4. Install Git on Mac using homebrew:

    brew install git
    
  5. Set your GIT username from terminal:

    git config --global user.name "YOUR NAME"
    
  6. Set your GIT email address from terminal:

    git config --global user.email "YOUR EMAIL ADDRESS"
    

Getting started

  1. Clone the repository:

    git clone https://github.com/wahanegi/clever-calculator.git
    
    cd clever-calculator
    
  2. Install the latest version of RVM: https://rvm.io

  3. Compile Ruby with Custom Options Since precompiled binaries aren’t available, tell RVM to compile Ruby:

    rvm install 3.4.1 --with-openssl-dir=$(brew --prefix openssl)
    
  4. Specify the Ruby version you want to use:

    rvm use ruby-3.4.1
    
  5. Create a gemset named clever-calculator:

    rvm gemset create clever-calculator
    
  6. Switch to your newly created gemset:

    rvm gemset use clever-calculator
    
  7. Install PostgreSQL in terminal:

    brew install postgresql
    
  8. Start the PostgreSQL service:

    brew services start postgresql
    
  9. Verify installation

    psql --version
    
  10. Install dependencies with Bundler:

    bundle install
    
  11. Install JavaScript dependencies with Yarn:

    yarn install
    
  12. Set up the database:

    rails db:create db:migrate
    
  13. Start the server:

    bin/dev
    

Rubymine Support for Rubocop (Code Linting)

Code Linting gives formatting and syntax suggestions to make your code more readable. In Rubymine go to: Rubymine -> Preferences -> Editor -> Inspections -> Ruby -> Gems and gems management -> Rubocop Make sure that the checkbox is checked.

Usage

Visit http://localhost:3000 after running the server.

Environment Variables

Create a .env file in the root directory and include:

DATABASE_USERNAME=your_username
DATABASE_PASSWORD=your_password

Testing

Run tests with:

bundle exec rspec

License

This project is licensed under the MIT License.