-
Notifications
You must be signed in to change notification settings - Fork 691
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1695 from srmagura/bitbucket
Add support for Bitbucket repositories
- Loading branch information
Showing
10 changed files
with
173 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
cd ${0%/*} | ||
node ../../bin/typedoc --mode file --name "TypeDoc Documentation" --tsconfig ../../tsconfig.json --readme ../../README.md --out doc/ ../../src/lib/ | ||
node ../../bin/typedoc --name "TypeDoc Documentation" --tsconfig ../../tsconfig.json --readme ../../README.md --out doc/ --entryPointStrategy expand ../../src/lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { SourceDirectory } from "./directory"; | ||
export { SourceFile } from "./file"; | ||
export type { SourceReference } from "./file"; | ||
export { RepositoryType } from "./repository"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum RepositoryType { | ||
GitHub = "github", | ||
Bitbucket = "bitbucket", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import * as github from "../../../lib/converter/plugins/GitHubPlugin"; | ||
import { RepositoryType } from "../../../lib/models"; | ||
import Assert = require("assert"); | ||
|
||
describe("Repository", function () { | ||
describe("constructor", function () { | ||
it("defaults to github.com hostname", function () { | ||
const repository = new github.Repository("", "", []); | ||
|
||
Assert.equal(repository.hostname, "github.com"); | ||
Assert.equal(repository.type, RepositoryType.GitHub); | ||
}); | ||
|
||
it("handles a personal GitHub HTTPS URL", function () { | ||
const mockRemotes = ["https://github.com/joebloggs/foobar.git"]; | ||
|
||
const repository = new github.Repository("", "", mockRemotes); | ||
|
||
Assert.equal(repository.hostname, "github.com"); | ||
Assert.equal(repository.user, "joebloggs"); | ||
Assert.equal(repository.project, "foobar"); | ||
Assert.equal(repository.type, RepositoryType.GitHub); | ||
}); | ||
|
||
it("handles an enterprise GitHub URL", function () { | ||
const mockRemotes = ["git@github.acme.com:joebloggs/foobar.git"]; | ||
|
||
const repository = new github.Repository("", "", mockRemotes); | ||
|
||
Assert.equal(repository.hostname, "github.acme.com"); | ||
Assert.equal(repository.user, "joebloggs"); | ||
Assert.equal(repository.project, "foobar"); | ||
Assert.equal(repository.type, RepositoryType.GitHub); | ||
}); | ||
|
||
it("handles a Bitbucket HTTPS URL", function () { | ||
const mockRemotes = [ | ||
"https://joebloggs@bitbucket.org/joebloggs/foobar.git", | ||
]; | ||
|
||
const repository = new github.Repository("", "", mockRemotes); | ||
|
||
Assert.equal(repository.hostname, "bitbucket.org"); | ||
Assert.equal(repository.user, "joebloggs"); | ||
Assert.equal(repository.project, "foobar"); | ||
Assert.equal(repository.type, RepositoryType.Bitbucket); | ||
}); | ||
|
||
it("handles a Bitbucket SSH URL", function () { | ||
const mockRemotes = ["git@bitbucket.org:joebloggs/foobar.git"]; | ||
|
||
const repository = new github.Repository("", "", mockRemotes); | ||
|
||
Assert.equal(repository.hostname, "bitbucket.org"); | ||
Assert.equal(repository.user, "joebloggs"); | ||
Assert.equal(repository.project, "foobar"); | ||
Assert.equal(repository.type, RepositoryType.Bitbucket); | ||
}); | ||
}); | ||
|
||
describe("getURL", () => { | ||
const repositoryPath = "C:/Projects/foobar"; | ||
const filePath = repositoryPath + "/src/index.ts"; | ||
|
||
it("returns a GitHub URL", function () { | ||
const mockRemotes = ["https://github.com/joebloggs/foobar.git"]; | ||
|
||
const repository = new github.Repository( | ||
repositoryPath, | ||
"main", | ||
mockRemotes | ||
); | ||
repository.files = [filePath]; | ||
|
||
Assert.equal( | ||
repository.getURL(filePath), | ||
"https://github.com/joebloggs/foobar/blob/main/src/index.ts" | ||
); | ||
}); | ||
|
||
it("returns a Bitbucket URL", function () { | ||
const mockRemotes = [ | ||
"https://joebloggs@bitbucket.org/joebloggs/foobar.git", | ||
]; | ||
|
||
const repository = new github.Repository( | ||
repositoryPath, | ||
"main", | ||
mockRemotes | ||
); | ||
repository.files = [filePath]; | ||
|
||
Assert.equal( | ||
repository.getURL(filePath), | ||
"https://bitbucket.org/joebloggs/foobar/src/main/src/index.ts" | ||
); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.