homebrew brew doctorトラブルシューティング

Snow LeopardからLion にアップグレードしたついでにbrew doctorしてみたらWarningのオンパレード。せっかくなのでトラブルシューティングをまとめました。
brewが表示してくれる通りに対処すればいいので、めんどくさいだけで難しくはない。


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!

原因:
Homebrewアップデートしてね

対処法
brew update コマンドでHomebrewのアップデート

brew update

-- 実行結果
me-no-MacBook-Air:~ hazu$ brew update
Updated Homebrew from 2e65c804 to fe41fa14.
==> New Formulae
chordii	     isl	  rtf2latex2e
==> Updated Formulae
akka		      czmq		    gnu-prolog		  libslax		open-mesh	      readosm		    whirr
auto-scaling	      darner		    gnutls		  libspatialite		openvpn		      redis		    wiggle
autoconf-archive      dovecot		    go			  libyaml		parallel	      riemann		    wireshark
bsdconv		      duply		    groonga		  lighttpd		pari		      root		    xmlrpc-c
cairo		      ec2-api-tools	    guile		  mathomatic		parrot		      ruby-build	    xrootd
cassandra	      elixir		    hadoop		  metaproxy		pgbouncer	      scala		    yaz
cdo		      erlang		    haproxy		  monetdb		pianobar	      spatialite-gui	    yazpp
cfengine	      findutils		    help2man		  mongodb		pure		      spatialite-tools	    yeti
class-dump	      fish		    icu4c		  mpich2		pygtk		      spin		    ykpers
clhep		      fox		    iso-codes		  nagios		python		      swi-prolog	    youtube-dl
cloog		      freeimage		    jenkins		  newlisp		python3		      the_silver_searcher
concurrencykit	      geoserver		    jruby		  nginx			qemu		      tomcat
css-crush	      gforth		    juise		  nmap			rakudo-star	      vim
curl		      glm		    librasterlite	  node			rasqal		      vtk
==> Deleted Formulae
vimeo-downloader


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Your XQuartz (2.6.2) is outdated
Please install XQuartz 2.7.4.

原因:
XQuartzがないよ

対処法
XQuartzをインストール
http://xquartz.macosforge.org/landing/から、XQuartz-2.7.4.dmg をダウンロードしてインストールする


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools for Xcode" package provided by Apple.

原因:
Xcodeのコマンドラインツールがインストールされていない

対処法
Finder アプリケーションフォルダ > Xcodeを開く > ヘッドバーのXcode > Preferences... > Downloads > Command Line Toolsをインストール


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: You have leftover files from an older version of Xcode.
You should delete them using:
  /Developer/Library/uninstall-developer-folder

原因:
古いバージョンのXcodeが存在する

対処法
コマンドラインから、下記コマンドを実行して削除する

sudo /Developer/Library/uninstall-developer-folder

-- 実行結果
me-no-MacBook-Air:~ hazu$ sudo /Developer/Library/uninstall-developer-folder
Password:
パスワード入力
Use of uninitialized value $pkgutil_volume_basename in concatenation (.) or string at /Developer/Library/uninstall-developer-folder line 35.
Start time: 2012年 12月 6日 木曜日 00時07分52秒 JST
Analyzing devtools package: 'com.apple.pkg.ApplicationLoaderLeo'...
Analyzing devtools package: 'com.apple.pkg.DashcodeLeo'...
Analyzing devtools package: 'com.apple.pkg.DevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DevSamplesLeo'...
Analyzing devtools package: 'com.apple.pkg.DevToolsDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperDiskImage4_3'...
Analyzing devtools package: 'com.apple.pkg.DeveloperDiskImageReleased'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsCLILeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsLeo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.5Leo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.6Leo'...
Analyzing devtools package: 'com.apple.pkg.MacOSXSupportPluginLeo'...
Analyzing devtools package: 'com.apple.pkg.OpenGLAppsLeo'...
Analyzing devtools package: 'com.apple.pkg.OtherDevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.X11DocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.clangLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0Leo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2Leo'...
Analyzing devtools package: 'com.apple.pkg.iPhoneDocumentation'...
Analyzing devtools package: 'com.apple.pkg.iPhoneHostSideTools'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1_3'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_1'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_3'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDKSnowLeopardExtras'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDKTools'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK3_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_1'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_3'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDKTools'...
Analyzing devtools package: 'com.apple.pkg.llvm-gcc4.2Leo'...
Removing devtools files...
Removing generated files...
Removing Xcode Caches...
find: /var/folders/d6/v8phdwn950n0jgr9rn10__4m0000gn/C/com.apple.DeveloperTools: No such file or directory
Removing Xcode Documentation...
Removing empty devtools directories...
Finish time: 2012年 12月 6日 木曜日 00時15分38秒 JST


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:

    byobu
    gnu-sed
    pidof
    python
    xz

原因:
link切れてるよ

対処法
brew linkコマンドでlinkを貼り直す

brew link app名

-- 実行結果
me-no-MacBook-Air:~ me$ brew link byobu
Linking /usr/local/Cellar/byobu/3.28... 77 symlinks created
me-no-MacBook-Air:~ me$ brew link gnu-sed
Linking /usr/local/Cellar/gnu-sed/4.2.1... 2 symlinks created
me-no-MacBook-Air:~ me$ brew link pidof
Linking /usr/local/Cellar/pidof/0.1.4... 0 symlinks created
me-no-MacBook-Air:~ me$ brew link python
Linking /usr/local/Cellar/python/2.7.2... 
4711 symlinks created
me-no-MacBook-Air:~ me$ brew link xz
Linking /usr/local/Cellar/xz/5.0.4... 53 symlinks created


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:

    brew install bsdmake coreutils fontconfig pcre

Run `brew missing` for more details.

原因:
依存ツールファイルがないよ

対処法
表示されたコマンドを打って
依存ツールファイルをインストール

brew install bsdmake coreutils fontconfig pcre

-- 実行結果
me-no-MacBook-Air:~ me$ brew install bsdmake coreutils fontconfig pcre
==> Downloading http://opensource.apple.com/tarballs/bsdmake/bsdmake-24.tar.gz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file Makefile.dist
patching file mk/bsd.README
patching file mk/bsd.cpu.mk
patching file mk/bsd.doc.mk
patching file mk/bsd.obj.mk
patching file mk/bsd.own.mk
patching file mk/bsd.port.mk
patching file mk/bsd.port.subdir.mk
patching file mk/sys.mk
patching file pathnames.h
patching file dir.c
patching file dir.h
patching file main.c
==> make -f Makefile.dist
/usr/local/Cellar/bsdmake/24: 31 files, 336K, built in 12 seconds
==> Downloading http://ftpmirror.gnu.org/coreutils/coreutils-8.20.tar.xz
######################################################################## 100.0%
==> Patching
patching file Makefile.in
==> ./configure --prefix=/usr/local/Cellar/coreutils/8.20 --program-prefix=g
==> make install
==> Caveats
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:

    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:

    MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

==> Summary
/usr/local/Cellar/coreutils/8.20: 208 files, 9.4M, built in 3.8 minutes
==> Downloading http://fontconfig.org/release/fontconfig-2.10.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/fontconfig-2.10.1.tar.gz
==> Patching
patching file src/fcarch.h
==> ./configure --with-add-fonts=/Library/Fonts,~/Library/Fonts --prefix=/usr/local/Cellar/fontconfig/2.10.1
==> make install
/usr/local/Cellar/fontconfig/2.10.1: 439 files, 5.6M, built in 88 seconds
==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.bz2
######################################################################## 100.0%
######################################################################## 100.0%==> ./configure --prefix=/usr/local/Cellar/pcre/8.31 --enable-utf8 --enable-unicode-properties --enable-pcregrep-libz --enable-pcregrep-libbz2
==> make test
==> make install
/usr/local/Cellar/pcre/8.31: 131 files, 3.2M, built in 97 seconds


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    2to3
    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack
    gitk
    idle
    pgrep
    pkill
    pydoc
    python
    python-config
    python2.7
    python2.7-config
    pythonw
    pythonw2.7
    smtpd.py
    sqlite3

Consider amending your PATH so that /usr/local/bin
occurs before /usr/bin in your PATH.

原因:
パスがちゃんと設定されていない

me-no-MacBook-Air:~ me$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

!/usr/binが/usr/local/binより前に読み込まれている

対処法
パスを設定し直す

export PATH=/usr/local/bin:$PATH


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

me-no-MacBook-Air:~ me$ brew doctor
Your system is raring to brew.

これで完了。
やったー!終わったー!!

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


先週/今週の任意の曜日の日付を取得する (e.g.今週の月曜日、先週の月曜日を取得する)

今週の月曜日を取得する。

this_day = Date.today
this_monday = this_day - (this_day.wday - 1) # 今週の月曜日
last_monday = (this_day - (this_day.wday - 1)) - 7 # 先週の月曜日

--実行結果
[1] pry(main)> this_day = Date.today
=> Wed, 05 Dec 2012
[2] pry(main)> this_monday = this_day - (this_day.wday - 1)
=> Mon, 03 Dec 2012
[24] pry(main)> last_monday = (this_day - (this_day.wday - 1)) - 7
=> Mon, 26 Nov 2012


ポイントは、wdayメソッドで日付を曜日分逆算すること。

Time#wdayメソッドの戻り値は、曜日を数値にした値です。
0(日曜日)〜6(土曜日)の値を返します。

[1] pry(main)> Time.now.strftime("%A")
=> "Wednesday"
[2] pry(main)> Time.now.wday
=> 3

日曜日 => 0
月曜日 => 1
火曜日 => 2
水曜日 => 3
木曜日 => 4
金曜日 => 5
土曜日 => 6


応用編

今週の任意の曜日の取得

this_sunday = this_day - (this_day.wday) # 今週の日曜日
this_monday = this_day - (this_day.wday - 1) # 今週の月曜日
this_tuesday = this_day - (this_day.wday - 2) # 今週の火曜日
this_wednesday = this_day - (this_day.wday - 3) # 今週の水曜日 ← 現在
this_thursday = this_day - (this_day.wday - 4) # 今週の木曜日 ↓ 未来 (未来日でも、”-"して取得する)
this_friday = this_day - (this_day.wday - 5) # 今週の金曜日
this_saturday = this_day - (this_day.wday - 6) # 今週の土曜日

--実行結果
[1] pry(main)> this_day = Date.today
=> Wed, 05 Dec 2012
[2] pry(main)> this_sunday = this_day - (this_day.wday)
=> Sun, 02 Dec 2012
[3] pry(main)> this_monday = this_day - (this_day.wday - 1) 
=> Mon, 03 Dec 2012
[4] pry(main)> this_tuesday = this_day - (this_day.wday - 2) 
=> Tue, 04 Dec 2012
[5] pry(main)> this_wednesday = this_day - (this_day.wday - 3) 
=> Wed, 05 Dec 2012
[6] pry(main)> this_thursday = this_day - (this_day.wday - 4)
=> Thu, 06 Dec 2012
[7] pry(main)> this_friday = this_day - (this_day.wday - 5)
=> Fri, 07 Dec 2012
[8] pry(main)> this_saturday = this_day - (this_day.wday - 6)
=> Sat, 08 Dec 2012

先週の任意の曜日の取得
更にそこから - 7 すると先週の日付が求められる。

last_sunday = this_sunday - 7
last_monday = this_monday - 7
last_tuesday = this_tuesday - 7
last_wednesday = this_wednesday - 7
last_thursday = this_thursday - 7
last_friday = this_friday - 7
last_this_saturday = this_saturday - 7

--実行結果
[9] pry(main)> last_sunday = this_sunday - 7
=> Sun, 25 Nov 2012
[10] pry(main)> last_monday = this_monday - 7
=> Mon, 26 Nov 2012
[11] pry(main)> last_tuesday = this_tuesday - 7
=> Tue, 27 Nov 2012
[12] pry(main)> last_wednesday = this_wednesday - 7
=> Wed, 28 Nov 2012
[13] pry(main)> last_thursday = this_thursday - 7
=> Thu, 29 Nov 2012
[14] pry(main)> last_friday = this_friday - 7
=> Fri, 30 Nov 2012
[15] pry(main)> last_this_saturday = this_saturday - 7
=> Sat, 01 Dec 2012
[16] pry(main)> 

ハッシュからeach_with_indexでkeyとvalとindexを取り出す。

ハッシュにeach_with_indexを使う場合は |(key,val),i| を覚えておくといい。

下記のようなハッシュオブジェクトで、each_with_indexを使う場合、

desserts = {
  "a" => "apple pie",
  "b" => "baumkuchen",
  "c" => "chocolate cake"}

obj.each_with_index do |obj,i| で各要素とインデックスを同時に取り出すことができるが、要素(obj)のハッシュオブジェクトは配列に変換されてしまう。

desserts.each_with_index do |obj,i|
  =i
  =dessert
  =dessert.class
  =","
end

>> 0 ["a", "apple pie"] Array , 1 ["b", "baumkuchen"] Array , 2 ["c", "chocolate cake"] Array

ハッシュオブジェクトでなくなった要素のkeyとvalに指定した値を取り出すには、配列のインデックスをいちいち指定するしかないのか??

desserts.each_with_index do |obj,i|
  =i
  =dessert[0]
  =dessert[1]
  =","
end

>> 0 "a" "apple pie" , 1 "b" "baumkuchen" , 2 "c" "chocolate cake" ,

と思っていたが、下記のように |(key,val),i| のような書き方ができる。

desserts.each_with_index do |(key,val),i|
  =i
  =key
  =val
  =","
end

>> 0 "a" "apple pie" , 1 "b" "baumkuchen" , 2 "c" "chocolate cake" ,

limitをチェーンしたときのcountの戻り値に注意

Failures:

  1) CampaignsQuestion#answers 最新回答一覧が取得できること
     Failure/Error: @answers[:latest].size.should eq 15
       
       expected: 15
            got: 30
       
       (compared using ==)
     # ./spec/models/campaigns_question_spec.rb:58:in `block (3 levels) in <top (required)>'
 describe "#default_comments" do
    before do
      content = Factory(:content)      
      15.times{Factory(:comment,:question => content)}

      @content_comments = content.default_comments
    end
    
    it '最新回答一覧が取得できること' do
      @answers[:latest].size.should eq 15
    end

  end

contentオブジェクトは1311のcommentオブジェクトを持っている

content = Content.find(1)
content.count
=> 1311

limit(10)でcommentの数が10であることを期待するが、戻り値は1311となる。

content.comment.limit(10).count
=> 1311

しかし、sqlを確認すると、10件取得するクエリができている。

content.comments.limit(10).to_sql
=> "SELECT  `comments`.* FROM `comments` WHERE (`comments`.content_id = 1 ) LIMIT 10"

gitではじめにやっておく設定

ユーザーの設定

me-no-MacBook-Pro:me$ git config --global user.name "my_name"
me-no-MacBook-Pro:me$ git config --global user.email "my@email.com"

gitコマンドを省略したいので、エイリアスの設定

me-no-MacBook-Pro:me$ git git config --global alias.
me-no-MacBook-Pro:me$ git config --global alias.co checkout
me-no-MacBook-Pro:me$ git config --global alias.st 'status'
me-no-MacBook-Pro:me$ git config --global alias.di 'diff'
me-no-MacBook-Pro:me$ git config --global alias.b 'branch'
me-no-MacBook-Pro:me$ git config --global alias.f 'flow'
me-no-MacBook-Pro:me$ git config --global alias.ff 'flow feature'
me-no-MacBook-Pro:me$ git config --global alias.fh 'flow hotfix'
me-no-MacBook-Pro:me$ git config --global alias.fr 'flow release'
me-no-MacBook-Pro:me$ git config --global alias.t 'tag'

FactoryGirlのfactoryファイルにcolorという名前のカラムの記述があると、erb2hamlが原因でrakeタスクがこける。

migrationコマンドをうつと、wrong number of arguments (1 for 2)でマイグレーションができない。
traceログをみるとなぜかfactoryファイルの下記の記述のうち、"color"の行で落ちている。

# coding: utf-8
FactoryGirl.define do
  factory :campaigns_question do
    sequence(:note) {|n| "test#{n}"}
    color "gray"
    background "#fff"
  end
end
my-MacBook-Air:myapp bismar$ bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
wrong number of arguments (1 for 2)
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/erb2haml-0.1.2/lib/erb2haml/railties/erb2haml.rake:8:in `color'
/Users/bismar/myapp/spec/factories/campaigns_questions.rb:11:in `block (2 levels) in <top (required)>'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/syntax/default.rb:22:in `instance_eval'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/syntax/default.rb:22:in `factory'
/Users/bismar/myapp/spec/factories/campaigns_questions.rb:3:in `block in <top (required)>'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/syntax/default.rb:16:in `instance_eval'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/syntax/default.rb:16:in `run'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/syntax/default.rb:7:in `define'
/Users/bismar/myapp/spec/factories/campaigns_questions.rb:2:in `<top (required)>'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:236:in `load'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:236:in `block in load'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:225:in `block in load_dependency'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:597:in `new_constants_in'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:236:in `load'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/find_definitions.rb:20:in `block (2 levels) in find_definitions'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/find_definitions.rb:19:in `each'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/find_definitions.rb:19:in `block in find_definitions'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/find_definitions.rb:15:in `each'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl-2.3.2/lib/factory_girl/find_definitions.rb:15:in `find_definitions'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-1.4.0/lib/factory_girl_rails/railtie.rb:23:in `block in <class:Railtie>'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/lazy_load_hooks.rb:34:in `call'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/lazy_load_hooks.rb:42:in `each'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/application/finisher.rb:46:in `block in <module:Finisher>'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/initializable.rb:25:in `instance_exec'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/initializable.rb:25:in `run'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/initializable.rb:50:in `block in run_initializers'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/initializable.rb:49:in `each'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/initializable.rb:49:in `run_initializers'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/application.rb:134:in `initialize!'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/application.rb:77:in `method_missing'
/Users/bismar/myapp/config/environment.rb:6:in `<top (required)>'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:242:in `require'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:242:in `block in require'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:225:in `block in load_dependency'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:597:in `new_constants_in'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.14/lib/active_support/dependencies.rb:242:in `require'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/application.rb:103:in `require_environment!'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/railties-3.0.14/lib/rails/application.rb:218:in `block in initialize_tasks'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/bismar/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/bismar/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/Users/bismar/myapp/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate => environment


つい先日、hamlを導入した際、rakeタスクで自動でerbファイルをhamlに変換してくれるgem、erb2hamlを導入したが、変換後もgemは消さずに残しておいた。これが原因だった。

colorの記述があると、"erb2haml / lib / erb2haml / railties / erb2haml.rake"に記述されてる"color"メソッドと見なされ、エラーになってしまう。

当然、erb2hamlを消したらエラーが解消した。

erb2haml、らくちんでいいやと思って導入したが、結構雑な作りなのでおすすめはしない。
ファイルの指定もできないので、後で知ってこっちの方がよかったかもと思った。↓
http://screencasts.org/episodes/using-haml-with-rails-3