Code Monkey home page Code Monkey logo

rails-template's Introduction

Rails 6 Template

Status
GitHub
GitLab Gitlab pipeline status coverage report
Code Climate Maintainability Test Coverage
Linting Ruby Style Guide

A template for starting a new Rails applications. It includes:

Since it uses Docker the only thing you need installed on your development machine is Docker and your favorite Rails IDE. No need to install Ruby, Yarn, etc. Tested in my development environments of Ubuntu 18.04 LTS and Macos Mojave (10.14).

If you tried it and have any suggestions or imporvements please let know by opening an issue or pull request.

Development Environment Setup

Assuming you have Docker installed you get up and running by following the below steps:

  1. Click the "Use this Template" button. Alternativly you can just fork or download the of the repository to you local machine.

  2. In the repository root directly run the below command build the Docker container:

docker-compose build
  1. Run the continer. The Docker image base is Ruby Alpine Linux so we use sh instead of bash. Also when you first run this command it will pull down the Postgres Docker image.
docker-compose run web sh
  1. Create the database
rails db:create

5.) Start the Application

docker-compose up
  1. In a web browser navigate to http://localhost:3000 and you should see the home page.

I would also recommend running the following linter, typechecker, and unit tests. All the command should be run in the Docker container and should return no errors:

  1. RuboCop Standard linter:
rake standard
  1. Sorbet type checking:
srb tc
  1. Rails unit tests:
rails db:test:prepare
rails test

If you run into any issues or have any questions let me know by opening an issue.

RubyMine IDE Setup

Open up the project in RubyMine then navigate to the Settings->Languages & Frameworks->Ruby SDK and Gems. Then click the plus sign and add a new Remote Interperter. Choose Docker Compose with the following settings:

Server: Docker (create a new one if emtpy)
Configuration file(s): ./docker-compose.yml
Service: web
Environment variables: <leave blank>
Ruby of version manager path: ruby

Now you should be able to run/debug the application. If something is not working let me know by opening and issue.

Sorbet Init

If you run into an issue about libglib-2.0.so.0 when running srb init then you need to comment out the webdrivers gem in the Gemfile.

CI

There is a base GitLab automated build script and GitHub Actions script included in this template. It will build the docker image, run the Sorbet type checker, then run the tests. You can see the GitLab build in action here.

Why GitLab and GitHub? I use GitLab to store some of my private repos.

rails-template's People

Contributors

mrbiggred avatar dependabot[bot] avatar matt-riemer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.