Skip to content

Instantly share code, notes, and snippets.

@srgrn
Created February 1, 2014 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srgrn/8757441 to your computer and use it in GitHub Desktop.
Save srgrn/8757441 to your computer and use it in GitHub Desktop.
Using grunt to run python koans on change
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
files: ['./koans/*.py'],
tasks: ['pythonrun']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('pythonrun',"runs the python comand",function(){
var exec = require('child_process').exec;
var cb = this.async();
exec('python.exe ./contemplate_koans.py', {cwd: '.'}, function(err, stdout, stderr) {
grunt.log.write(stdout);
cb();
});
});
};
{
"name": "learnPython",
"version": "0.0.0",
"description": "just for grunt",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/srgrn/python_koans.git"
},
"author": "",
"license": "BSD",
"bugs": {
"url": "https://github.com/srgrn/python_koans/issues"
},
"devDependencies": {
"grunt-contrib-watch": "~0.5.3",
"grunt": "~0.4.2",
"grunt-contrib-commands": "~0.1.6"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment