updater min version idea

This commit is contained in:
Antelle 2016-01-17 23:34:40 +03:00
parent 7e0f618ed5
commit e0c7dd0fcd
4 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,7 @@ module.exports = function(grunt) {
var pkg = require('./package.json');
var dt = new Date().toISOString().replace(/T.*/, '');
var electronVersion = '0.36.4';
var appUpdateMinVersion = '0.5.0';
function replaceFont(css) {
css.walkAtRules('font-face', function (rule) {
@ -152,7 +153,8 @@ module.exports = function(grunt) {
manifest: {
options: {
replacements: [
{ pattern: '# YYYY-MM-DD:v0.0.0', replacement: '# ' + dt + ':v' + pkg.version }
{ pattern: '# YYYY-MM-DD:v0.0.0', replacement: '# ' + dt + ':v' + pkg.version },
{ pattern: '# updmin:v0.0.0', replacement: '# updmin:v' + appUpdateMinVersion }
]
},
files: { 'dist/manifest.appcache': 'app/manifest.appcache' }

View File

@ -1,6 +1,7 @@
CACHE MANIFEST
# YYYY-MM-DD:v0.0.0
# updmin:v0.0.0
CACHE:
index.html

View File

@ -98,6 +98,7 @@ var Updater = {
that.scheduleNextCheck();
return;
}
var updateMinVersionMatch = data.match(/#\s*updmin:v([\d+\.\w]+)/);
var prevLastVersion = UpdateModel.instance.get('lastVersion');
UpdateModel.instance.set({
status: 'ok',
@ -105,7 +106,8 @@ var Updater = {
lastSuccessCheckDate: dt,
lastVersionReleaseDate: new Date(match[1]),
lastVersion: match[2],
lastcheckError: null
lastCheckError: null,
lastCheckUpdMin: updateMinVersionMatch ? updateMinVersionMatch[1] : null
});
UpdateModel.instance.save();
that.scheduleNextCheck();

View File

@ -10,6 +10,7 @@ var UpdateModel = Backbone.Model.extend({
lastVersion: null,
lastVersionReleaseDate: null,
lastCheckError: null,
lastCheckUpdMin: null,
status: null,
updateStatus: null,
updateError: null,