@@ -120,8 +120,6 @@ gulp.task('webstorm', function (done) {
120120 // Find the yargs instance that is most appropriate for the given command line parameters
121121 cliArgs = validateLaunchPath ( yargs . resolveArgv ( ) ) ;
122122
123- cliArgs = config . get ( ) ;
124-
125123 // set defaults
126124 if ( cliArgs . defaults ) {
127125 ( ( cliArgs . defaults === 'reset' ) ? config . revert ( ) : config . set ( cliArgs ) )
@@ -131,8 +129,8 @@ gulp.task('webstorm', function (done) {
131129 } ) ;
132130 gutil . log ( 'wrote file ' + config . commit ( ) ) ;
133131 }
132+ // else run the selected items
134133 else {
135- // else run the selected items
136134 var taskList = [
137135 cliArgs . subdir && 'webstorm:subdir' ,
138136 cliArgs . project && 'webstorm:project' ,
@@ -141,7 +139,6 @@ gulp.task('webstorm', function (done) {
141139 cliArgs . codestyle && 'webstorm:codestyle' ,
142140 cliArgs . launch && 'webstorm:launch'
143141 ] . filter ( Boolean ) . concat ( done ) ;
144-
145142 runSequence . apply ( runSequence , taskList ) ;
146143 }
147144} ) ;
@@ -284,9 +281,14 @@ function validateLaunchPath(argv) {
284281 return 'Launch path is not valid or does not exist.' ;
285282 }
286283 }
287- return true ;
284+ return argv ;
288285}
289286
287+ /**
288+ * Validator function for the sub-directory property.
289+ * @param {* } value The value of the property to test
290+ * @returns {string|undefined } Error message on failure
291+ */
290292function validateSubDirectory ( value ) {
291293 if ( value ) {
292294 var subdir = path . resolve ( value ) ;
@@ -317,11 +319,15 @@ function subdirectoriesWithFile(base, filename) {
317319 return result ;
318320}
319321
320- // Todo move method to util location.
321- function angularityProjectPresent ( argv ) {
322+ /**
323+ * Validator function for an angularity project being present in the current working directory
324+ * @param {object } argv The yargs command line parameter set
325+ * @returns {string|undefined } Error message on failure
326+ */
327+ function angularityProjectPresent ( argv ) { // Todo @impaler move method to util location
322328 var projectPath = ( argv . subdir ) ? path . join ( argv . subdir , 'angularity.json' ) : 'angularity.json' ;
323329 if ( ! fs . existsSync ( path . resolve ( projectPath ) ) ) {
324- return 'Current working directory (or specified subdir) is not a valid angularity project. ' +
325- 'Try running the "init" command first.' ;
330+ return 'Current working directory (or specified subdir) is not a valid angularity project. Try running the ' +
331+ '"init" command first.' ;
326332 }
327- }
333+ }
0 commit comments