有没有办法在不运行先决条件的情况下运行 rake 任务?
我是否缺少命令行开关?
目前我必须这样做:
#task :install => :build do
task :install do
end
Is there a command line switch I'm missing?
At the moment I'm having to do this:
#task :install => :build do
task :install do
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我似乎通过简单地以“taskname_no_preconditions”格式添加额外任务来解决这个问题。因此,例如在下面的代码中执行“rake install_no_preconditions”不会导致执行“build”。
I seem to have solved this problem by simply adding extra tasks in the format "taskname_no_prerequisites". So for example in the code below executing "rake install_no_prerequisites" would not cause "build" to be executed.
如果您定义了对任务的依赖关系,则该任务将始终首先运行。但是,您可以单独创建任务,然后将它们与另一个任务聚合在一起,如下所示:
然后您可以独立调用构建或安装任务,或者使用 go 任务运行序列。
事实上,我经常这样做。它使我可以非常方便地在需要时运行单独的步骤,并在需要时拥有更大的步骤序列。
if you define a dependency on a task, it will always be run first. However, you can create your tasks individually and then aggregate them together with another task, like this:
and then you can call the build or install tasks independently, or run the sequence with the go task.
i do this a lot, actually. it makes it very convenient for me to run individual steps when i want to, and have the larger sequence of steps when i need them.