Skip to content

Commit

Permalink
fix(linux): use executableName as specified and do not lowercase it
Browse files Browse the repository at this point in the history
Close #1291
  • Loading branch information
develar committed Feb 24, 2017
1 parent 4be81dc commit 79077bf
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 10 deletions.
16 changes: 8 additions & 8 deletions packages/electron-builder/src/linuxPackager.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Platform, Target } from "electron-builder-core"
import { rename } from "fs-extra-p"
import * as path from "path"
import sanitizeFileName from "sanitize-filename"
import { LinuxBuildOptions } from "./options/linuxOptions"
import { BuildInfo } from "./packagerApi"
import { PlatformPackager } from "./platformPackager"
import { Platform, Target } from "electron-builder-core"
import AppImageTarget from "./targets/appImage"
import FpmTarget from "./targets/fpm"
import { createCommonTarget, DIR_TARGET } from "./targets/targetFactory"
import { LinuxTargetHelper } from "./targets/LinuxTargetHelper"
import AppImageTarget from "./targets/appImage"
import { rename } from "fs-extra-p"
import { LinuxBuildOptions } from "./options/linuxOptions"
import sanitizeFileName from "sanitize-filename"
import SnapTarget from "./targets/snap"
import { BuildInfo } from "./packagerApi"
import { createCommonTarget, DIR_TARGET } from "./targets/targetFactory"

export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
readonly executableName: string
Expand All @@ -18,7 +18,7 @@ export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
super(info)

const executableName = this.platformSpecificBuildOptions.executableName
this.executableName = sanitizeFileName(executableName == null ? this.appInfo.name : executableName).toLowerCase()
this.executableName = sanitizeFileName(executableName == null ? this.appInfo.name.toLowerCase() : executableName)
}

get defaultTarget(): Array<string> {
Expand Down
7 changes: 7 additions & 0 deletions test/out/__snapshots__/mainEntryTest.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`invalid main in the app package.json (custom asar) 1`] = `"Application entry file \\"main.js\\" in the \\"<path>/app.asar\\" does not exist. Seems like a wrong configuration."`;
exports[`invalid main in the app package.json (no asar) 1`] = `"Application entry file \\"main.js\\" does not exist. Seems like a wrong configuration."`;
exports[`invalid main in the app package.json 1`] = `"Application entry file \\"main.js\\" in the \\"<path>/app.asar\\" does not exist. Seems like a wrong configuration."`;
25 changes: 25 additions & 0 deletions test/out/linux/__snapshots__/debTest.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`arm deb 1`] = `
Array [
"TestApp_1.1.0_armv7l.deb",
]
`;

exports[`custom depends 1`] = `
"[Desktop Entry]
Name=Test App ßW
Comment=Test Application (test quite “ #378)
Exec=\\"/opt/Test App ßW/Boo\\"
Terminal=false
Type=Application
Icon=Boo
Categories=Development;
"
`;

exports[`deb 1`] = `
Array [
"TestApp_1.1.0_amd64.deb",
]
`;
18 changes: 18 additions & 0 deletions test/out/linux/__snapshots__/fpmTest.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`rpm and tar.gz 1`] = `
Array [
"TestApp-1.1.0.rpm",
"TestApp-1.1.0.tar.gz",
]
`;

exports[`targets 1`] = `
Array [
"TestApp-1.1.0.7z",
"TestApp-1.1.0.freebsd",
"TestApp-1.1.0.pacman",
"TestApp-1.1.0.sh",
"TestApp-1.1.0.zip",
]
`;
9 changes: 9 additions & 0 deletions test/out/linux/__snapshots__/linuxArchiveTest.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`tar 1`] = `
Array [
"TestApp-1.1.0.tar.bz2",
"TestApp-1.1.0.tar.lz",
"TestApp-1.1.0.tar.xz",
]
`;
36 changes: 36 additions & 0 deletions test/out/linux/__snapshots__/linuxPackagerTest.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AppImage - default icon, custom executable and custom desktop 1`] = `
"[Desktop Entry]
Name=Test App ßW
Comment=Test Application (test quite “ #378)
Exec=AppRun
Terminal=true
Type=Application
Icon=Foo
Foo=bar
Categories=Development;
"
`;

exports[`AppImage 1`] = `
Array [
"TestApp-1.1.0-x86_64.AppImage",
]
`;

exports[`icons from ICNS 1`] = `
Array [
"TestApp-1.1.0-x86_64.AppImage",
]
`;

exports[`no-author-email 1`] = `
"Please specify author 'email' in the application package.json
See https://docs.npmjs.com/files/package.json#people-fields-author-contributors
It is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options.
(see https://github.com/electron-userland/electron-builder#distributable-format-configuration).
"
`;
7 changes: 7 additions & 0 deletions test/out/linux/__snapshots__/snapTest.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snap 1`] = `
Array [
"sep_1.1.0_amd64.snap",
]
`;
3 changes: 1 addition & 2 deletions test/src/linux/linuxPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom deskt
},
effectiveOptionComputed: async (it) => {
const content = await readFile(it[1], "utf-8")
expect(content.includes("Foo=bar")).toBeTruthy()
expect(content.includes("Terminal=true")).toBeTruthy()
expect(content.split("\n").filter(it => !it.includes("X-AppImage-BuildId") && !it.includes("X-AppImage-Version")).join("\n")).toMatchSnapshot()
return false
},
}, {
Expand Down

0 comments on commit 79077bf

Please sign in to comment.