Giter Club home page Giter Club logo

rails-template's Introduction

sahli-interactive/rails-template

Description

Originally Forked from mattbrictson/rails-template, now based on m43nu/rails-template branch v2

This is the application template that We use for Rails 6+ projects.

Requirements

This template currently works with:

  • Rails 6.0.x
  • PostgreSQL

If you need help setting up a Ruby development environment, check out Go Rails' Rails Setup Guide.

Installation

Optional.

To make this the default Rails application template on your system, create a ~/.railsrc file with these contents:

-d postgresql
-m https://raw.githubusercontent.com/sahli-interactive/rails-template/master/template.rb

Usage

This template assumes you will store your project in a remote git repository (e.g. Bitbucket or GitHub) and that you will deploy to a production environment. It will prompt you for this information in order to pre-configure your app, so be ready to provide:

  1. The git URL of your (freshly created and empty) Bitbucket/GitHub repository
  2. The hostname/url for your app.

To generate a Rails application using this template, pass the -m option to rails new, like this:

rails new blog \
  -d postgresql \
  -m https://raw.githubusercontent.com/sahli-interactive/rails-template/master/template.rb

Remember that options must go after the name of the application. The only database supported by this template is postgresql.

If you’ve installed this template as your default (using ~/.railsrc as described above), then all you have to do is run:

rails new blog

What does it do?

The template will perform the following steps:

  1. Generate your application files and directories
  2. Ensure bundler is installed
  3. Create the development and test databases
  4. Commit everything to git
  5. Push the project to the remote git repository you specified

What is included?

These gems are added to the standard Rails stack

  • Core
    • sidekiq – Redis-based job queue implementation for Active Job
    • webpacker - Javascripts & Stylesheets via Webpack
    • rack-cache - simple Caching for Rails (only Production)
    • rails-i18n - general Translations for Rails
  • Configuration
    • dotenv – in place of the Rails secrets.yml
  • Utilities
    • annotate – auto-generates schema documentation
    • better_errors – useful error pages with interactive stack traces
    • foreman - manage Procfile-based applications (start webpacker, sidekiq and Rails with one command)
    • inline_svg - display SVGs inline
    • mailgunner - use mailgun for transactional emails
    • rails_real_favicon - generate Favicons and a manfiest.json for your app
    • unpoly - an unobtrusive JavaScript framework for server-side web applications
    • whenever - Cron jobs in Ruby
  • Optional
    • alchemy_cms - Rails CMS
    • alchemy_devise - Devise-User Management for AlchemyCMS
    • [alchemy-richmedia-essences][] - Video- and Audio-Essences for AlchemyCMS
    • bootstrap-form - Form-Builder for bootstrap-Styles

mailgun

Action Mailer is configured to use mailgun to send emails. You can change this by editing environments/production.rb.

bootstrap integration (optional)

bootstrap-related features are opt-in. To apply these to your project, answer "yes" when prompted.

  • bootstrap-themed scaffold templates
  • Application layout that includes Bootstrap-style navbar and boilerplate
  • View helpers for generating common Bootstrap markup
  • Form-Builder with Bootstrap-Styles bootstrap-form

AlchemyCMS integration (optional)

AlchemyCMS-related features are opt-in. To apply these to your project, answer "yes" when prompted.

  • Installs AlchemyCMS, AlchemyCMS-Devise
  • Application layout ready to use with AlchemyCMS
  • Custom config.yml
  • Patch a few shortcomings and Bugs in the current Release

Other tweaks that patch over some Rails shortcomings

  • A much-improved bin/setup script
  • Log rotation so that development and test Rails logs don’t grow out of control

Plus lots of documentation for your project

  • README.md
  • PROVISIONING.md and DEPLOYMENT.md for Capistrano (optional)

How does it work?

This project works by hooking into the standard Rails application templates system, with some caveats. The entry point is the template.rb file in the root of this repository.

Normally, Rails only allows a single file to be specified as an application template (i.e. using the -m <URL> option). To work around this limitation, the first step this template performs is a git clone of the sahli-interactive/rails-template repository to a local temporary directory.

This temporary directory is then added to the source_paths of the Rails generator system, allowing all of its ERb templates and files to be referenced when the application template script is evaluated.

Rails generators are very lightly documented; what you’ll find is that most of the heavy lifting is done by Thor. The most common methods used by this template are Thor’s copy_file, template, and gsub_file. You can dig into the well-organized and well-documented Thor source code to learn more.

rails-template's People

Contributors

mattbrictson avatar m43nu avatar peperoli 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.