Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #145 from rodrigok/custom-name
Browse files Browse the repository at this point in the history
Custom name
  • Loading branch information
szwacz committed Apr 13, 2016
2 parents b4fbe16 + bfa2e50 commit a951f94
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dependencies": {
"fs-jetpack": "^0.7.0"
},
"packageNameTemplate": "{{name}}-v{{version}}-{{platform}}-{{arch}}",
"osx": {
"build": "1",
"identifier": "com.example.electron-boilerplate",
Expand Down
4 changes: 2 additions & 2 deletions tasks/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ var paths = {
'./**/*.html',
'./**/*.+(jpg|png|svg)'
],
}
};

// -------------------------------------
// Tasks
// -------------------------------------

gulp.task('clean', function (callback) {
gulp.task('clean', function () {
return destDir.dirAsync('.', { empty: true });
});

Expand Down
14 changes: 7 additions & 7 deletions tasks/release/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ var init = function () {
tmpDir = projectDir.dir('./tmp', { empty: true });
releasesDir = projectDir.dir('./releases');
manifest = projectDir.read('app/package.json', 'json');
packName = manifest.name + '_' + manifest.version;
packName = utils.getReleasePackageName(manifest);
packDir = tmpDir.dir(packName);
readyAppDir = packDir.cwd('opt', manifest.name);

return Q();
return new Q();
};

var copyRuntime = function () {
Expand Down Expand Up @@ -58,20 +58,20 @@ var finalize = function () {
// Copy icon
projectDir.copy('resources/icon.png', readyAppDir.path('icon.png'));

return Q();
return new Q();
};

var renameApp = function () {
return readyAppDir.renameAsync("electron", manifest.name);
return readyAppDir.renameAsync('electron', manifest.name);
};

var packToDebFile = function () {
var deferred = Q.defer();

var debFileName = packName + '_amd64.deb';
var debFileName = packName + '.deb';
var debPath = releasesDir.path(debFileName);

gulpUtil.log('Creating DEB package...');
gulpUtil.log('Creating DEB package... (' + debFileName + ')');

// Counting size of the app in KiB
var appSize = Math.round(readyAppDir.inspectTree('.').size / 1024);
Expand All @@ -91,7 +91,7 @@ var packToDebFile = function () {
childProcess.exec('fakeroot dpkg-deb -Zxz --build ' + packDir.path().replace(/\s/g, '\\ ') + ' ' + debPath.replace(/\s/g, '\\ '),
function (error, stdout, stderr) {
if (error || stderr) {
console.log("ERROR while building DEB package:");
console.log('ERROR while building DEB package:');
console.log(error);
console.log(stderr);
} else {
Expand Down
5 changes: 2 additions & 3 deletions tasks/release/osx.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ var finalize = function () {
copyright: manifest.copyright,
LSApplicationCategoryType: manifest.osx.LSApplicationCategoryType
});

finalAppDir.write('Contents/Info.plist', info);

// Prepare Info.plist of Helper apps
Expand Down Expand Up @@ -145,7 +144,7 @@ var packToDmgFile = function () {
var deferred = Q.defer();

var appdmg = require('appdmg');
var dmgName = manifest.name + '_' + manifest.version + '.dmg';
var dmgName = utils.getReleasePackageName(manifest) + '.dmg';

// Prepare appdmg config
var dmgManifest = projectDir.read('resources/osx/appdmg.json');
Expand All @@ -160,7 +159,7 @@ var packToDmgFile = function () {
// Delete DMG file with this name if already exists
releasesDir.remove(dmgName);

gulpUtil.log('Packaging to DMG file...');
gulpUtil.log('Packaging to DMG file... (' + dmgName + ')');

var readyDmgPath = releasesDir.path(dmgName);
appdmg({
Expand Down
6 changes: 3 additions & 3 deletions tasks/release/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var init = function () {
manifest = projectDir.read('app/package.json', 'json');
readyAppDir = tmpDir.cwd(manifest.name);

return Q();
return new Q();
};

var copyRuntime = function () {
Expand Down Expand Up @@ -76,7 +76,7 @@ var renameApp = function () {
var createInstaller = function () {
var deferred = Q.defer();

var finalPackageName = manifest.name + '_' + manifest.version + '.exe';
var finalPackageName = utils.getReleasePackageName(manifest) + '.exe';
var installScript = projectDir.read('resources/windows/installer.nsi');

installScript = utils.replace(installScript, {
Expand All @@ -92,7 +92,7 @@ var createInstaller = function () {
});
tmpDir.write('installer.nsi', installScript);

gulpUtil.log('Building installer with NSIS...');
gulpUtil.log('Building installer with NSIS... (' + finalPackageName + ')');

// Remove destination file if already exists.
releasesDir.remove(finalPackageName);
Expand Down
11 changes: 11 additions & 0 deletions tasks/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ module.exports.replace = function (str, patterns) {
return str;
};

module.exports.getReleasePackageName = function(manifest) {
return module.exports.replace(manifest.packageNameTemplate, {
name: manifest.name,
version: manifest.version,
build: manifest.build,
productName: manifest.productName,
platform: process.platform,
arch: process.arch
});
}

module.exports.getEnvName = function () {
return argv.env || 'development';
};
Expand Down

0 comments on commit a951f94

Please sign in to comment.