[英]How do I call a Cake file from a Rake file, or a Make file, or some combination of these?
So, I have a cake file for building my Coffeescript (thanks to https://github.com/krismolendyke/InstantJasmineCoffee ). 因此,我有一个用于构建Coffeescript的蛋糕文件(感谢https://github.com/krismolendyke/InstantJasmineCoffee )。 I also have a directory full of SCSS based on Compass, which I call with a quick "compass compile," which comes from a Ruby gem.
我也有一个完整的基于Compass的SCSS目录,我称之为快速“指南针编译”,它来自Ruby gem。
Is there a way to call "compass compile" from within my Cake file, or a way to call my Cake file from within a Rake file, or a Make file that can do both, or something else entirely? 有没有一种方法可以从我的Cake文件中调用“罗盘编译”,或者有一种方法可以从Rake文件或可以同时执行这两个操作的Make文件中调用我的Cake文件,或者完全可以进行其他操作? What's the easiest way to do all of my compilations?
完成所有编译的最简单方法是什么?
As a Rakefile is just ruby source, you can use system
, eg. 由于Rakefile只是ruby源,因此可以使用
system
。
description "Compile"
task :compile do
system "compass compile"
end
radiospiel has shown how you could run compass
or cake
from a Rake
file. radiospiel已经展示了如何从
Rake
文件中运行compass
或cake
。 To call compass
or rake
from a Cakefile
, you'd write something like this: 要从
Cakefile
调用compass
或rake
,您可以编写如下代码:
{exec} = require 'child_process'
exec 'compass compile'
(Replace compass compile
with whatever system command you want to run.) Note that this would, by default, suppress the output from the command; (将
compass compile
为您要运行的任何系统命令。)请注意,默认情况下,这将禁止该命令的输出。 you should probably use a callback to log that output. 您可能应该使用回调记录该输出。 See the Node docs on child_process.exec for details.
有关详细信息,请参见child_process.exec上的Node文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.