Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add comment / run bundle install

  • Loading branch information...
commit 179d44704c343bb00ab4d8972a303f05a3831d48 1 parent 7e7306c
@labocho authored
Showing with 32 additions and 23 deletions.
  1. +1 −1  .cleancode
  2. +31 −22 rails-app-template.rb
View
2  .cleancode
@@ -1,4 +1,4 @@
---
:include: ^(Rakefile|Gemfile|Capfile|Guardfile|config\.ru|.*\.(rb|erb|haml|yml|js|coffee|css|scss))$
:exclude: ^(vendor/|public/|.*\.(eml)$)
-:force: false
+:force: true
View
53 rails-app-template.rb
@@ -1,5 +1,6 @@
# encoding: UTF-8
-# Usage: rails new name --template rails-template.rb --skip-test-unit
+
+template_path = "#{File.dirname(__FILE__)}/templates/"
# ====================
# Gems
@@ -9,31 +10,30 @@
gem "kaminari"
gem "rails-i18n"
-template_path = "#{File.dirname(__FILE__)}/templates/"
-
gem_group :development, :test do
gem "debugger"
gem "rspec-rails"
gem "guard-rspec"
gem "guard-spork"
- gem "rb-fsevent"
- gem "growl"
- gem "machinist"
- gem "thin"
-
- gem "turnip"
- gem "capybara-webkit"
- gem "launchy"
- gem "database_cleaner"
-
- gem "ci_reporter"
- gem "simplecov", require: false
- gem "simplecov-rcov", require: false
+ gem "rb-fsevent" # Mac で guard 使うのに必要
+ gem "growl" # guard から growl に通知
+ gem "machinist" # Fixture replacement
+ gem "thin" # WEBrick より早く 1.9.3 で安定
+
+ gem "turnip" # Cucumber と同じ書式の受け入れテストを rspec で実行
+ gem "capybara-webkit" # turnip で JS 含むテストを実行
+ gem "launchy" # turnip でブラウザで確認
+ gem "database_cleaner" # capybara-webkit 使うと transactional_fixture 使えないので代わりに
+
+ gem "ci_reporter" # Jenkins 用にテスト結果を XML で出力
+ gem "simplecov", require: false # コードカバレッジ計測・出力
+ gem "simplecov-rcov", require: false # Jenkins 用にコードカバレッジを rcov 形式で出力
end
generate "rspec:install"
-generate "machinist:install"
+generate "machinist:install" # spec/supports/blueprints.rb
+# spec_helper.rb を置き換え
remove_file "spec/spec_helper.rb"
create_file "spec/spec_helper.rb", File.read(template_path + "spec_helper.rb")
@@ -50,11 +50,11 @@
end
if yes? "Do you use mail?"
- gem "mail-iso-2022-jp"
- gem "action_mailer_config", git: "git://github.com/labocho/action_mailer_config.git"
+ gem "mail-iso-2022-jp" # ActionMailer で ISO-2022-JP のメールを送信可能に
+ gem "action_mailer_config", git: "git://github.com/labocho/action_mailer_config.git" # ActionMailer の設定を mail.yml で
initializer "action_mailer_config.rb", File.read(template_path + "action_mailer_config.rb")
- gem "exception_notification", "~> 2.6.1"
+ gem "exception_notification", "~> 2.6.1" # 例外をメールで通知 / 3.0.0 は Encoding 関係で例外が出る
initializer "exception_notification.rb", File.read(template_path + "exception_notification.rb")
puts <<-EOS
============================================================
@@ -63,20 +63,26 @@
EOS
end
+run "bundle install" # 以下でコマンド実行するため bundle install しておく
+
# ====================
# Logging
# ====================
+# ログを見やすくする
initializer "logger.rb", File.read(template_path + "logger.rb")
# ====================
# application.rb
# ====================
+# application メソッドに複数行の文字列渡すとインデントがおかしくなるので調整
def application_multiline(data, options = {})
indent = options[:env] ? " " : " "
application data.gsub("\n", "\n#{indent}"), options
end
+# rails g scaffold で使用する generator を指定
+# helper / css / js は生成しない
application_multiline <<-RUBY
config.generators do |g|
g.template_engine :haml
@@ -87,6 +93,7 @@ def application_multiline(data, options = {})
end
RUBY
+# spork でクラスリロードするための設定
application_multiline <<-RUBY, env: :test
if Spork.using_spork?
config.cache_classes = true
@@ -107,7 +114,9 @@ def application_multiline(data, options = {})
# template
# ====================
+# lib/templates 下に rails g で使うテンプレートを展開
rake "rails:templates:copy"
+# haml のテンプレートをコピー
directory(template_path + "generators", "lib/generators")
# ====================
@@ -120,5 +129,5 @@ def application_multiline(data, options = {})
# initialize spork, guard
# ====================
-run "spork --bootstrap"
-run "guard init spork rspec"
+run "bundle exec spork --bootstrap" # spec_helper.rb に spork 設定追加
+run "bundle exec guard init spork rspec" # Guardfile 生成
Please sign in to comment.
Something went wrong with that request. Please try again.