Bundle exec rake是什么意思? [英] What does bundle exec rake mean?

查看:95
本文介绍了Bundle exec rake是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?

推荐答案

bundle exec Bundler 命令,用于在当前上下文中执行脚本捆绑包(来自目录 Gemfile 的捆绑包)。 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.

为什么?我将引用捆绑商页面


在某些情况下,如果可执行文件恰好安装在您的系统中并且没有插入任何与之冲突的gem,在没有 bundle exec 的情况下运行可执行文件可能会起作用。您的捆绑包。

In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your 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是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆