Skip to content

Commit

Permalink
feat(deployment): support foo/bar repo as short form of owner foo and…
Browse files Browse the repository at this point in the history
… repo bar

Close #1227
  • Loading branch information
develar committed Feb 28, 2017
1 parent ef9b5a6 commit 9d0e1fe
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions .idea/electron-builder.iml

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

10 changes: 10 additions & 0 deletions packages/electron-builder/src/publish/publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ export async function getResolvedPublishConfig(packager: BuildInfo, publishConfi

let owner = publishConfig.owner
let project = provider === "github" ? (<GithubOptions>publishConfig).repo : (<BintrayOptions>publishConfig).package

if (provider === "github" && owner == null && project != null) {
const index = project.indexOf("/")
if (index > 0) {
const repo = project
project = repo.substring(0, index)
owner = repo.substring(index + 1)
}
}

if (!owner || !project) {
const info = await getInfo()
if (info == null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publish/src/gitHubPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class GitHubPublisher extends HttpPublisher {
return httpExecutor.request<T>(configureRequestOptions({
hostname: baseUrl.hostname,
port: <any>baseUrl.port,
path: (this.info.host != null && this.info.host !== "github.com") ? `/api/v3/${path}` : path,
path: (this.info.host != null && this.info.host !== "github.com") ? `/api/v3${path.startsWith("/") ? path : `/${path}`}` : path,
headers: {Accept: "application/vnd.github.v3+json"}
}, token, method), this.context.cancellationToken, data)
}
Expand Down
8 changes: 6 additions & 2 deletions test/src/windows/oneClickInstallerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,12 @@ test.ifNotCiMac("web installer", app({

test.ifAll.ifNotCiMac("web installer (default github)", app({
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.ia32, Arch.x64),
appMetadata: {
repository: "foo/bar"
config: {
publish: {
provider: "github",
// test form without owner
repo: "foo/bar"
}
},
}, {
packed: async context => {
Expand Down

0 comments on commit 9d0e1fe

Please sign in to comment.