Skip to content

Commit

Permalink
refactor: extract linuxOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Nov 3, 2016
1 parent 7ea3d62 commit 76be355
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 75 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Only IntelliJ Platform IDEs (IntelliJ IDEA, WebStorm) support debug. [Forked ver

Use one of the shared run configurations as a template and:

* Ensure that `Before launch` contains `Compile TypeScript`.
* Set `Node interpreter` to NodeJS 7. Yes — NodeJS 7 is required to debug. Download [nightly build](https://nodejs.org/download/nightly/).
* Ensure that `Before launch` contains `Compile TypeScript` (note – currently do not add, please do`npm run compile` before run).
* Set `Node interpreter` to NodeJS 7. NodeJS 7 is required to debug.
* Set `Node parameters` to `--inspect`.
* Set `Application Parameters` to `--match="test name" relative-test-file-name` if you want to debug particular test. E.g.
```
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { PackagerOptions, ArtifactCreated, BuildInfo } from "./platformPackager"
export { DIR_TARGET, DEFAULT_TARGET } from "./targets/targetFactory"
export { BuildOptions, build, CliOptions, createTargets } from "./builder"
export { PublishOptions, Publisher } from "./publish/publisher"
export { AppMetadata, DevMetadata, Platform, Arch, archFromString, BuildMetadata, LinuxBuildOptions, CompressionLevel } from "./metadata"
export { AppMetadata, DevMetadata, Platform, Arch, archFromString, BuildMetadata, CompressionLevel } from "./metadata"
export { MacOptions, DmgOptions, MasBuildOptions } from "./options/macOptions"
export { WinBuildOptions, NsisOptions } from "./options/winOptions"
export { WinBuildOptions, NsisOptions } from "./options/winOptions"
export { LinuxBuildOptions } from "./options/linuxOptions"
3 changes: 2 additions & 1 deletion src/linuxPackager.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as path from "path"
import BluebirdPromise from "bluebird-lst-c"
import { PlatformPackager, BuildInfo, Target, TargetEx } from "./platformPackager"
import { Platform, LinuxBuildOptions, Arch } from "./metadata"
import { Platform, Arch } from "./metadata"
import FpmTarget from "./targets/fpm"
import { createCommonTarget, DEFAULT_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"

export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
constructor(info: BuildInfo) {
Expand Down
68 changes: 1 addition & 67 deletions src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PlatformPackager } from "./platformPackager"
import { MacOptions, DmgOptions, MasBuildOptions } from "./options/macOptions"
import { Publish } from "./options/publishOptions"
import { WinBuildOptions, NsisOptions, SquirrelWindowsOptions } from "./options/winOptions"
import { LinuxBuildOptions } from "./options/linuxOptions"

export interface Metadata {
readonly repository?: string | RepositoryInfo | null
Expand Down Expand Up @@ -238,73 +239,6 @@ export interface AfterPackContext {
readonly packager: PlatformPackager<any>
}

/*
### `.build.linux`
Linux specific build options.
*/
export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
/*
The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).
*/
readonly category?: string | null

/*
The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section). Not applicable for AppImage.
*/
readonly packageCategory?: string | null

/*
As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux.
*/
readonly description?: string | null

/*
Target package type: list of `AppImage`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `AppImage`.
The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.
Only `deb` and `AppImage` is tested. Feel free to file issues for `rpm` and other package formats.
*/
readonly target?: Array<string> | null

/*
*deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
*/
readonly synopsis?: string | null

/*
The maintainer. Defaults to [author](#AppMetadata-author).
*/
readonly maintainer?: string | null

/*
The vendor. Defaults to [author](#AppMetadata-author).
*/
readonly vendor?: string | null

// should be not documented, only to experiment
readonly fpm?: Array<string> | null

/**
The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries.
*/
readonly desktop?: { [key: string]: string; } | null

readonly afterInstall?: string | null
readonly afterRemove?: string | null

/*
*deb-only.* The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
*/
readonly compression?: string | null

/*
Package dependencies. Defaults to `["libappindicator1", "libnotify-bin"]`.
*/
readonly depends?: string[] | null
}

/*
### `.build.fileAssociations`
Expand Down
68 changes: 68 additions & 0 deletions src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { PlatformSpecificBuildOptions } from "../metadata"

/*
### `.build.linux`
Linux specific build options.
*/
export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
/*
The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).
*/
readonly category?: string | null

/*
The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section). Not applicable for AppImage.
*/
readonly packageCategory?: string | null

/*
As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux.
*/
readonly description?: string | null

/*
Target package type: list of `AppImage`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `AppImage`.
The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.
Only `deb` and `AppImage` is tested. Feel free to file issues for `rpm` and other package formats.
*/
readonly target?: Array<string> | null

/*
*deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
*/
readonly synopsis?: string | null

/*
The maintainer. Defaults to [author](#AppMetadata-author).
*/
readonly maintainer?: string | null

/*
The vendor. Defaults to [author](#AppMetadata-author).
*/
readonly vendor?: string | null

// should be not documented, only to experiment
readonly fpm?: Array<string> | null

/**
The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries.
*/
readonly desktop?: { [key: string]: string; } | null

readonly afterInstall?: string | null
readonly afterRemove?: string | null

/*
*deb-only.* The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
*/
readonly compression?: string | null

/*
Package dependencies. Defaults to `["libappindicator1", "libnotify-bin"]`.
*/
readonly depends?: string[] | null
}
2 changes: 1 addition & 1 deletion src/targets/LinuxTargetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from "path"
import { exec, debug, isEmptyOrSpaces } from "../util/util"
import { PlatformPackager } from "../platformPackager"
import BluebirdPromise from "bluebird-lst-c"
import { LinuxBuildOptions } from "../metadata"
import { LinuxBuildOptions } from "../options/linuxOptions"

export const installPrefix = "/opt"

Expand Down
3 changes: 2 additions & 1 deletion src/targets/appImage.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { PlatformPackager, TargetEx } from "../platformPackager"
import { LinuxBuildOptions, Arch } from "../metadata"
import { Arch } from "../metadata"
import * as path from "path"
import { exec, unlinkIfExists } from "../util/util"
import { open, write, createReadStream, createWriteStream, close, chmod } from "fs-extra-p"
import { LinuxTargetHelper } from "./LinuxTargetHelper"
import { getBin } from "../util/binDownload"
import BluebirdPromise from "bluebird-lst-c"
import { v1 as uuid1 } from "uuid-1345"
import { LinuxBuildOptions } from "../options/linuxOptions"

const appImageVersion = process.platform === "darwin" ? "AppImage-09-07-16-mac" : "AppImage-09-07-16-linux"
//noinspection SpellCheckingInspection
Expand Down
3 changes: 2 additions & 1 deletion src/targets/fpm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinuxBuildOptions, Arch } from "../metadata"
import { Arch } from "../metadata"
import { smarten, PlatformPackager, TargetEx } from "../platformPackager"
import { use, exec } from "../util/util"
import * as path from "path"
Expand All @@ -8,6 +8,7 @@ import BluebirdPromise from "bluebird-lst-c"
import { LinuxTargetHelper, installPrefix } from "./LinuxTargetHelper"
import * as errorMessages from "../errorMessages"
import { TmpDir } from "../util/tmp"
import { LinuxBuildOptions } from "../options/linuxOptions"

const template = require("lodash.template")

Expand Down

0 comments on commit 76be355

Please sign in to comment.