Skip to content

Instantly share code, notes, and snippets.

@oleg-voloshyn
Last active January 28, 2020 06:49
Show Gist options
  • Save oleg-voloshyn/5896523 to your computer and use it in GitHub Desktop.
Save oleg-voloshyn/5896523 to your computer and use it in GitHub Desktop.
Create new Ruby on Rails project

Before must be installed this

Step #1

rails new project_name --skip-test-unit

Step #2

cd project_name

Step #3
In Gemfile add next gems:

gem 'mysql2'  
gem 'slim-rails'  
gem 'simple_form' 
gem 'twitter-bootstrap-rails'   

In group group :development add next gem:

gem 'thin'

In group group :development, :test add next gems:

gem 'rspec'  
gem 'rspec-rails'  
gem 'factory_girl_rails'  
gem 'ffaker'  
gem 'shoulda-matchers'  
gem 'simplecov', require: false  
gem 'fuubar'  
gem 'pry'  

Delete gem

gem 'sqlite3' 

Information about gems

gem 'mysql2' A modern, simple and very fast Mysql library
gem 'slim-rails' A lightweight templating engine
gem 'simple_form' SimpleForm - Rails forms made easy
gem 'thin' A very fast & simple Ruby web server
gem 'rspec' Behaviour Driven Development framework
gem 'rspec-rails' Testing framework for rails
gem 'factory_girl_rails' Fixtures replacement with a straightforward definition syntax
gem 'ffaker' Library for generating fake data
gem 'shoulda-matchers' Collection of testing matchers extracted
gem 'simplecov', require: false Code coverage tool
gem 'fuubar' RSpec progress bar formatter
gem 'pry' An IRB alternative and runtime developer console
gem 'twitter-bootstrap-rails' Bootstrap for Rails Asset Pipeline
gem 'sqlite3' Use sqlite3 as the database for Active Record

Step #4

bundle  

rails generate simple_form:install  

rails generate simple_form:install --bootstrap  

rails generate rspec:install  

rails generate bootstrap:install static  

Add in spec_helper

require 'simplecov'
SimpleCov.start 'rails'

For gem fuubar add config in file .rspec:

--format Fuubar  
--color  

Step #5
Add line in application.js

//= require bootstrap   

Step #6
Add line in appliction.css

@import 'bootstrap';    
.translation_missing { color: red; background: black; }

Step #7
Add in aplication.rb

config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**/*.yml').to_s]  

Step #8
Change database.yml

defaults: &defaults
  adapter: mysql2
  encoding: utf8
  reconnect: true
  pool: 5
  username: root
  password: password

development:
  <<: *defaults
  database: myapp_dev

test:
  <<: *defaults
  database:  myapp_test

After run nex command:

rake db:create && rake db:migrate && rake db:test:clone

Step #9

rails generate controller Welcome index  

Remove in config/routes next line:

get "welcome/index"  

and add next line:

root to: 'welcome#index'  

Step #10

Change in config/development.rb next line:

config.assets.debug = true  

on

config.assets.debug = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment