Search code examples
gruntjswebstorm

Suggest deploy path in a Grunt task


I have a Grunt task to automatize the deploy of my webapp on webserver. On My webserver I have 3 paths:

  • /www/myApp (production)
  • /www/myApp_rc

I have a package.json file

{
 ...
  "ftpDeployPath":"myApp_rc"   //or /www/myApp
...
}

and this is my task

{'ftp-deploy': {
                toMyServer: {
                    auth: {
                        host: '10.7.88.87',
                        port: 21,
                        authKey: 'key1'
                    },

                    src: 'deploy',
                    dest: '<%= pkg.ftpDeployPath %>',
                    forceVerbose: true
                }
            }

}

When I want deploy, every time I have to check and eventually edit package.json file. Is there any way to show a prompt (bu grunt console) to allow me to select the right deploy path?


Solution

  • You can probably try using grunt-prompt task with 'input' question type and your "ftpDeployPath" as 'config'. Or, modify your gruntfile to use command line options (http://gruntjs.com/frequently-asked-questions#dynamic-alias-tasks) and run your tasks as external tools from WebStorm (Settings | Tools | External tools) - you can add $Prompt$ macro to tool parameters to get a prompt for option value when running a tool