From bf9fac27cf626a2d0a46de526af6662199edc984 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 12 Jul 2018 10:14:15 -0700 Subject: [PATCH] Use a consistent app naming strategy across non-stable channels --- script/config.js | 11 ++++++----- script/lib/create-debian-package.js | 3 +-- script/lib/create-rpm-package.js | 2 +- script/lib/generate-startup-snapshot.js | 2 +- script/lib/package-application.js | 5 ++--- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/script/config.js b/script/config.js index ccec643ac..3d13b8a09 100644 --- a/script/config.js +++ b/script/config.js @@ -22,13 +22,13 @@ const appMetadata = require(path.join(repositoryRootPath, 'package.json')) const apmMetadata = require(path.join(apmRootPath, 'package.json')) const computedAppVersion = computeAppVersion(process.env.ATOM_RELEASE_VERSION || appMetadata.version) const channel = getChannel(computedAppVersion) -const channelDisplayName = getChannelDisplayName(channel) +const appName = getAppName(channel) module.exports = { appMetadata, apmMetadata, channel, - channelDisplayName, + appName, computedAppVersion, repositoryRootPath, apmRootPath, @@ -56,9 +56,10 @@ function getChannel (version) { return 'stable' } -function getChannelDisplayName (channel) { - if (channel === 'stable' || channel === 'dev') return null - return process.env.ATOM_CHANNEL_DISPLAY_NAME || channel.charAt(0).toUpperCase() + channel.slice(1) +function getAppName(channel) { + return channel === 'stable' + ? 'Atom' + : `Atom ${process.env.ATOM_CHANNEL_DISPLAY_NAME || channel.charAt(0).toUpperCase() + channel.slice(1)}` } function computeAppVersion (version) { diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 271b7daf9..1aa179b70 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -12,7 +12,6 @@ module.exports = function (packagedAppPath) { console.log(`Creating Debian package for "${packagedAppPath}"`) const atomExecutableName = CONFIG.channel === 'stable' ? 'atom' : `atom-${CONFIG.channel}` const apmExecutableName = CONFIG.channel === 'stable' ? 'apm' : `apm-${CONFIG.channel}` - const appName = CONFIG.channel === 'stable' ? 'Atom' : `Atom ${CONFIG.channelDisplayName}` const appDescription = CONFIG.appMetadata.description const appVersion = CONFIG.appMetadata.version let arch @@ -88,7 +87,7 @@ module.exports = function (packagedAppPath) { console.log(`Writing desktop entry file into "${debianPackageApplicationsDirPath}"`) const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in')) const desktopEntryContents = template(desktopEntryTemplate)({ - appName: appName, + appName: CONFIG.appName, appFileName: atomExecutableName, description: appDescription, installDir: '/usr', diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index e1928e6e7..cdef23300 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -12,7 +12,7 @@ module.exports = function (packagedAppPath) { console.log(`Creating rpm package for "${packagedAppPath}"`) const atomExecutableName = CONFIG.channel === 'stable' ? 'atom' : `atom-${CONFIG.channel}` const apmExecutableName = CONFIG.channel === 'stable' ? 'apm' : `apm-${CONFIG.channel}` - const appName = CONFIG.channel === 'stable' ? 'Atom' : `Atom ${CONFIG.channelDisplayName}` + const appName = CONFIG.appName const appDescription = CONFIG.appMetadata.description // RPM versions can't have dashes or tildes in them. // (Ref.: https://twiki.cern.ch/twiki/bin/view/Main/RPMAndDebVersioning) diff --git a/script/lib/generate-startup-snapshot.js b/script/lib/generate-startup-snapshot.js index 8038d41c4..bdf8b6599 100644 --- a/script/lib/generate-startup-snapshot.js +++ b/script/lib/generate-startup-snapshot.js @@ -74,7 +74,7 @@ module.exports = function (packagedAppPath) { const verifySnapshotScriptPath = path.join(CONFIG.repositoryRootPath, 'script', 'verify-snapshot-script') let nodeBundledInElectronPath if (process.platform === 'darwin') { - const executableName = CONFIG.channelDisplayName ? `Atom ${CONFIG.channelDisplayName}` : 'Atom' + const executableName = CONFIG.appName nodeBundledInElectronPath = path.join(packagedAppPath, 'Contents', 'MacOS', executableName) } else if (process.platform === 'win32') { nodeBundledInElectronPath = path.join(packagedAppPath, 'atom.exe') diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 7043d07eb..1b3c19b28 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -114,7 +114,7 @@ function buildAsarUnpackGlobExpression () { function getAppName () { if (process.platform === 'darwin') { - return CONFIG.channelDisplayName ? `Atom ${CONFIG.channelDisplayName}` : 'Atom' + return CONFIG.appName } else { return 'atom' } @@ -169,8 +169,7 @@ function renamePackagedAppDir (packageOutputDirPath) { if (fs.existsSync(packagedAppPath)) fs.removeSync(packagedAppPath) fs.renameSync(packageOutputDirPath, packagedAppPath) } else { - const appName = CONFIG.channel !== 'stable' ? `Atom ${CONFIG.channelDisplayName}` : 'Atom' - packagedAppPath = path.join(CONFIG.buildOutputPath, appName) + packagedAppPath = path.join(CONFIG.buildOutputPath, CONFIG.appName) if (process.platform === 'win32' && process.arch !== 'ia32') { packagedAppPath += ` ${process.arch}` }