如何自动为foreman和rake命令添加前缀?

时间:2014-02-04 08:38:46

标签: ruby-on-rails ruby bash heroku foreman

当我在Rails项目中时,如何避免输入

foreman run rails console

每一次?换句话说,有没有办法自动为railsrake命令添加foreman run

1 个答案:

答案 0 :(得分:2)

使用bash函数:

rails () {
    if test current directory is in a rails project  # left as an exercise
    then
        foreman run rails "$@"
    else
        command rails "$@"
    fi
}