Skip to content

Commit

Permalink
fix: do not required email for all Linux targets
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Aug 12, 2016
1 parent b9d0139 commit ddfa6fc
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode8
osx_image: xcode7.3

matrix:
include:
Expand Down
2 changes: 1 addition & 1 deletion src/errorMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const buildIsMissed = `Please specify 'build' configuration in the develo
is required.
`

export const authorEmailIsMissed = `Please specify author 'email' in the application package.json ('%s')
export const authorEmailIsMissed = `Please specify author 'email' in the application package.json
See https://docs.npmjs.com/files/package.json#people-fields-author-contributors
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export interface RepositoryInfo {

export interface AuthorMetadata {
readonly name: string
readonly email: string
readonly email?: string
}

export type CompressionLevel = "store" | "normal" | "maximum"
Expand Down
3 changes: 0 additions & 3 deletions src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,6 @@ export class Packager implements BuildInfo {
if (author == null) {
throw new Error(`Please specify "author" in the application package.json ('${appPackageFile}') — it is used as company name.`)
}
else if (author.email == null && this.options.targets!.has(Platform.LINUX)) {
throw new Error(util.format(errorMessages.authorEmailIsMissed, appPackageFile))
}

if (build.name != null) {
throw new Error(util.format(errorMessages.nameInBuildSpecified, appPackageFile))
Expand Down
11 changes: 10 additions & 1 deletion src/targets/fpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { downloadFpm } from "../util/binDownload"
import { readFile, outputFile } from "fs-extra-p"
import { Promise as BluebirdPromise } from "bluebird"
import { LinuxTargetHelper, installPrefix } from "./LinuxTargetHelper"
import * as errorMessages from "../errorMessages"

const template = require("lodash.template")

Expand Down Expand Up @@ -66,7 +67,15 @@ export default class FpmTarget extends TargetEx {
}

const options = this.options
const author = options.maintainer || `${appInfo.metadata.author!.name} <${appInfo.metadata.author!.email}>`
let author = options.maintainer
if (author == null) {
const a = appInfo.metadata.author!
if (a.email == null) {
throw new Error(errorMessages.authorEmailIsMissed)
}
author = `${a.name} <${a.email}>`
}

const synopsis = options.synopsis
const args = [
"-s", "dir",
Expand Down
4 changes: 2 additions & 2 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function removePassword(input: string): string {

export function exec(file: string, args?: Array<string> | null, options?: ExecOptions): BluebirdPromise<string> {
if (debug.enabled) {
debug(removePassword(`Executing ${file} ${args == null ? "" : args.join(" ")}`))
debug(`Executing ${file} ${args == null ? "" : removePassword(args.join(" "))}`)
}

return new BluebirdPromise<string>((resolve, reject) => {
Expand Down Expand Up @@ -105,7 +105,7 @@ export function doSpawn(command: string, args: Array<string>, options?: SpawnOpt
}

if (debug.enabled) {
debug(`Spawning ${command} ${args.join(" ")}`)
debug(`Spawning ${command} ${removePassword(args.join(" "))}`)
}
return _spawn(command, args, options)
}
Expand Down
4 changes: 2 additions & 2 deletions src/windowsCodeSign.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { spawn } from "./util/util"
import { exec } from "./util/util"
import { rename } from "fs-extra-p"
import * as path from "path"
import { release } from "os"
Expand Down Expand Up @@ -104,7 +104,7 @@ async function spawnSign(options: SignOptions, inputPath: string, outputPath: st
args.push(inputPath)
}

return await spawn(await getToolPath(), args)
return await exec(await getToolPath(), args)
}

// async function verify(options: any) {
Expand Down

0 comments on commit ddfa6fc

Please sign in to comment.