Last active
September 21, 2015 05:48
-
-
Save akiyoshi83/85ee0fc1959cae65e925 to your computer and use it in GitHub Desktop.
2015年春のrails new ref: http://qiita.com/akiyoshi83/items/0062d84942dc1f354947
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inherit_from: .rubocop_todo.yml | |
AllCops: | |
Exclude: | |
- db/schema.rb | |
- tmp/**/* | |
- .bundle/**/* | |
- bin/* | |
- config/initializers/*.rb | |
# ブロック前後の空行を許可 | |
Style/EmptyLinesAroundBlockBody: | |
Enabled: false | |
# 引数前のスペースは複数許可 | |
Style/SingleSpaceBeforeFirstArg: | |
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generator | |
config.generators do |g| | |
g.assets false | |
g.helper false | |
g.test_framework :rspec, | |
view_specs: false, | |
helper_specs: false, | |
fixture: true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Cause.log_with_sql = true | |
ActiveRecord::Cause.log_mode = :all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails _4.2.0_ new app_name --skip-bundle --skip-test-unit --database=mysql | |
# 短く書くと | |
rails _4.2.0_ new app_name -B -T -d mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<EOF > config/initializers/rack_profiler.rb | |
if Rails.env == 'development' | |
require 'rack-mini-profiler' | |
Rack::MiniProfilerRails.initialize!(Rails.application) | |
end | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<EOF > config/initializers/peek.rb | |
Peek.into Peek::Views::Rblineprof | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*= require peek | |
*= require peek/views/rblineprof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= require peek | |
//= require peek/views/rblineprof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle install --path .bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rbenv使ってるので | |
echo "2.2.0" > .ruby-version | |
# rspecの初期化 | |
bin/rails g rspec:install | |
echo "--format documentation" >> .rspec | |
# Guard+rspec | |
bin/bundle exec guard init rspec | |
# Guard+rubocop | |
bin/bundle exec guard init rubocop | |
# rubocopの初期ルールを生成するため先に除外するファイルを指定 | |
cat <<EOF > .rubocop.yml | |
AllCops: | |
Exclude: | |
- db/schema.rb | |
- tmp/**/* | |
- .bundle/**/* | |
- bin/* | |
- config/initializers/*.rb | |
EOF | |
# railsが生成したファイルのコーディング規約エラーを除外 | |
# .rubocop_todo.ymlが作成される | |
bin/bundle exec rubocop --auto-gen-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bin/rails c した時の表示を改善 | |
cat <<EOF > .pryrc | |
require "awesome_print" | |
AwesomePrint.pry! | |
begin | |
require 'hirb' | |
rescue LoadError | |
# Missing goodies, bummer | |
end | |
if defined? Hirb | |
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling | |
Hirb::View.instance_eval do | |
def enable_output_method | |
@output_method = true | |
@old_print = Pry.config.print | |
Pry.config.print = proc do |*args| | |
Hirb::View.view_or_page_output(args[1]) || @old_print.call(*args) | |
end | |
end | |
def disable_output_method | |
Pry.config.print = @old_print | |
@output_method = nil | |
end | |
end | |
Hirb.enable | |
end | |
EOF | |
# binにguardを追加 | |
bin/bundle binstubs guard | |
# spring対応 | |
bin/bundle exec spring binstub --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ここより上はデフォルトのままのことが多い | |
# slim | |
gem 'slim-rails' | |
# 環境ごとの定数管理 | |
gem 'rails_config' | |
gem 'dotenv-rails' | |
# 認証 | |
gem 'sorcery' | |
# 管理画面 | |
gem 'rails_admin' | |
# 補足されない例外をメール送信 | |
gem 'exception_notification' | |
# ページネーション | |
gem 'kaminari' | |
# パンくず | |
gem 'gretel' | |
group :development, :test do | |
# この2つは最初から入ってる | |
# beybugはpry-beybugがあるので外す | |
gem 'web-console', '~> 2.0' | |
gem 'spring' | |
gem 'spring-commands-rspec' | |
# console | |
gem 'pry-byebug' | |
gem 'pry-doc' | |
gem 'pry-rails' | |
gem 'pry-stack_explorer' | |
gem 'awesome_print' | |
gem 'hirb-unicode' | |
# guard | |
gem 'guard' | |
gem 'guard-rspec' | |
# lint | |
gem 'guard-rubocop' | |
# ログ出力整形 | |
gem 'quiet_assets' | |
# パラメータ、SQL整形 | |
# gem 'rails-flog' # いらん気がしてきた | |
# エラー画面拡張 | |
gem 'better_errors' | |
gem 'binding_of_caller' | |
end | |
group :development do | |
# クエリ発行箇所特定 | |
gem 'activerecord-cause' | |
# N+1問題検出 | |
gem 'bullet' | |
# 行毎のプロファイラ | |
gem 'peek-rblineprof' | |
# 簡易プロファイラ | |
gem 'rack-mini-profiler', require: false | |
end | |
group :test do | |
gem 'rspec-rails' | |
gem 'factory_girl_rails' | |
gem "poltergeist" | |
gem "database_cleaner" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard :rspec, cmd: "bundle exec rspec" do | |
↓ | |
guard :rspec, cmd: "bin/rspec" do |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment