作業ノート

様々なまとめ、雑感など

rakeと環境変数ENV

# Rakefile
task :default do
    p ENV['foo']
    p ENV['bar']
    p ENV['hoge']
end

コマンド実行時に変数と値のセットを指定すると、環境変数ENVに値が設定される。

$ rake foo=foo bar=1 hoge=/path/to/hoge
(in /path/to/rakefile)
"foo"
"1"
"/path/to/hoge"