Created
March 1, 2013 10:57
-
-
Save c089/5063913 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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