Skip to content

Commit

Permalink
fix: bintray repo setting has no effect, always defaults to generic
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Oct 28, 2016
1 parent 4a273db commit 48051cb
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 16 deletions.
1 change: 0 additions & 1 deletion .idea/typescript-compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nsis-auto-updater/src/BintrayProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class BintrayProvider implements Provider {
private client: BintrayClient

constructor(configuration: BintrayOptions) {
this.client = new BintrayClient(configuration.owner!, configuration.package!, configuration.repo)
this.client = new BintrayClient(configuration)
}

async getLatestVersion(): Promise<VersionInfo> {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"yargs": "^6.3.0"
},
"devDependencies": {
"@develar/semantic-release": "^6.3.20",
"@develar/semantic-release": "^6.3.21",
"@types/ini": "^1.3.29",
"@types/js-yaml": "^3.5.28",
"@types/source-map-support": "^0.2.28",
Expand Down
17 changes: 15 additions & 2 deletions src/platformPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,24 @@ export async function getResolvedPublishConfig(packager: BuildInfo, publishConfi
}
}

const copy: PublishConfiguration = Object.assign({}, publishConfig)
if (copy.owner == null) {
copy.owner = owner
}

if (publishConfig.provider === "github") {
return Object.assign({}, publishConfig, {owner: owner, repo: project})
const options = <GithubOptions>copy
if (options.repo == null) {
options.repo = project
}
return options
}
else if (publishConfig.provider === "bintray") {
return Object.assign({}, publishConfig, {owner: owner, package: project, repo: "generic"})
const options = <BintrayOptions>copy
if (options.package == null) {
options.package = project
}
return options
}
else {
return null
Expand Down
2 changes: 1 addition & 1 deletion src/publish/BintrayPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class BintrayPublisher implements Publisher {
}
}

this.client = new BintrayClient(info.owner!, info.package!, info.repo, token, info.user!)
this.client = new BintrayClient(info, token)
this._versionPromise = <BluebirdPromise<Version>>this.init()
}

Expand Down
20 changes: 13 additions & 7 deletions src/publish/bintray.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { bintrayRequest } from "./restApiRequest"
import { BintrayOptions } from "../options/publishOptions"

export interface Version {
readonly name: string
Expand All @@ -18,18 +19,23 @@ export class BintrayClient {
private readonly basePath: string
readonly auth: string | null
readonly repo: string
readonly user: string

constructor(public owner: string, public packageName: string, repo?: string, apiKey?: string | null, user?: string | null) {
if (owner == null) {
readonly owner: string
private readonly user: string
readonly packageName: string

constructor(options: BintrayOptions, apiKey?: string | null) {
if (options.owner == null) {
throw new Error("owner is not specified")
}
if (packageName == null) {
if (options.package == null) {
throw new Error("package is not specified")
}

this.repo = repo || "generic"
this.user = user || owner
this.repo = options.repo || "generic"
this.packageName = options.package
this.owner = options.owner
this.user = options.user || options.owner
this.auth = apiKey == null ? null : `Basic ${new Buffer(`${this.user}:${apiKey}`).toString("base64")}`
this.basePath = `/packages/${this.owner}/${this.repo}/${this.packageName}`
}
Expand All @@ -49,6 +55,6 @@ export class BintrayClient {
}

deleteVersion(version: string): Promise<any> {
return bintrayRequest(`/packages/${this.owner}/${this.repo}/${this.packageName}/versions/${version}`, this.auth, null, "DELETE")
return bintrayRequest(`${this.basePath}/versions/${version}`, this.auth, null, "DELETE")
}
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@develar/semantic-release@^6.3.20":
version "6.3.20"
resolved "https://registry.yarnpkg.com/@develar/semantic-release/-/semantic-release-6.3.20.tgz#b1828f5e52f7b6ce31402503182f0d18ba46f237"
"@develar/semantic-release@^6.3.21":
version "6.3.21"
resolved "https://registry.yarnpkg.com/@develar/semantic-release/-/semantic-release-6.3.21.tgz#600dcfc607ab7378546222748373b9c88fa05cb1"
dependencies:
"@semantic-release/commit-analyzer" "^2.0.0"
"@semantic-release/error" "^1.0.0"
Expand Down

0 comments on commit 48051cb

Please sign in to comment.