Status | |
---|---|
GitHub | |
GitLab | |
Code Climate | |
Linting |
A template for starting a new Rails applications. It includes:
- Rails 6.0 application
- Docker image for development and production
- RuboCop Standard linter
- Sorbet type checking
- GitLab and GitHub Actions CI build scripts
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.
Assuming you have Docker installed you get up and running by following the below steps:
-
Click the "Use this Template" button. Alternativly you can just fork or download the of the repository to you local machine.
-
In the repository root directly run the below command build the Docker container:
docker-compose build
- 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
- Create the database
rails db:create
5.) Start the Application
docker-compose up
- 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:
- RuboCop Standard linter:
rake standard
- Sorbet type checking:
srb tc
- 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.
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.
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.
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.