Skip to content

Commit 705c68a

Browse files
committed
Merge pull request #21 from btobolaski/grunt-options
Added the ability to specify the target in the gruntfile.
2 parents 8c7f92d + 0f375c2 commit 705c68a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ A string value that represents the directory path (*relative* to your Grunt file
229229

230230
You may wish to have your backups reside outside the current working directory of your Gruntfile. In which case simply provide the relative path eg: ````../../backups````.
231231

232+
#### options.target
233+
234+
Type: `String`
235+
Default value: ``
236+
237+
A string value that represents the default target for the tasks. You can easily override it using the `--target` option
232238

233239
## Contributing
234240

tasks/deployments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function(grunt) {
2525
var task_options = grunt.config.get('deployments')['options'];
2626

2727
// Get the target from the CLI args
28-
var target = grunt.option('target');
28+
var target = grunt.option('target') || task_options['target'];
2929

3030
if ( typeof target === "undefined" || typeof grunt.config.get('deployments')[target] === "undefined") {
3131
grunt.fail.warn("Invalid target specified. Did you pass the wrong argument? Please check your task configuration.", 6);
@@ -69,7 +69,7 @@ module.exports = function(grunt) {
6969
var task_options = grunt.config.get('deployments')['options'];
7070

7171
// Get the target from the CLI args
72-
var target = grunt.option('target');
72+
var target = grunt.option('target') || task_options['target'];
7373

7474
if ( typeof target === "undefined" || typeof grunt.config.get('deployments')[target] === "undefined") {
7575
grunt.fail.warn("Invalid target provided. I cannot pull a database from nowhere! Please checked your configuration and provide a valid target.", 6);

0 commit comments

Comments
 (0)