Browse Source

#3616 Adds autoInstall option to semantic.json, modifies installer to return correct questions object in autoinstall

pull/3704/head
Jack Lukic 8 years ago
parent
commit
487c5cce53
4 changed files with 43 additions and 38 deletions
  1. 5
      RELEASE-NOTES.md
  2. 1
      semantic.json.example
  3. 20
      tasks/config/project/install.js
  4. 55
      tasks/install.js

5
RELEASE-NOTES.md

@ -2,16 +2,13 @@
### Version 2.1.9 - Feb 15, 2016
**Bugs**
-**Dropdown** - Fixed issue where dropdowns with sub-menus would not properly activate on mobile #3183
-**API** - Fixes bug where `beforeSend` would not correctly cancel request when `return false;` is used in callback. #3660
**Enhancements**
### Version 2.1.8 - Jan 7, 2016
**Critical Fix**

1
semantic.json.example

@ -18,6 +18,7 @@
},
"permission" : false,
"autoInstall": false,
"rtl": false
}

20
tasks/config/project/install.js

@ -82,6 +82,14 @@ module.exports = {
return when.hasConfig();
},
// detect whether there is a semantic.json configuration and that the auto-install option is set to true
shouldAutoInstall: function() {
var
config = when.hasConfig()
;
return config['autoInstall'];
},
// checks if files are in a PM directory
getPackageManager: function(directory) {
var
@ -751,17 +759,5 @@ module.exports = {
}
}
},
// Detect whether there is a semantic.json configuration and that the auto-install option is set to True
// Returns the semantic.json configuration
autoInstall: function() {
var config = when.hasConfig();
if (config && config['auto-install']) {
return when.hasConfig();
} else {
return false;
}
}
};

55
tasks/install.js

@ -192,15 +192,20 @@ if(manager.name == 'NPM') {
gulp.task('run setup', function() {
// If auto-install is switched on, we skip the configuration section and simply reuse the configuration from semantic.json
if (install.autoInstall()) {
answers = install.autoInstall();
} else {
if(install.shouldAutoInstall()) {
answers = {
overwrite : 'yes',
install : 'auto',
};
}
else {
return gulp
.src('gulpfile.js')
.pipe(prompt.prompt(questions.setup, function(setupAnswers) {
// hoist
answers = setupAnswers;
}));
.src('gulpfile.js')
.pipe(prompt.prompt(questions.setup, function(setupAnswers) {
// hoist
answers = setupAnswers;
}))
;
}
});
@ -214,9 +219,13 @@ gulp.task('create install files', function(callback) {
if(answers.overwrite !== undefined && answers.overwrite == 'no') {
return;
}
console.clear();
console.log('Installing');
if(install.shouldAutoInstall()) {
console.log('Auto-Installing (Without User Interaction)');
}
else {
console.log('Installing');
}
console.log('------------------------------');
@ -418,19 +427,21 @@ gulp.task('clean up install', function() {
}
// If auto-install is switched on, we skip the configuration section and simply build the dependencies
if (install.autoInstall()) {
if(install.shouldAutoInstall()) {
return gulp.start('build');
} else {
}
else {
return gulp
.src('gulpfile.js')
.pipe(prompt.prompt(questions.cleanup, function(answers) {
if(answers.cleanup == 'yes') {
del(install.setupFiles);
}
if(answers.build == 'yes') {
gulp.start('build');
}
}));
.src('gulpfile.js')
.pipe(prompt.prompt(questions.cleanup, function(answers) {
if(answers.cleanup == 'yes') {
del(install.setupFiles);
}
if(answers.build == 'yes') {
gulp.start('build');
}
}))
;
}
@ -443,4 +454,4 @@ runSequence(
callback
);
};
};
Loading…
Cancel
Save