简体   繁体   中英

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 ). 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.

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? What's the easiest way to do all of my compilations?

As a Rakefile is just ruby source, you can use system , eg.

description "Compile"
task :compile do
    system "compass compile"
end 

radiospiel has shown how you could run compass or cake from a Rake file. To call compass or rake from a Cakefile , you'd write something like this:

{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; you should probably use a callback to log that output. See the Node docs on child_process.exec for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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