简体   繁体   English

如何在一个命令中运行多个混合任务

[英]How to run multiple mix tasks in one command

I have multiple mix tasks to run in succession. 我有多个mix任务连续运行。 With other build tools, it is possible to run the tasks with a single statement, which saves any startup overhead after the first task. 使用其他构建工具,可以使用单个语句运行任务,从而在第一个任务之后节省任何启动开销。 How can this be done with Elixir's mix command? 如何使用Elixir的mix命令完成这项工作?

Comma-separate the list of tasks, and add them to mix do : mix do task1, task2, task3 : 逗号分隔任务列表,并将它们添加到mix domix do task1, task2, task3

mix do deps.get, run hello.exs, ecto.migrate

For example, the above runs the tasks deps.get , run hello.exs , and ecto.migrate within one invocation of mix . 例如,上面运行任务deps.get ,在一次mix调用中run hello.exsecto.migrate

You can put an aliases in mix.exs and use it. 您可以在mix.exsmix.exs别名并使用它。

Eg: "ecto.setup": ["ecto.create", "ecto.migrate", "ecto.seed"] in this case mix ecto.setup will run create, migrate and seed in order 例如: "ecto.setup": ["ecto.create", "ecto.migrate", "ecto.seed"]在这种情况下混合ecto.setup将按顺序运行create,migrate和seed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM