Skip to content

Commit 33381f5

Browse files
committed
Merge branch 'reinstall-automation' of https://github.com/algorithme/Semantic-UI into next
2 parents 5322ed9 + 8e272ac commit 33381f5

File tree

2 files changed

+41
-21
lines changed

2 files changed

+41
-21
lines changed

tasks/config/project/install.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ module.exports = {
416416
{
417417
name: 'Yes',
418418
value: true
419-
},
419+
}
420420
]
421421
},
422422
{
@@ -730,7 +730,7 @@ module.exports = {
730730

731731
/* Rename Files */
732732
rename: {
733-
json : { extname : '.json' },
733+
json : { extname : '.json' }
734734
},
735735

736736
/* Copy Install Folders */
@@ -751,6 +751,17 @@ module.exports = {
751751
}
752752

753753
}
754+
},
755+
756+
// Detect whether there is a semantic.json configuration and that the auto-install option is set to True
757+
// Returns the semantic.json configuration
758+
autoInstall: function() {
759+
var config = when.hasConfig();
760+
if (config && config['auto-install']) {
761+
return when.hasConfig();
762+
} else {
763+
return false;
764+
}
754765
}
755766

756767
};

tasks/install.js

+28-19
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,17 @@ if(manager.name == 'NPM') {
191191

192192
gulp.task('run setup', function() {
193193

194-
return gulp
195-
.src('gulpfile.js')
196-
.pipe(prompt.prompt(questions.setup, function(setupAnswers) {
197-
// hoist
198-
answers = setupAnswers;
199-
}))
200-
;
201-
194+
// If auto-install is switched on, we skip the configuration section and simply reuse the configuration from semantic.json
195+
if (install.autoInstall()) {
196+
answers = install.autoInstall();
197+
} else {
198+
return gulp
199+
.src('gulpfile.js')
200+
.pipe(prompt.prompt(questions.setup, function(setupAnswers) {
201+
// hoist
202+
answers = setupAnswers;
203+
}));
204+
}
202205
});
203206

204207
gulp.task('create install files', function(callback) {
@@ -414,17 +417,23 @@ gulp.task('clean up install', function() {
414417
console.log('');
415418
}
416419

417-
return gulp
418-
.src('gulpfile.js')
419-
.pipe(prompt.prompt(questions.cleanup, function(answers) {
420-
if(answers.cleanup == 'yes') {
421-
del(install.setupFiles);
422-
}
423-
if(answers.build == 'yes') {
424-
gulp.start('build');
425-
}
426-
}))
427-
;
420+
// If auto-install is switched on, we skip the configuration section and simply build the dependencies
421+
if (install.autoInstall()) {
422+
return gulp.start('build');
423+
} else {
424+
return gulp
425+
.src('gulpfile.js')
426+
.pipe(prompt.prompt(questions.cleanup, function(answers) {
427+
if(answers.cleanup == 'yes') {
428+
del(install.setupFiles);
429+
}
430+
if(answers.build == 'yes') {
431+
gulp.start('build');
432+
}
433+
}));
434+
}
435+
436+
428437
});
429438

430439
runSequence(

0 commit comments

Comments
 (0)