Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Commit

Permalink
Updates from v3 review/feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Feb 22, 2016
1 parent 1d68763 commit 04a9e7a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ On osx/linux, run the following commands
- If on osx(because of a bug with Yosemite), Open `/Library/Ruby/Gems/2.0.0/gems/ffi-1.9.10/lib/ffi/library.rb` and do the fix proposed here: https://github.com/ffi/ffi/issues/461#issuecomment-149253757

1. Build all app artefacts
1. On osx, run `gulp cert:fetch:osx`
- You will need to setup [AWS CLI](https://aws.amazon.com/cli/) with your credentials `aws configure` (grab from AWS console IME)
1. On osx, run `gulp build:osx`
1. On osx/linux, run `gulp build:linux`
2. On osx/linux, run `gulp cert:fetch:win`
- You will need to setup [AWS CLI](https://aws.amazon.com/cli/) with your credentials `aws configure` (grab from AWS console IME)
Expand Down
29 changes: 16 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ gulp.task('check-path-safety-for-windows', function() {

gulp.task('clean', [OUTPUT_DIR, ARTEFACTS_DIR, CACHE_DIR].map(function (dir) { return 'clean:' + path.basename(dir); }));

/* certificate:fetch:{{ OS }} */
Object.keys(CERTIFICATES_FORMAT).forEach(function (OS) {
/* cert:fetch:{{ OS }} */
Object.keys(CERTIFICATES_FORMAT).forEach(function(OS) {
var file = CERTIFICATES_FORMAT[OS];
gulp.task('cert:fetch:' + OS, fetchS3.bind(null, {
localFile: path.join(CERTIFICATES_DIR, file),
s3Params: {
Bucket: S3_CONSTS.buckets.certificates,
Key: file,
},
Key: file
}
}));
});

Expand Down Expand Up @@ -210,12 +210,10 @@ var dmg_cmd = template('./osx/create-dmg/create-dmg --icon "<%= name %>" 311 50

// Only runs on OSX (requires XCode properly configured)
gulp.task('sign:osx', ['build'], shell.task([
/* */
'codesign -v -f -s "'+ SIGN_IDENTITY +'" '+ OUTPUT_DIR +'/Gitter/osx64/Gitter.app/Contents/Frameworks/*',
'codesign -v -f -s "'+ SIGN_IDENTITY +'" '+ OUTPUT_DIR +'/Gitter/osx64/Gitter.app',
'codesign -v --display '+ OUTPUT_DIR +'/Gitter/osx64/Gitter.app',
'codesign -v --verify '+ OUTPUT_DIR +'/Gitter/osx64/Gitter.app'
/* */
]));

// Only runs on OSX
Expand Down Expand Up @@ -278,18 +276,23 @@ var pushManifestToDest = function(destinationKey) {
});
};
var platformFolders = [
// legacy
'desktop',
'osx',
'win',
'linux'
];
platformFolders.forEach(function(platformFolder) {
gulp.task('manifest:push:' + platformFolder, function() {
return pushManifestToDest(path.join(platformFolder, 'package.json'));
});
gulp.task('manifest:push:osx', function() {
return pushManifestToDest('osx/package.json');
});
gulp.task('manifest:push:win', function() {
return pushManifestToDest('win/package.json');
});
gulp.task('manifest:push:linux', function() {
return Promise.all([
pushManifestToDest('linux32/package.json'),
pushManifestToDest('linux64/package.json')
]);
});
gulp.task('manifest:push', platformFolders.map(function(platformFolder) { return 'manifest:push:' + platformFolder; }), function() {
gulp.task('manifest:push', ['manifest:push:osx', 'manifest:push:win', 'manifest:push:linux'], function() {
return true;
});

Expand Down
24 changes: 13 additions & 11 deletions nwapp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ var autoLauncher = new AutoLaunch({

var checkFileExistSync = function(target) {
try {
return fs.statSync(target);
return !!fs.statSync(target);
}
catch(err) {
return false;
// swallow the error
}

return false;
Expand All @@ -63,16 +63,18 @@ var checkFileExistSync = function(target) {
log.info('argv:', argv);
log.info('version:', pkg.version);

var currentInstallPath = argv['current-install-path'];
var newUpdaterExecutablePath = argv['new-executable'];
// We used to(<=2.4.0) just pass in as the first and second paramers but this is not as
// nice when we want to add other CLI parameters in later
if(!currentInstallPath && checkFileExistSync(argv._[0])) {
currentInstallPath = argv._[0];
}
if(!newUpdaterExecutablePath && checkFileExistSync(argv._[1])) {
newUpdaterExecutablePath = argv._[1];
var legacyCurrentInstallPath;
var legacyNewUpdaterExecutablePath;
if (argv.length === 2 && checkFileExistSync(argv._[0]) && checkFileExistSync(argv._[1])) {
// This only happens if we have a pre v3.0.0 desktop app attempting to update to v3+
// FIXME: remove after August 2016
legacyCurrentInstallPath = argv._[0];
legacyNewUpdaterExecutablePath = argv._[1];
}

var currentInstallPath = argv['current-install-path'] || legacyCurrentInstallPath;
var newUpdaterExecutablePath = argv['new-executable'] || legacyNewUpdaterExecutablePath;

var hasGoodParamsToUpdate = currentInstallPath && newUpdaterExecutablePath;
log.info('Are we going into update mode? ' + (hasGoodParamsToUpdate ? 'Yes' : 'No') + '.', currentInstallPath, newUpdaterExecutablePath);
if(hasGoodParamsToUpdate) {
Expand Down
1 change: 0 additions & 1 deletion nwapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"node-notifier": "^4.5.0",
"node-webkit-updater": "^0.2.3",
"node-webkit-winstate": "^1.1.0",
"normalize-package-data": "^2.3.5",
"oauth": "^0.9.12",
"object-assign": "^4.0.1",
"open": "0.0.5",
Expand Down

0 comments on commit 04a9e7a

Please sign in to comment.