Skip to content

shivabhusal/useful_rails_templates

Repository files navigation

Some really Useful Rails Templates

You can find some very useful rails templates to generate boiler plate codes in your Rails app. You can send Pull Requests for some useful templates that can be useful for others as well.

You can use these templates on already existing application as well.

Basic Scaffold for App setup [For Dev and Test mode]

This will do the following

  • Add gems rspec, slim-rails, annotate, zeus, pry, rspec-rails, faker, database_cleaner, factory_girl_rails, shoulda-matchers and rails-controller-testing to your Gemfile.

    Note: But this will not add twice, it will add only if there is not already.

    Will add necessary config files to spec/support/ for above mentioned gems to be used in test-mode. Will install the bundle and install RSpec as well.

Usage

$ rails app:template LOCATION=https://raw.githubusercontent.com/shivabhusal/useful_rails_templates/master/test_template.rb

# Short Form
$ rails app:template LOCATION=https://goo.gl/f6P7ne app_setup=true

Make sure you are on root directory of your application.

Generate Database config database.yml per requirement

This is pretty useful when you generated your app without specifying -d=database_name, Rails configure your app with sqlite3, but your requirement is mysql. Or, you were knowingly using mysql but needed to move to pg.

How to get the initial database.yml file so that you can modify it?

Usage

For MySQL

$ rails app:template LOCATION=https://raw.githubusercontent.com/shivabhusal/useful_rails_templates/master/database_template.rb db=mysql

# Short Form
$ rails app:template LOCATION=https://goo.gl/9s8NV6 db=mysql

For PG

$ rails app:template LOCATION=https://raw.githubusercontent.com/shivabhusal/useful_rails_templates/master/database_template.rb db=pg

# Short form
$ rails app:template LOCATION=https://goo.gl/9s8NV6 db=pg

For SQLite3

$ rails app:template LOCATION=https://raw.githubusercontent.com/shivabhusal/useful_rails_templates/master/database_template.rb db=sqlite

# Short form
$ rails app:template LOCATION=https://goo.gl/9s8NV6 db=sqlite

Mailer setup 📧

Will add gem premailer-rails to Gemfile and set config in config/application.rb. Use command

 $ rails app:template LOCATION=https://raw.githubusercontent.com/shivabhusal/useful_rails_templates/master/mailer_template.rb
 
 # Short Form
 $ rails app:template LOCATION=https://goo.gl/iG8NS9 mailer=true

Figaro Configs : config/application.yml

Use command

 $ rails app:template LOCATION=https://raw.githubusercontent.com/shivabhusal/useful_rails_templates/master/figaro_template.rb

 # Short Form
 $ rails app:template LOCATION=https://goo.gl/BVvfZb figaro=true

Generate usable .gitignore file

Use command

 $ rails app:template LOCATION=https://raw.githubusercontent.com/shivabhusal/useful_rails_templates/master/gitignore_template.rb

 # Short Form
 $ rails app:template LOCATION=https://goo.gl/ukw7zK gitignore=true

About

You can find some very useful rails templates to generate boiler plate codes in your Rails app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages