Skip to content

Commit

Permalink
adds an update notifier to APEX Front-End Boost.
Browse files Browse the repository at this point in the history
fixes #111
  • Loading branch information
vincentmorneau committed Aug 17, 2016
1 parent a4d25f4 commit f2b93d9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 20 deletions.
44 changes: 26 additions & 18 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
// 1. LIBRARIES
try {
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')(),
del = require('del'),
runSequence = require('run-sequence'),
browsersync = require('browser-sync').create(),
clip = require('gulp-clip-empty-files'),
path = require('path'),
argv = require('yargs').argv,
merge = require('merge-stream'),
extend = require('node.extend'),
util = require('./lib/util'),
scssToLess = require('./lib/scssToLess'),
rtlcss = require('./lib/rtlcss'),
validate = require('jsonschema').validate,
schema = require('./lib/defaultSchema'),
fs = require("fs"),
mkdirp = require('mkdirp'),
chalk = require('chalk');
// required hack to make updateNotifier work as intended in a gulpfile
delete process.env.npm_config_username;
delete process.env.npm_package_name;
delete process.env.npm_config_heading;

var gulp = require('gulp'),
plugins = require('gulp-load-plugins')(),
del = require('del'),
runSequence = require('run-sequence'),
browsersync = require('browser-sync').create(),
clip = require('gulp-clip-empty-files'),
path = require('path'),
argv = require('yargs').argv,
merge = require('merge-stream'),
extend = require('node.extend'),
util = require('./lib/util'),
scssToLess = require('./lib/scssToLess'),
rtlcss = require('./lib/rtlcss'),
validate = require('jsonschema').validate,
schema = require('./lib/defaultSchema'),
fs = require("fs"),
mkdirp = require('mkdirp');

const chalk = require('chalk');
const updateNotifier = require('update-notifier');
} catch (e) {
console.error('Your installation is missing dependencies. Please execute "npm install" again.');
process.exit();
Expand Down Expand Up @@ -339,5 +346,6 @@ gulp.task('default', function() {
console.log(chalk.cyan.bold("Now open up your favorite code editor and modify any file within:"));
console.log(dirs);
console.log(chalk.cyan.bold("All files belonging in the directories above are made available to use in APEX"));
util.isUpToDate();
});
});
19 changes: 19 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,24 @@ module.exports = {
} catch (e) {
return false;
}
},

// verifies if APEX Front-End Boost is up to date with the latest version
isUpToDate: function() {
const chalk = require('chalk');
const updateNotifier = require('update-notifier');
const pkg = require('../package.json');

// Checks for available update and returns an instance
const notifier = updateNotifier({pkg});

// Notify using the built-in convenience method
if (notifier.update) {
notifier.notify({
defer: false,
message: chalk.bold('APEX Front-End Boost') + ' update available ' + chalk.dim(notifier.update.current) + chalk.reset(' → ') +
chalk.green(notifier.update.latest) + ' \nRun:\n' + chalk.cyan.bold('git fetch origin') + '\n' + chalk.cyan.bold('git reset--hard origin/master') + '\n' + chalk.cyan.bold('npm install')
});
}
}
};
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apex-frontend-boost",
"author": "OraOpenSource",
"version": "2.1.3",
"author": "OraOpenSource",
"description": "Enhance your productivity with a complete Front-End Stack for Oracle APEX development",
"license": "MIT",
"keywords": [
Expand Down Expand Up @@ -58,6 +58,7 @@
"rtlcss": "2.0.x",
"run-sequence": "1.2.x",
"through2": "2.0.x",
"yargs": "4.8.x"
"update-notifier": "1.0.x",
"yargs": "5.0.x"
}
}

0 comments on commit f2b93d9

Please sign in to comment.