问题描述
bundle exec rake db:migrate
是什么意思?还是只是 bundle exec rake< command>
?
What does bundle exec rake db:migrate
mean? Or just bundle exec rake <command>
in general?
我知道 bundle
负责维护Gemfile中的内容。我知道 exec一词的含义。我知道 rake
保留了您可以执行的所有不同脚本操作,而且我知道 db:migrate
是其中之一那些。我只是不知道所有这些词在干什么。为什么要使用 bundle
来执行 rake
来执行数据库迁移?
I understand that bundle
takes care of maintaining things in the Gemfile. I know what the word "exec" means. I understand that rake
maintains all the different scripty things you can do, and I know that db:migrate
is one of those. I just don't know what all these words are doing together. Why should bundle
be used to execute rake
to execute a database migrate?
推荐答案
是命令,用于在当前上下文中执行脚本捆绑包(来自目录的捆绑包)。 rake db:migrate
是脚本,其中 db 是名称空间, migrate 是定义的任务名称。
bundle exec
is a Bundler command to execute a script in the context of the current bundle (the one from your directory's Gemfile). rake db:migrate
is the script where db is the namespace and migrate is the task name defined.
因此 bundle exec rake db:migrate
用命令 db:migrate 执行rake脚本。 code>在当前包的上下文中。
So bundle exec rake db:migrate
executes the rake script with the command db:migrate
in the context of the current bundle.
为什么?我将引用:
但是,这是不可靠的,也是造成巨大痛苦的原因。即使它看起来可以工作,将来也可能无法在另一台机器上工作。
However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.
这篇关于Bundle exec rake是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!