Skip to content
/ ruby_templates Public template

Templates for common files/configs I use in Ruby projects

Notifications You must be signed in to change notification settings

dmarcoux/ruby_templates

Repository files navigation

Templates for common files/configs I use in Ruby projects.

How to Use This Template

  1. Create a new repository based on this repository:
  • Go to this repository's page, click on the Use this template button and follow instructions.

    OR

  • With GitHub's CLI, run gh repo create NEW_REPOSITORY_NAME --template=dmarcoux/ruby_templates.

  1. Search for CHANGEME in the newly created repository to adapt it to your needs.

  2. Remove Gemfile.lock since it's only in this repository to be able to test the GitHub Actions configuration.

Automated dependency updates. Details in the config.

Linters, specs and more. Details in the files under .github/workflows.

nix-shell for Ruby

Reproducible development environment for Ruby projects which relies on Nix, a purely functional and cross-platform package manager.

Usage

  1. Copy shell.nix at the root of your Ruby project.
  2. Add the content of .gitignore to your own .gitignore.
  3. Start with nix-shell --pure.

Docker and Docker Compose

Minimal setup for a Rails application with the following features:

  • Caching installation of gems within a Docker volume
  • PostgreSQL database
  • Redis in-memory database
  • Keep command history for Bash, IRB and Pry (files created by a rake task)

Usage

  • Start the web application which is available at http://localhost:3000: docker-compose up web_app
  • Start shell inside the web application container: docker-compose run --rm --service-ports web_app bash
  • To generate a Rails project from scratch inside the container:
    # Install rails to be able to run `rails new`
    gem install rails
    # Generate Rails project as usual...
    rails new my_app
  • Run specific specs: docker-compose run web_app bash -c 'bundle exec rspec spec/models/user_spec.rb:12'
  • Create and migrate the database for development and only load the schema for test: docker-compose run web_app bash -c 'bundle exec rake db:create db:migrate && RAILS_ENV=test bundle exec rake db:test:load'

setup_example_files.sh

Quickly setup example files under config/ by running ./setup_example_files.sh

About

Templates for common files/configs I use in Ruby projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages