From ddfa6fc869095502c1cb48c388d9037698d9fd5e Mon Sep 17 00:00:00 2001 From: develar Date: Fri, 12 Aug 2016 18:21:24 +0200 Subject: [PATCH] fix: do not required email for all Linux targets --- .travis.yml | 2 +- src/errorMessages.ts | 2 +- src/metadata.ts | 2 +- src/packager.ts | 3 --- src/targets/fpm.ts | 11 ++++++++++- src/util/util.ts | 4 ++-- src/windowsCodeSign.ts | 4 ++-- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0c0c4639d9a..668ebaabca1 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -osx_image: xcode8 +osx_image: xcode7.3 matrix: include: diff --git a/src/errorMessages.ts b/src/errorMessages.ts index 98099318dbc..b6ddb5c1978 100644 --- a/src/errorMessages.ts +++ b/src/errorMessages.ts @@ -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 diff --git a/src/metadata.ts b/src/metadata.ts index 1e004f6e9a2..29c1b1005a9 100755 --- a/src/metadata.ts +++ b/src/metadata.ts @@ -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" diff --git a/src/packager.ts b/src/packager.ts index 3b98d818cd2..3f65da5ce33 100644 --- a/src/packager.ts +++ b/src/packager.ts @@ -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)) diff --git a/src/targets/fpm.ts b/src/targets/fpm.ts index 94fb1e7f9c9..d057ca3ada2 100644 --- a/src/targets/fpm.ts +++ b/src/targets/fpm.ts @@ -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") @@ -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", diff --git a/src/util/util.ts b/src/util/util.ts index 7131bafbfd8..0835ca20ee6 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -68,7 +68,7 @@ export function removePassword(input: string): string { export function exec(file: string, args?: Array | null, options?: ExecOptions): BluebirdPromise { if (debug.enabled) { - debug(removePassword(`Executing ${file} ${args == null ? "" : args.join(" ")}`)) + debug(`Executing ${file} ${args == null ? "" : removePassword(args.join(" "))}`) } return new BluebirdPromise((resolve, reject) => { @@ -105,7 +105,7 @@ export function doSpawn(command: string, args: Array, options?: SpawnOpt } if (debug.enabled) { - debug(`Spawning ${command} ${args.join(" ")}`) + debug(`Spawning ${command} ${removePassword(args.join(" "))}`) } return _spawn(command, args, options) } diff --git a/src/windowsCodeSign.ts b/src/windowsCodeSign.ts index 3b567321407..3333dcf4f37 100644 --- a/src/windowsCodeSign.ts +++ b/src/windowsCodeSign.ts @@ -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" @@ -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) {