Juan Rodriguez 63acab3cf7 Dokku deploy setup (#1)
* fix: remove config.key from Dockerfile

* refactor: remove redis

* chore: update README

* feat: precompile assets on build Dockerfile
2023-03-26 19:00:09 +02:00
2021-06-15 15:39:44 -05:00
2021-06-13 08:01:12 -05:00
2021-06-16 10:24:33 -05:00
2021-06-13 16:28:45 -05:00
2023-03-26 19:00:09 +02:00
2021-06-13 09:05:20 -05:00
2021-06-13 09:05:20 -05:00
2021-06-13 09:05:20 -05:00
2021-06-13 16:28:45 -05:00
2021-06-13 09:01:22 -05:00
2021-06-13 16:28:45 -05:00
2021-06-13 09:05:20 -05:00
2021-06-13 16:28:45 -05:00
2021-06-13 10:46:52 -05:00
2023-03-26 19:00:09 +02:00
2021-06-13 20:36:39 -05:00
2021-06-14 11:46:25 -05:00
2023-03-26 19:00:09 +02:00
2023-03-26 19:00:09 +02:00
2023-03-26 19:00:09 +02:00
2021-06-14 11:46:25 -05:00
2021-06-14 00:41:53 -05:00
2021-06-13 10:46:52 -05:00
2023-03-26 19:00:09 +02:00
2021-06-14 00:41:53 -05:00
2021-06-14 08:24:34 -05:00

URL shortener

image

Features

  • Create link model (make sure to create a index for the slug and click counter)
  • Generate unique slug
  • Link unit tests
  • Stimulus setup
  • Link controller (handle redirection)
  • Main page with input box
  • Create user model
  • User unit tests
  • Add userId key to link model
  • Login and logout (sessions)
  • User links view
  • Modals layout
  • Deployment CI

How to run

Development

  • Run migrations
docker-compose up -d db
docker-compose run --rm app bundle exec rails db:migrate
  • Run
docker-compose up

Testing

docker-compose run --rm app bundle exec rails test

Rubocop

docker-compose run --rm app bundle exec rubocop 

Results

Testing

Finished in 2.211344s, 9.9487 runs/s, 10.4009 assertions/s.
22 runs, 23 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for Minitest to /usr/src/app/coverage. 81 / 81 LOC (100.0%) covered.

COVERAGE: 100.00% -- 81/81 lines in 8 files
BRANCH COVERAGE: 100.00% -- 20/20 branches in 8 branches

+----------+-------------------------------------------+-------+--------+---------+-----------------+----------+-----------------+------------------+
| coverage | file                                      | lines | missed | missing | branch coverage | branches | branches missed | branches missing |
+----------+-------------------------------------------+-------+--------+---------+-----------------+----------+-----------------+------------------+
| 100.00%  | app/controllers/application_controller.rb | 3     | 0      |         | 100.00%         | 0        | 0               |                  |
| 100.00%  | app/controllers/links_controller.rb       | 23    | 0      |         | 100.00%         | 8        | 0               |                  |
| 100.00%  | app/controllers/sessions_controller.rb    | 17    | 0      |         | 100.00%         | 4        | 0               |                  |
| 100.00%  | app/controllers/users_controller.rb       | 16    | 0      |         | 100.00%         | 4        | 0               |                  |
| 100.00%  | app/helpers/sessions_helper.rb            | 3     | 0      |         | 100.00%         | 0        | 0               |                  |
| 100.00%  | app/models/application_record.rb          | 2     | 0      |         | 100.00%         | 0        | 0               |                  |
| 100.00%  | app/models/link.rb                        | 13    | 0      |         | 100.00%         | 4        | 0               |                  |
| 100.00%  | app/models/user.rb                        | 4     | 0      |         | 100.00%         | 0        | 0               |                  |
+----------+-------------------------------------------+-------+--------+---------+-----------------+----------+-----------------+------------------+

Rubocop

Inspecting 43 files
...........................................

43 files inspected, no offenses detected
  • Dokku deployment
 bundle exec rails assets:precompile
 bundle exec rails db:migrate
S
Description
Fast, lightweight, self-hosted URL shortener service with minimal click tracking
Readme MIT 59 MiB
Languages
Crystal 98.7%
Dockerfile 1.3%