Created
February 1, 2014 19:34
-
-
Save srgrn/8757441 to your computer and use it in GitHub Desktop.
Using grunt to run python koans on change
This file contains 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
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(); | |
}); | |
}); | |
}; |
This file contains 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
{ | |
"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