Advertisement
Varun_Krishna

grunt-shell

Nov 25th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. grunt-shell
  2. //Gruntfile.js
  3. module.exports= function(grunt){
  4.     grunt.initConfig({
  5.         pack: grunt.file.readJSON('package.json'),
  6.         shell:{//task
  7.             listFolders: {  //Target
  8.                 options:{   //options
  9.                     stdout:true
  10.                 },
  11.                 command:'ls'
  12.             },// end of target list folders
  13.             makedir: {  
  14.                     command:'mkdir test'
  15.             },
  16.             multiple : {
  17.                 command: [
  18.                     'mkdir Sample',
  19.                     'cd Sample',
  20.                     'ls'
  21.                 ].join('&&')
  22.             }
  23.         }
  24.  
  25.     });
  26.     grunt.loadNpmTasks('grunt-shell');
  27.     grunt.registerTask('default',['shell']);
  28.     grunt.registerTask('makedir',['shell']);
  29.     grunt.registerTask('multi',['shell:multiple']);
  30.    
  31. };
  32. //package.json
  33. {
  34.   "name": "Grunt_Shelljs",
  35.   "version": "0.0.1",
  36.   "description": "Used for running Shell commands in gruntjs",
  37.   "main": "index.js",
  38.   "scripts": {
  39.     "test": "echo \"Error: no test specified\" && exit 1"
  40.   },
  41.   "keywords": [
  42.     "Unix",
  43.     "Commands",
  44.     "shell",
  45.     "commands",
  46.     "for",
  47.     "gruntjs"
  48.   ],
  49.   "author": "Varun Krishna. P",
  50.   "license": "BSD-2-Clause",
  51.   "devDependencies": {
  52.     "grunt": "~0.4.2",
  53.     "grunt-shell": "~0.6.1"
  54.   }
  55.  
  56. }
  57. I'm running under windows, so the ls command is not working if I call the task.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement