の奇妙なbeahaviourは(あなたはそれをhereを見つけることができます)、私は次の行とのトラブルを抱えている:、最初のですRailsの3テンプレート:inject_into_file
# 8. config/database.yml modifications
if yes?("Do you want to set the database host to '/var/run/postgresql'?")
inject_into_file "config/database.yml", " host: /var/run/postgresql\n", :after => "development:\n"
# FIXME these two won't work :((((why????
# inject_into_file "config/database.yml", " host: /var/run/postgresql\n", :after => "production:\n"
# inject_into_file "config/database.yml", " host: /var/run/postgresql\n", :after => "test:\n"
# Not finding other solutions, I rewrite the two blocks above with two seds
run %q(sed -i '/test:/a\ \ host: /var/run/postgresql' config/database.yml)
run %q(sed -i '/production:/a\ \ host: /var/run/postgresql' config/database.yml)
end
作品inject_to_file、とのconfig/database.ymlの中で私が
development:
host: /var/run/postgresql
を持っているが、他の2 inject_to_fileが正常に適用されますが、設定/ database.ymlを変更しないでください!だから私はあなたが同じテキストを複数回注入する:force => true
オプションを指定する必要が
と
production:
adapter: postgresql
は、あなたはそれが( '\ r')トリガからの置換を妨げている、あなたの' database.yml'(例えば実行 'OD -c'変な文字や余分な改行などの「明白な」ものではないのですがチェックありファイルにすべてのものがあるはずであることを確認してください)。 – Casper