Skip to content

Instantly share code, notes, and snippets.

@c089
Created March 1, 2013 10:57
Show Gist options
  • Save c089/5063913 to your computer and use it in GitHub Desktop.
Save c089/5063913 to your computer and use it in GitHub Desktop.
function determineRubyCommandToUse(done) {
// check to see if native ruby is available, call back with executable name to use
child_process.exec('ruby -v', function (error) {
if (error) {
done('java -jar lib/jruby.jar');
}
done('ruby');
});
}
function ruby(commandLineArgs, done) {
determineRubyCommandToUse(function (command) {
child_process.exec(command + ' ' + commandLineArgs, done)
});
}
grunt.registerTask('ruby-version', function () {
var done = this.async();
ruby('-v', function (error, stdout, stderr) {
console.log(stdout);
done();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment