LoginSignup
6
7

More than 5 years have passed since last update.

Rails new でいつもの準備を済ませる

Last updated at Posted at 2015-01-11

詳細は Rails Application Templates — Ruby on Rails Guides 参照のこと

下の設定で:

  • .gitignore にvim, rails 用の記述を追加
  • Guardfile の初期化
  • Gemfile に各種gem を追記
  • Rails 向けRSpec の初期化
  • Rubocop 設定ファイルの配置
  • git add . & commit -m 'Initial commit' 済

から作業を始められる

※テンプレートの名称は自由。rails new のときに別にテンプレートを指定した場合はそちらが優先される

~/.railsrc
--skip-test-unit
--template=https://github.com/**user_name/repo_name**/raw/master/.rails_application_template.rb # remote url or local path
some_where_to_github_repo/.rails_application_template.rb
gem_group :doc do
  gem 'yard'
end

gem 'rb-readline'
gem 'slim-rails'

gem_group :development do
  gem 'rubocop', require: false
  gem 'guard'
# ...
end

gem_group :development, :test do
  gem 'rspec-rails'
# ...
end

gem_group :test do
  gem 'timecop'
# ...
end

after_bundle do
  run 'mv README.rdoc README.md'
  run 'curl https://www.gitignore.io/api/vim,rails > .gitignore'
  run 'curl -L https://github.com/gouf/dotfiles/raw/master/.rubocop.yml > .rubocop.yml'
  run 'bundle exec guard init rspec'
  run 'bundle exec guard init rails_best_practices'
  run 'bundle exec guard init rubocop'
  run 'bundle exec rails generate rspec:install'

  git :init
  git add: '.'
  git commit: "-a -m 'Initial Commit'"
end
6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7