Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Codeminer42/Punchclock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Punchclock

A simple electronic punch clock to track hours spent on projects.

Ruby Maintainability Test Coverage

Dependencies

Ruby 3.1
Rails 7.0
Postgres >= 13.7
Node 16.13.1
Yarn >= 1.22.19

Installing

$ git clone git@github.com:Codeminer42/Punchclock.git
$ cd Punchclock
$ Install Postgres
$ Install Redis
$ Install Yarn as a global dependency (npm i -g yarn@1.22.19)
$ bin/setup

Database

After installation steps the following admin users will be created in database

  1. An Admin User
E-mail:   admin@codeminer42.com
Password: password

Adding new Javascript

Javascript with ES6 syntax should be compiled by webpack instead of sprockets as of now. The Javascript may work in development mode in modern browsers, but it will break in production mode, be aware.

Running

Server

Run it on development mode using thin

$ foreman start -f Procfile.dev

To enable guard-livereload, you need to install the LiveReload extension on your browser.

In another terminal, start Guard:

$ bundle exec guard

After that, start the extension on your browser. You'll see a browser connection browser on the terminal.

Freely make your changes and the page will be refreshed after you save it.

Docker environment for development

Install the docker and docker compose plugin versions:

  • Docker ~>v20.10
  • Docker compose plugin ~>v2.10
$ cp config/database.yml.example config/database.yml
$ docker compose build
$ docker compose run --rm app bin/setup

Useful commands

Access Rails console:

$ docker compose run --rm app rails c

If you want to run tests:

$ docker compose run --rm app bundle exec rspec

Now run the servers:

$ docker compose up

Testing

This app uses RSpec, Factory Girl, Forgery and Faker to fake reality. Please read betterspecs.org.

At first time:

$ bundle exec rake db:migrate

Running tests:

$ bundle exec rake spec

Running with Guard:

$ bundle exec guard

Debugging

To debug this app, follow the following steps, for more details about debugging with pry, read the official documentation here: https://pry.github.io/ .

Running with foreman

At the point of code that you want to debug, add:

binding.remote_pry

Run you application, the app should stop at the point that you added binding.remote_pry.

In you terminal, run:

$ bundle exec pry-remote

Now you will get the piece of code where you can debug.

Running with rails server

At the point of code that you want to debug, add:

binding.pry

Run you application, the app should stop at the point that you added binding.pry and you will get the piece of code where you can debug.

Debugguing a test

At the point of code that you want to debug, add:

binding.pry

In you terminal, run:

$ bundle exec rspec <PATH_TO_FILE>

Exiting the debug mode

To exit the pry console, type:

To hard exit:

-> !!!

To soft exit:

-> exit

License

Copyright 2013-2021, Codeminer 42.

Punchclock is made available under the Affero GPL license version 3, see LICENSE.txt.