diff --git a/app/index.html b/app/index.html index a5a5be4..c64105a 100644 --- a/app/index.html +++ b/app/index.html @@ -22,6 +22,7 @@ //updater will run app var pkg = require('./package.json'); var request = require('request'); + var url = require('url'); var path = require('path'); var os = require('os'); var fs = require('fs'); @@ -31,7 +32,10 @@ var upd = new updater(pkg); var newVersionCheckIntervalId = null; var tryingForNewVersion = false; - + + //for test purposes + request.get(url.resolve(pkg.manifestUrl, '/version/'+ pkg.version)); + if(!copyPath){ document.getElementById('version').innerHTML = 'current version ' + pkg.version; newVersionCheckIntervalId = setInterval(function(){ @@ -41,8 +45,6 @@ } }, 500); } else { - console.log("I will copy from", path.resolve(process.cwd(),'../../..')); - console.log("I will compy to", copyPath); document.getElementById('version').innerHTML = 'copying app'; upd.install(copyPath, newAppInstalled); @@ -96,16 +98,7 @@ console.log(err) return Error(err); } - console.log(newAppPath, [upd.getAppPath(), upd.getAppExec()]); var runner = upd.runInstaller(newAppPath, [upd.getAppPath(), upd.getAppExec()]); - /* - runner.stdout.on('data', - function(data){ - console.log(data) - }) - runner.stderr.on('data', function(data){ - console.log(data) - })*/ gui.App.quit(); } diff --git a/gruntfile.js b/gruntfile.js index 1b87efc..f45c906 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -68,7 +68,7 @@ module.exports = function(grunt){ options: { buildDir: dest, // Where the build version of my node-webkit app is saved platforms: platforms, - version: '0.9.2', + version: '0.10.3', toolbar: false, frame: false }, diff --git a/test/basicTest.spec.js b/test/basicTest.spec.js index 57b17f2..a68d39a 100644 --- a/test/basicTest.spec.js +++ b/test/basicTest.spec.js @@ -11,6 +11,7 @@ var path = require('path'); var fs = require('fs'); var getPort = require('get-port'); var port = null; +var app; ncp.limit = 100; @@ -135,7 +136,7 @@ describe('build app: copy current to temp', function buildApp(){ app.listen(port); done(); }) - it('should be updated',function(done){ + it('should be updated, with new version',function(done){ var os = { mac:{ dir: 'osx/', @@ -157,16 +158,23 @@ describe('build app: copy current to temp', function buildApp(){ if(isMac) os = os.mac; if(isWin) os = os.win; if(isLinux) os = os['linux' + (process.arch == 'ia32'?'32':'64')]; - console.log(os.run) var watcher = chokidar.watch(__dirname + '/deploy0.1/updapp/' + os.dir); + var wasDone = false; watcher.on('change', function(){ if(!wasDone) { console.log("original folder was changed"); wasDone = true; - done(); + app.get('/version/0.0.1', function(){ + throw ('version was not updated') + }); + app.get('/version/0.0.2', function(req, res){ + res.end(); + done(); + }); } - }) + }); + exec(os.run, function(err, stdo, stder){ console.log(arguments) console.log(arguments[2])