1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | const project_1 = require("./project/project");
|
19 | function gitHubComRepository(details) {
|
20 | return Object.assign(Object.assign({}, details), { type: RepositoryProviderType.GitHubCom, cloneUrl: () => {
|
21 | if (details.credential) {
|
22 |
|
23 | if (details.credential.token.startsWith("v1.")) {
|
24 | return `https://atomist:${details.credential.token}@github.com/${details.owner}/${details.repo}.git`;
|
25 | }
|
26 | else {
|
27 | return `https://${details.credential.token}:x-oauth-basic@github.com/${details.owner}/${details.repo}.git`;
|
28 | }
|
29 | }
|
30 | else {
|
31 | return `https://github.com/${details.owner}/${details.repo}.git`;
|
32 | }
|
33 | } });
|
34 | }
|
35 | exports.gitHubComRepository = gitHubComRepository;
|
36 | var RepositoryProviderType;
|
37 | (function (RepositoryProviderType) {
|
38 | RepositoryProviderType[RepositoryProviderType["GitHubCom"] = 0] = "GitHubCom";
|
39 | RepositoryProviderType[RepositoryProviderType["GitHubEnterprise"] = 1] = "GitHubEnterprise";
|
40 | })(RepositoryProviderType = exports.RepositoryProviderType || (exports.RepositoryProviderType = {}));
|
41 | function createProjectLoader() {
|
42 | return new DefaultProjectLoader();
|
43 | }
|
44 | exports.createProjectLoader = createProjectLoader;
|
45 | class DefaultProjectLoader {
|
46 | async load(id, baseDir) {
|
47 | return project_1.load(id, baseDir);
|
48 | }
|
49 | async clone(id, options) {
|
50 | return project_1.clone(id, options);
|
51 | }
|
52 | }
|
53 | exports.DefaultProjectLoader = DefaultProjectLoader;
|
54 |
|
\ | No newline at end of file |