Skip to content

Instantly share code, notes, and snippets.

@takahiro47
Last active December 23, 2015 04:18
Show Gist options
  • Save takahiro47/6578896 to your computer and use it in GitHub Desktop.
Save takahiro47/6578896 to your computer and use it in GitHub Desktop.

Startup Rails 4 Project

About

  • Using MySQL database
  • Using HAML, CoffeeScript, SASS(SCSS) templates
  • Using

Set ruby version by rbenv

$ rbenv local 2.0.0-p247

Create new Rails 4 project

$ rails new project-name -T -J -d mysql
$

Added my settings, Gemfile and .gitignore

Gemfile

source 'https://rubygems.org'

## System Packages
## ---------------------------------------------------------------------
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use mysql as the database for Active Record
gem 'mysql2'
# Use mongoDB as the subsidiary database
gem 'bson_ext'
gem 'mongo'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby

# Use Templete for html
gem 'haml'
gem "haml-rails"

# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'
gem 'less-rails'
gem 'compass-rails', github: 'Compass/compass-rails', branch: 'rails4-hack'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use Javascript Libraries
gem 'jquery-rails'
gem 'bootstrap-sass'
gem 'font-awesome-rails'

# Turbolinks makes following links in your web application faster.
# Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
 # bundle exec rake doc:rails generates the API under doc/api.
 gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
gem 'unicorn'

# Use Capistrano for deployment
gem 'capistrano', group: :development

# Use debugger
gem 'debugger', group: [:development, :test]
gem 'better_errors'
gem 'binding_of_caller'
# gem 'tapp'

group :development, :test do
 gem 'factory_girl_rails'
 gem 'pry-rails'
 gem 'rspec-rails', '>= 2.14.0'
 gem 'spring'
end

# Loads environment variables from .env into ENV
gem 'dotenv-rails', group: [:development, :test]
# Ruby web server that glues together 3 of the best Ruby libraries
# in web history: the Mongrel parser, the root of Mongrel speed and security
gem 'thin'
# Parse and format HTTP link headers as described in the draft spec,
# also the equivalent HTML link elements.
gem 'link_header'
# Simple configuration and settings solution
gem 'settingslogic'
# Turns off the Rails asset pipeline log
gem 'quiet_assets'
# Strong Parameters(Replace )
# gem 'strong_parameters'

## Functions
## ---------------------------------------------------------------------
# Amazon SES
gem 'aws-ses'

# Amazon
# ref: http://hakutoitoi.hatenablog.com/entry/2013/03/06/013753
# => S3にassetsを配置しつつcapistranoでdeployする
# (assets:precompileした時に自動的にassetsファイルを指定のストレージに配置してくれる)
gem 'asset_sync'

# Guard performance GUI
gem 'newrelic_rpm'

# Slideshare
gem 'carrierwave'
gem 'fog'

# Administration
gem 'rails_admin'

# Authentication
gem 'devise', github: 'plataformatec/devise', branch: 'master'
gem 'omniauth'
gem 'omniauth-facebook'
# gem 'omniauth-twitter'
# gem 'omniauth-github'
# gem 'omniauth-identity'

# Certificate
gem 'certified'

# Markdown
gem 'redcarpet'
# gem 'pygments.rb'
# gem 'rubypython'

# Translation
gem 'i18n_generators'

# Pagenater
gem 'kaminari'

.gitignore

# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile '~/.gitignore_global'


## OS generated files
## -------------------------------------------
# Linux
.*
!.gitignore
*~

# Caches
.DS_Store
.AppleDouble
.LSOverride
Icon

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Microsoft Windows
ehthumbs.db
Thumbs.db


## Ruby
## -------------------------------------------
*.gem
*.rbc
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp


## Rails
## -------------------------------------------
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore bundler config.
/.bundle
.config
/config/database.yml
/config/newrelic.yml


## bower
## -------------------------------------------
!.bowerrc
/vendor/assets/components


## YARD artifacts
## -------------------------------------------
.yardoc
_yardoc
doc/


## SASS, SCSS
## -------------------------------------------
.sass-cache


## vi / vim
## -------------------------------------------
.swap


## Git
## -------------------------------------------
!.keep
!.gitkeep


# Ignore all logfiles and tempfiles.
## -------------------------------------------
/log/*.log
/tmp


## Sublime Text
## -------------------------------------------
sftp-config.json
*.sublime-project
*.sublime-workspace

Bundle Install

$ bundle

Rewrite files into custom template with Haml, Coffee, SASS

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require_tree .

Startup Rails 4 Project

About

  • Using MySQL database
  • Using HAML, CoffeeScript, SASS(SCSS) templates
  • Using

Set ruby version by rbenv

$ rbenv local 2.0.0-p247

Create new Rails 4 project

$ rails new project-name -T -J -d mysql
$

Added my settings, Gemfile and .gitignore

Gemfile

source 'https://rubygems.org'

## System Packages
## ---------------------------------------------------------------------
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use mysql as the database for Active Record
gem 'mysql2'
# Use mongoDB as the subsidiary database
gem 'bson_ext'
gem 'mongo'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby

# Use Templete for html
gem 'haml'
gem "haml-rails"

# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'
gem 'less-rails'
gem 'compass-rails', github: 'Compass/compass-rails', branch: 'rails4-hack'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use Javascript Libraries
gem 'jquery-rails'
gem 'bootstrap-sass'
gem 'font-awesome-rails'

# Turbolinks makes following links in your web application faster.
# Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
 # bundle exec rake doc:rails generates the API under doc/api.
 gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
gem 'unicorn'

# Use Capistrano for deployment
gem 'capistrano', group: :development

# Use debugger
gem 'debugger', group: [:development, :test]
gem 'better_errors'
gem 'binding_of_caller'
# gem 'tapp'

group :development, :test do
 gem 'factory_girl_rails'
 gem 'pry-rails'
 gem 'rspec-rails', '>= 2.14.0'
 gem 'spring'
end

# Loads environment variables from .env into ENV
gem 'dotenv-rails', group: [:development, :test]
# Ruby web server that glues together 3 of the best Ruby libraries
# in web history: the Mongrel parser, the root of Mongrel speed and security
gem 'thin'
# Parse and format HTTP link headers as described in the draft spec,
# also the equivalent HTML link elements.
gem 'link_header'
# Simple configuration and settings solution
gem 'settingslogic'
# Turns off the Rails asset pipeline log
gem 'quiet_assets'
# Strong Parameters(Replace )
# gem 'strong_parameters'

## Functions
## ---------------------------------------------------------------------
# Amazon SES
gem 'aws-ses'

# Amazon
# ref: http://hakutoitoi.hatenablog.com/entry/2013/03/06/013753
# => S3にassetsを配置しつつcapistranoでdeployする
# (assets:precompileした時に自動的にassetsファイルを指定のストレージに配置してくれる)
gem 'asset_sync'

# Guard performance GUI
gem 'newrelic_rpm'

# Slideshare
gem 'carrierwave'
gem 'fog'

# Administration
gem 'rails_admin'

# Authentication
gem 'devise', github: 'plataformatec/devise', branch: 'master'
gem 'omniauth'
gem 'omniauth-facebook'
# gem 'omniauth-twitter'
# gem 'omniauth-github'
# gem 'omniauth-identity'

# Certificate
gem 'certified'

# Markdown
gem 'redcarpet'
# gem 'pygments.rb'
# gem 'rubypython'

# Translation
gem 'i18n_generators'

# Pagenater
gem 'kaminari'

.gitignore

# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile '~/.gitignore_global'


## OS generated files
## -------------------------------------------
# Linux
.*
!.gitignore
*~

# Caches
.DS_Store
.AppleDouble
.LSOverride
Icon

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Microsoft Windows
ehthumbs.db
Thumbs.db


## Ruby
## -------------------------------------------
*.gem
*.rbc
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp


## Rails
## -------------------------------------------
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore bundler config.
/.bundle
.config
/config/database.yml
/config/newrelic.yml


## bower
## -------------------------------------------
!.bowerrc
/vendor/assets/components


## YARD artifacts
## -------------------------------------------
.yardoc
_yardoc
doc/


## SASS, SCSS
## -------------------------------------------
.sass-cache


## vi / vim
## -------------------------------------------
.swap


## Git
## -------------------------------------------
!.keep
!.gitkeep


# Ignore all logfiles and tempfiles.
## -------------------------------------------
/log/*.log
/tmp


## Sublime Text
## -------------------------------------------
sftp-config.json
*.sublime-project
*.sublime-workspace

Bundle Install

$ bundle

Rewrite files into custom template with Haml, Coffee, SASS

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require_tree .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment