zarro 1.99.0 → 1.99.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gulp-tasks/build.js +27 -5
- package/gulp-tasks/clean.js +37 -37
- package/gulp-tasks/cover-dotnet.js +56 -56
- package/gulp-tasks/dotnet-publish.js +24 -24
- package/gulp-tasks/git-submodules.js +83 -83
- package/gulp-tasks/modules/ask.ts +41 -41
- package/gulp-tasks/modules/download-nuget.js +104 -104
- package/gulp-tasks/modules/ensure-folder-exists.js +28 -28
- package/gulp-tasks/modules/env-helpers.ts +67 -67
- package/gulp-tasks/modules/env.js +364 -364
- package/gulp-tasks/modules/fail-after.ts +34 -34
- package/gulp-tasks/modules/find-npm-base.js +42 -42
- package/gulp-tasks/modules/fs.js +79 -79
- package/gulp-tasks/modules/git-push-tags.ts +42 -42
- package/gulp-tasks/modules/git-push.js +53 -53
- package/gulp-tasks/modules/git-tag.js +36 -36
- package/gulp-tasks/modules/gulp-dotnetcover.js +537 -537
- package/gulp-tasks/modules/gulp-git-tag-from-csproj.ts +71 -71
- package/gulp-tasks/modules/gulp-git-tag-from-package-nuspec.js +55 -55
- package/gulp-tasks/modules/gulp-increment-nuget-package-version.ts +122 -122
- package/gulp-tasks/modules/gulp-msbuild.js +1 -1
- package/gulp-tasks/modules/gulp-npm-run.ts +52 -52
- package/gulp-tasks/modules/gulp-nuget-pack.js +168 -168
- package/gulp-tasks/modules/gulp-nuget-restore.js +106 -106
- package/gulp-tasks/modules/gulp-nunit-runner/.jshintrc +6 -6
- package/gulp-tasks/modules/gulp-nunit-runner/README.md +300 -300
- package/gulp-tasks/modules/gulp-nunit-runner/index.js +1 -1
- package/gulp-tasks/modules/gulp-nunit-runner/lib/index.js +205 -205
- package/gulp-tasks/modules/gulp-nunit-runner/lib/teamcity.js +86 -86
- package/gulp-tasks/modules/gulp-purge.js +88 -88
- package/gulp-tasks/modules/gulp.js +92 -92
- package/gulp-tasks/modules/http-downloader.js +113 -113
- package/gulp-tasks/modules/import-npm-tasks.js +33 -33
- package/gulp-tasks/modules/increment-version-string.js +18 -18
- package/gulp-tasks/modules/increment-version.ts +41 -41
- package/gulp-tasks/modules/install-local-tools.js +122 -122
- package/gulp-tasks/modules/load-xml-file.ts +15 -15
- package/gulp-tasks/modules/log-config.js +31 -31
- package/gulp-tasks/modules/nuget-push.ts +72 -72
- package/gulp-tasks/modules/nuget-update-self.js +9 -9
- package/gulp-tasks/modules/nuget.ts +14 -14
- package/gulp-tasks/modules/pad.js +25 -25
- package/gulp-tasks/modules/parse-xml-string.ts +6 -6
- package/gulp-tasks/modules/promisify-function.ts +18 -18
- package/gulp-tasks/modules/promisify-stream.js +73 -73
- package/gulp-tasks/modules/read-all-git-branches.ts +13 -13
- package/gulp-tasks/modules/read-all-git-remotes.ts +44 -44
- package/gulp-tasks/modules/read-csproj-package-version.ts +26 -26
- package/gulp-tasks/modules/read-csproj-version.ts +26 -26
- package/gulp-tasks/modules/read-current-git-branch.ts +16 -16
- package/gulp-tasks/modules/read-git-commit-delta-count.ts +33 -33
- package/gulp-tasks/modules/read-git-info.ts +31 -31
- package/gulp-tasks/modules/read-git-remote.ts +23 -23
- package/gulp-tasks/modules/read-last-fetch-time.ts +17 -17
- package/gulp-tasks/modules/read-main-branch-name.ts +75 -75
- package/gulp-tasks/modules/read-nuspec-version.ts +22 -22
- package/gulp-tasks/modules/read-package-json.ts +22 -22
- package/gulp-tasks/modules/register-environment-variables.js +6 -0
- package/gulp-tasks/modules/resolve-git-branch.ts +13 -13
- package/gulp-tasks/modules/resolve-git-remote.ts +13 -13
- package/gulp-tasks/modules/resolve-nuget.js +135 -135
- package/gulp-tasks/modules/rewrite-file.ts +34 -34
- package/gulp-tasks/modules/run-sequence.js +16 -16
- package/gulp-tasks/modules/safe-git.ts +23 -23
- package/gulp-tasks/modules/testutil-finder.js +176 -176
- package/gulp-tasks/modules/uniq.ts +5 -5
- package/gulp-tasks/modules/version-reading-shared.ts +16 -16
- package/gulp-tasks/modules/zarro-error.js +6 -6
- package/gulp-tasks/nuget-restore.js +57 -57
- package/gulp-tasks/release-npm.ts +81 -81
- package/gulp-tasks/start/_package.json +39 -39
- package/gulp-tasks/start/gulpfile.js +204 -204
- package/gulp-tasks/start/update-starter-packages.js +63 -63
- package/gulp-tasks/test-dotnet.js +3 -2
- package/gulp-tasks/update-git-submodules.ts +29 -29
- package/gulp-tasks/update-self.js +4 -4
- package/gulp-tasks/update-self.ts +88 -88
- package/gulp-tasks/verify-up-to-date.js +3 -3
- package/gulp-tasks/verify-up-to-date.ts +119 -119
- package/index-modules/contains-any.js +31 -31
- package/index-modules/handlers/show-env.js +46 -46
- package/package.json +1 -2
- package/tsconfig.json +66 -66
- package/types.d.ts +757 -757
package/gulp-tasks/build.js
CHANGED
|
@@ -33,7 +33,8 @@ const myTasks = ["build"],
|
|
|
33
33
|
"BUILD_EXCLUDE",
|
|
34
34
|
"BUILD_ADDITIONAL_EXCLUDE",
|
|
35
35
|
"BUILD_SHOW_INFO",
|
|
36
|
-
"BUILD_FAIL_ON_ERROR"
|
|
36
|
+
"BUILD_FAIL_ON_ERROR",
|
|
37
|
+
"BUILD_RETRIES"
|
|
37
38
|
];
|
|
38
39
|
env.associate(myVars, myTasks);
|
|
39
40
|
|
|
@@ -41,20 +42,41 @@ gulp.task(
|
|
|
41
42
|
"build",
|
|
42
43
|
"Builds Visual Studio solutions in tree",
|
|
43
44
|
["prebuild"],
|
|
44
|
-
|
|
45
|
+
tryBuild
|
|
45
46
|
);
|
|
46
47
|
|
|
47
|
-
gulp.task("quick-build", "Quick build without pre-cursors",
|
|
48
|
+
gulp.task("quick-build", "Quick build without pre-cursors", tryBuild);
|
|
49
|
+
|
|
50
|
+
async function tryBuild() {
|
|
51
|
+
let attempts = env.resolveNumber("BUILD_RETRIES") + 1;
|
|
52
|
+
if (attempts < 0) {
|
|
53
|
+
attempts = 1;
|
|
54
|
+
}
|
|
55
|
+
const originalAttempts = attempts;
|
|
56
|
+
|
|
57
|
+
while (attempts-- > 0) {
|
|
58
|
+
try {
|
|
59
|
+
await build();
|
|
60
|
+
} catch (e) {
|
|
61
|
+
if (attempts > 0) {
|
|
62
|
+
console.error(chalk.red(`Build fails: ${e}`));
|
|
63
|
+
console.log(`Retrying (${originalAttempts - attempts} / ${originalAttempts})`);
|
|
64
|
+
} else {
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
48
70
|
|
|
49
71
|
async function build() {
|
|
50
|
-
const slnMasks = resolveMasks("BUILD_INCLUDE", [
|
|
72
|
+
const slnMasks = resolveMasks("BUILD_INCLUDE", ["BUILD_EXCLUDE", "BUILD_ADDITIONAL_EXCLUDE"]);
|
|
51
73
|
debug({
|
|
52
74
|
slnMasks,
|
|
53
75
|
cwd: process.cwd()
|
|
54
76
|
});
|
|
55
77
|
const solutions = gulp
|
|
56
78
|
.src(slnMasks, { allowEmpty: true })
|
|
57
|
-
.pipe(throwIfNoFiles(`No solutions found matching masks: ${slnMasks}}`));
|
|
79
|
+
.pipe(throwIfNoFiles(`No solutions found matching masks: ${ slnMasks }}`));
|
|
58
80
|
|
|
59
81
|
// TODO: find a reliable, quick way to determine if the projects to be compiled
|
|
60
82
|
// are all dotnet core -- trawling *.csproj is slow and has caused hangups
|
package/gulp-tasks/clean.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
const gulp = requireModule("gulp"),
|
|
2
|
-
msbuild = require("gulp-msbuild"),
|
|
3
|
-
env = requireModule("env");
|
|
4
|
-
|
|
5
|
-
const myVars = [
|
|
6
|
-
"BUILD_TOOLSVERSION",
|
|
7
|
-
"BUILD_CONFIGURATION",
|
|
8
|
-
"BUILD_VERBOSITY",
|
|
9
|
-
"BUILD_MAX_CPU_COUNT",
|
|
10
|
-
"BUILD_FAIL_ON_ERROR",
|
|
11
|
-
"BUILD_PLATFORM",
|
|
12
|
-
"BUILD_ARCHITECTURE",
|
|
13
|
-
"BUILD_MSBUILD_NODE_REUSE"
|
|
14
|
-
];
|
|
15
|
-
env.associate(myVars, "clean");
|
|
16
|
-
|
|
17
|
-
gulp.task(
|
|
18
|
-
"clean",
|
|
19
|
-
"Invokes the 'Clean' target on all solutions in the tree",
|
|
20
|
-
function() {
|
|
21
|
-
return gulp.src("**/*.sln").pipe(
|
|
22
|
-
msbuild({
|
|
23
|
-
toolsVersion: env.resolve("BUILD_TOOLSVERSION"),
|
|
24
|
-
targets: ["Clean"],
|
|
25
|
-
configuration: env.resolve("BUILD_CONFIGURATION"),
|
|
26
|
-
stdout: true,
|
|
27
|
-
logCommand: true,
|
|
28
|
-
errorOnFail: env.resolveFlag("BUILD_FAIL_ON_ERROR"),
|
|
29
|
-
solutionPlatform: env.resolve("BUILD_PLATFORM"),
|
|
30
|
-
architecture: env.resolve("BUILD_ARCHITECTURE"),
|
|
31
|
-
verbosity: env.resolve("BUILD_VERBOSITY"),
|
|
32
|
-
nodeReuse: env.resolveFlag("BUILD_MSBUILD_NODE_REUSE"),
|
|
33
|
-
maxcpucount: env.resolveNumber("BUILD_MAX_CPU_COUNT")
|
|
34
|
-
})
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
);
|
|
1
|
+
const gulp = requireModule("gulp"),
|
|
2
|
+
msbuild = require("gulp-msbuild"),
|
|
3
|
+
env = requireModule("env");
|
|
4
|
+
|
|
5
|
+
const myVars = [
|
|
6
|
+
"BUILD_TOOLSVERSION",
|
|
7
|
+
"BUILD_CONFIGURATION",
|
|
8
|
+
"BUILD_VERBOSITY",
|
|
9
|
+
"BUILD_MAX_CPU_COUNT",
|
|
10
|
+
"BUILD_FAIL_ON_ERROR",
|
|
11
|
+
"BUILD_PLATFORM",
|
|
12
|
+
"BUILD_ARCHITECTURE",
|
|
13
|
+
"BUILD_MSBUILD_NODE_REUSE"
|
|
14
|
+
];
|
|
15
|
+
env.associate(myVars, "clean");
|
|
16
|
+
|
|
17
|
+
gulp.task(
|
|
18
|
+
"clean",
|
|
19
|
+
"Invokes the 'Clean' target on all solutions in the tree",
|
|
20
|
+
function() {
|
|
21
|
+
return gulp.src("**/*.sln").pipe(
|
|
22
|
+
msbuild({
|
|
23
|
+
toolsVersion: env.resolve("BUILD_TOOLSVERSION"),
|
|
24
|
+
targets: ["Clean"],
|
|
25
|
+
configuration: env.resolve("BUILD_CONFIGURATION"),
|
|
26
|
+
stdout: true,
|
|
27
|
+
logCommand: true,
|
|
28
|
+
errorOnFail: env.resolveFlag("BUILD_FAIL_ON_ERROR"),
|
|
29
|
+
solutionPlatform: env.resolve("BUILD_PLATFORM"),
|
|
30
|
+
architecture: env.resolve("BUILD_ARCHITECTURE"),
|
|
31
|
+
verbosity: env.resolve("BUILD_VERBOSITY"),
|
|
32
|
+
nodeReuse: env.resolveFlag("BUILD_MSBUILD_NODE_REUSE"),
|
|
33
|
+
maxcpucount: env.resolveNumber("BUILD_MAX_CPU_COUNT")
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
const gulp = requireModule("gulp"),
|
|
2
|
-
dotNetCover = requireModule("gulp-dotnetcover"),
|
|
3
|
-
resolveMasks = requireModule("resolve-masks"),
|
|
4
|
-
filter = require("gulp-filter"),
|
|
5
|
-
assemblyFilter = requireModule("net-framework-test-assembly-filter"),
|
|
6
|
-
env = requireModule("env");
|
|
7
|
-
|
|
8
|
-
const myVars = [
|
|
9
|
-
"BUILD_CONFIGURATION",
|
|
10
|
-
"BUILD_PLATFORM",
|
|
11
|
-
"BUILD_ARCHITECTURE",
|
|
12
|
-
"BUILD_TARGETS",
|
|
13
|
-
"BUILD_TOOLSVERSION",
|
|
14
|
-
"BUILD_VERBOSITY",
|
|
15
|
-
"TEST_ARCHITECTURE",
|
|
16
|
-
"TEST_EXCLUDE",
|
|
17
|
-
"TEST_INCLUDE",
|
|
18
|
-
"COVERAGE_ADDITIONAL_EXCLUDE",
|
|
19
|
-
"COVERAGE_EXCLUDE"
|
|
20
|
-
];
|
|
21
|
-
env.associate(myVars, [ "cover-dotnet", "quick-cover-dotnet" ]);
|
|
22
|
-
|
|
23
|
-
const help = "Runs .NET tests with OpenCover or DotCover";
|
|
24
|
-
|
|
25
|
-
function cover() {
|
|
26
|
-
const
|
|
27
|
-
configuration = env.resolve("BUILD_CONFIGURATION"),
|
|
28
|
-
inputMasks = resolveMasks(
|
|
29
|
-
"TEST_INCLUDE",
|
|
30
|
-
"TEST_EXCLUDE"
|
|
31
|
-
).map(
|
|
32
|
-
s => `${s}.dll`
|
|
33
|
-
),
|
|
34
|
-
exclusions = env
|
|
35
|
-
.resolveArray("COVERAGE_EXCLUDE")
|
|
36
|
-
.concat(env.resolveArray("COVERAGE_ADDITIONAL_EXCLUDE")),
|
|
37
|
-
include = env
|
|
38
|
-
.resolveArray("COVERAGE_INCLUDE"),
|
|
39
|
-
exclude = exclusions.filter(e => include.indexOf(e) === -1);
|
|
40
|
-
|
|
41
|
-
return gulp
|
|
42
|
-
.src(inputMasks, { allowEmpty: true })
|
|
43
|
-
.pipe(filter(
|
|
44
|
-
assemblyFilter(configuration)
|
|
45
|
-
))
|
|
46
|
-
.pipe(
|
|
47
|
-
dotNetCover({
|
|
48
|
-
debug: false,
|
|
49
|
-
architecture: env.resolve("TEST_ARCHITECTURE"),
|
|
50
|
-
exclude
|
|
51
|
-
})
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
gulp.task("cover-dotnet", help, [ "build" ], cover);
|
|
56
|
-
gulp.task("quick-cover-dotnet", help, cover);
|
|
1
|
+
const gulp = requireModule("gulp"),
|
|
2
|
+
dotNetCover = requireModule("gulp-dotnetcover"),
|
|
3
|
+
resolveMasks = requireModule("resolve-masks"),
|
|
4
|
+
filter = require("gulp-filter"),
|
|
5
|
+
assemblyFilter = requireModule("net-framework-test-assembly-filter"),
|
|
6
|
+
env = requireModule("env");
|
|
7
|
+
|
|
8
|
+
const myVars = [
|
|
9
|
+
"BUILD_CONFIGURATION",
|
|
10
|
+
"BUILD_PLATFORM",
|
|
11
|
+
"BUILD_ARCHITECTURE",
|
|
12
|
+
"BUILD_TARGETS",
|
|
13
|
+
"BUILD_TOOLSVERSION",
|
|
14
|
+
"BUILD_VERBOSITY",
|
|
15
|
+
"TEST_ARCHITECTURE",
|
|
16
|
+
"TEST_EXCLUDE",
|
|
17
|
+
"TEST_INCLUDE",
|
|
18
|
+
"COVERAGE_ADDITIONAL_EXCLUDE",
|
|
19
|
+
"COVERAGE_EXCLUDE"
|
|
20
|
+
];
|
|
21
|
+
env.associate(myVars, [ "cover-dotnet", "quick-cover-dotnet" ]);
|
|
22
|
+
|
|
23
|
+
const help = "Runs .NET tests with OpenCover or DotCover";
|
|
24
|
+
|
|
25
|
+
function cover() {
|
|
26
|
+
const
|
|
27
|
+
configuration = env.resolve("BUILD_CONFIGURATION"),
|
|
28
|
+
inputMasks = resolveMasks(
|
|
29
|
+
"TEST_INCLUDE",
|
|
30
|
+
"TEST_EXCLUDE"
|
|
31
|
+
).map(
|
|
32
|
+
s => `${s}.dll`
|
|
33
|
+
),
|
|
34
|
+
exclusions = env
|
|
35
|
+
.resolveArray("COVERAGE_EXCLUDE")
|
|
36
|
+
.concat(env.resolveArray("COVERAGE_ADDITIONAL_EXCLUDE")),
|
|
37
|
+
include = env
|
|
38
|
+
.resolveArray("COVERAGE_INCLUDE"),
|
|
39
|
+
exclude = exclusions.filter(e => include.indexOf(e) === -1);
|
|
40
|
+
|
|
41
|
+
return gulp
|
|
42
|
+
.src(inputMasks, { allowEmpty: true })
|
|
43
|
+
.pipe(filter(
|
|
44
|
+
assemblyFilter(configuration)
|
|
45
|
+
))
|
|
46
|
+
.pipe(
|
|
47
|
+
dotNetCover({
|
|
48
|
+
debug: false,
|
|
49
|
+
architecture: env.resolve("TEST_ARCHITECTURE"),
|
|
50
|
+
exclude
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
gulp.task("cover-dotnet", help, [ "build" ], cover);
|
|
56
|
+
gulp.task("quick-cover-dotnet", help, cover);
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const
|
|
2
|
-
{ publish } = require("gulp-dotnet-cli"),
|
|
3
|
-
env = requireModule("env"),
|
|
4
|
-
gulp = requireModule("gulp");
|
|
5
|
-
|
|
6
|
-
gulp.task(
|
|
7
|
-
"dotnet-publish",
|
|
8
|
-
"Performs `dotnet publish` on all non-test projects in the tree",
|
|
9
|
-
() => {
|
|
10
|
-
const publishOpts = {
|
|
11
|
-
configuration: env.resolve("DOTNET_PUBLISH_BUILD_CONFIGURATION", "BUILD_CONFIGURATION"),
|
|
12
|
-
runtime: env.resolve("DOTNET_PUBLISH_RUNTIMES"),
|
|
13
|
-
output: env.resolve("OUTPUT"),
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const testInclusionsInverted = env.resolveArray("TEST_INCLUDE")
|
|
17
|
-
.map(p => `!${p}.csproj`);
|
|
18
|
-
return gulp
|
|
19
|
-
.src(["**/*.csproj"].concat(testInclusionsInverted))
|
|
20
|
-
.pipe(
|
|
21
|
-
publish(publishOpts)
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
);
|
|
1
|
+
const
|
|
2
|
+
{ publish } = require("gulp-dotnet-cli"),
|
|
3
|
+
env = requireModule("env"),
|
|
4
|
+
gulp = requireModule("gulp");
|
|
5
|
+
|
|
6
|
+
gulp.task(
|
|
7
|
+
"dotnet-publish",
|
|
8
|
+
"Performs `dotnet publish` on all non-test projects in the tree",
|
|
9
|
+
() => {
|
|
10
|
+
const publishOpts = {
|
|
11
|
+
configuration: env.resolve("DOTNET_PUBLISH_BUILD_CONFIGURATION", "BUILD_CONFIGURATION"),
|
|
12
|
+
runtime: env.resolve("DOTNET_PUBLISH_RUNTIMES"),
|
|
13
|
+
output: env.resolve("OUTPUT"),
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const testInclusionsInverted = env.resolveArray("TEST_INCLUDE")
|
|
17
|
+
.map(p => `!${p}.csproj`);
|
|
18
|
+
return gulp
|
|
19
|
+
.src(["**/*.csproj"].concat(testInclusionsInverted))
|
|
20
|
+
.pipe(
|
|
21
|
+
publish(publishOpts)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
);
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
const spawn = requireModule("spawn"),
|
|
2
|
-
gulp = requireModule("gulp"),
|
|
3
|
-
log = requireModule("log"),
|
|
4
|
-
fs = requireModule("fs"),
|
|
5
|
-
subModulesFile = ".gitmodules";
|
|
6
|
-
|
|
7
|
-
gulp.task('git-submodules', 'Updates (with --init) all submodules in tree', function () {
|
|
8
|
-
return spawn('git', ['submodule', 'update', '--init', '--recursive']);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
gulp.task('git-submodules-as-externals', function () {
|
|
12
|
-
return new Promise((resolve, reject) => {
|
|
13
|
-
if (!fs.existsSync(subModulesFile)) {
|
|
14
|
-
log.notice('no submodules file found');
|
|
15
|
-
return resolve();
|
|
16
|
-
} else {
|
|
17
|
-
log.notice('performing submodule init/update...');
|
|
18
|
-
spawn('git', ['submodule', 'update', '--init', '--recursive']).then(function () {
|
|
19
|
-
log.info('getting list of local submodules...');
|
|
20
|
-
return fs.readFile(subModulesFile);
|
|
21
|
-
}).then(function (buffer) {
|
|
22
|
-
log.info('grokking paths of local submodules...');
|
|
23
|
-
const fileContents = buffer.toString();
|
|
24
|
-
const lines = fileContents.split("\n");
|
|
25
|
-
const submodulePaths = lines.reduce(function (acc, cur) {
|
|
26
|
-
const parts = cur.split(" = ").map(function (item) {
|
|
27
|
-
return item.trim();
|
|
28
|
-
});
|
|
29
|
-
if (parts.length > 1 && parts[0] === "path") {
|
|
30
|
-
acc.push(parts[1]);
|
|
31
|
-
}
|
|
32
|
-
return acc;
|
|
33
|
-
}, []);
|
|
34
|
-
return submodulePaths;
|
|
35
|
-
}).then(function (modulePaths) {
|
|
36
|
-
const mkdir = function (path) {
|
|
37
|
-
const parts = path.split("/");
|
|
38
|
-
let current = "";
|
|
39
|
-
parts.forEach(function (part) {
|
|
40
|
-
current += current ? "/" : "";
|
|
41
|
-
current += part;
|
|
42
|
-
if (!fs.existsSync(current)) {
|
|
43
|
-
fs.mkdirSync(current);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
modulePaths.forEach(function (path) {
|
|
48
|
-
mkdir(path);
|
|
49
|
-
});
|
|
50
|
-
return modulePaths;
|
|
51
|
-
}).then(function (modulePaths) {
|
|
52
|
-
log.info('making sure local submodules are up to date...');
|
|
53
|
-
const innerDeferred = q.defer();
|
|
54
|
-
const spawnOptions = {
|
|
55
|
-
stdio: [ process.stdin, process.stdout, process.stderr, "pipe" ]
|
|
56
|
-
};
|
|
57
|
-
const finalPromise = modulePaths.reduce(function (acc, cur) {
|
|
58
|
-
const workingFolder = [ process.cwd(), cur ].join("/");
|
|
59
|
-
log.info("working with submodule at: " + cur);
|
|
60
|
-
spawnOptions.cwd = workingFolder;
|
|
61
|
-
return acc.then(function () {
|
|
62
|
-
log.debug(" - fetch changes");
|
|
63
|
-
return spawn("git", [ "fetch" ], spawnOptions).then(function () {
|
|
64
|
-
log.debug(" - switch to master");
|
|
65
|
-
return spawn("git", [ "checkout", "master" ], spawnOptions);
|
|
66
|
-
}).then(function () {
|
|
67
|
-
log.debug(" - fast-forward to HEAD");
|
|
68
|
-
return spawn("git", [ "rebase" ], spawnOptions);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}, innerDeferred.promise);
|
|
72
|
-
innerDeferred.resolve();
|
|
73
|
-
return finalPromise;
|
|
74
|
-
}).then(function () {
|
|
75
|
-
log.info('git submodule magick complete');
|
|
76
|
-
resolve();
|
|
77
|
-
}).catch(function (err) {
|
|
78
|
-
reject(err);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
1
|
+
const spawn = requireModule("spawn"),
|
|
2
|
+
gulp = requireModule("gulp"),
|
|
3
|
+
log = requireModule("log"),
|
|
4
|
+
fs = requireModule("fs"),
|
|
5
|
+
subModulesFile = ".gitmodules";
|
|
6
|
+
|
|
7
|
+
gulp.task('git-submodules', 'Updates (with --init) all submodules in tree', function () {
|
|
8
|
+
return spawn('git', ['submodule', 'update', '--init', '--recursive']);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
gulp.task('git-submodules-as-externals', function () {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
if (!fs.existsSync(subModulesFile)) {
|
|
14
|
+
log.notice('no submodules file found');
|
|
15
|
+
return resolve();
|
|
16
|
+
} else {
|
|
17
|
+
log.notice('performing submodule init/update...');
|
|
18
|
+
spawn('git', ['submodule', 'update', '--init', '--recursive']).then(function () {
|
|
19
|
+
log.info('getting list of local submodules...');
|
|
20
|
+
return fs.readFile(subModulesFile);
|
|
21
|
+
}).then(function (buffer) {
|
|
22
|
+
log.info('grokking paths of local submodules...');
|
|
23
|
+
const fileContents = buffer.toString();
|
|
24
|
+
const lines = fileContents.split("\n");
|
|
25
|
+
const submodulePaths = lines.reduce(function (acc, cur) {
|
|
26
|
+
const parts = cur.split(" = ").map(function (item) {
|
|
27
|
+
return item.trim();
|
|
28
|
+
});
|
|
29
|
+
if (parts.length > 1 && parts[0] === "path") {
|
|
30
|
+
acc.push(parts[1]);
|
|
31
|
+
}
|
|
32
|
+
return acc;
|
|
33
|
+
}, []);
|
|
34
|
+
return submodulePaths;
|
|
35
|
+
}).then(function (modulePaths) {
|
|
36
|
+
const mkdir = function (path) {
|
|
37
|
+
const parts = path.split("/");
|
|
38
|
+
let current = "";
|
|
39
|
+
parts.forEach(function (part) {
|
|
40
|
+
current += current ? "/" : "";
|
|
41
|
+
current += part;
|
|
42
|
+
if (!fs.existsSync(current)) {
|
|
43
|
+
fs.mkdirSync(current);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
modulePaths.forEach(function (path) {
|
|
48
|
+
mkdir(path);
|
|
49
|
+
});
|
|
50
|
+
return modulePaths;
|
|
51
|
+
}).then(function (modulePaths) {
|
|
52
|
+
log.info('making sure local submodules are up to date...');
|
|
53
|
+
const innerDeferred = q.defer();
|
|
54
|
+
const spawnOptions = {
|
|
55
|
+
stdio: [ process.stdin, process.stdout, process.stderr, "pipe" ]
|
|
56
|
+
};
|
|
57
|
+
const finalPromise = modulePaths.reduce(function (acc, cur) {
|
|
58
|
+
const workingFolder = [ process.cwd(), cur ].join("/");
|
|
59
|
+
log.info("working with submodule at: " + cur);
|
|
60
|
+
spawnOptions.cwd = workingFolder;
|
|
61
|
+
return acc.then(function () {
|
|
62
|
+
log.debug(" - fetch changes");
|
|
63
|
+
return spawn("git", [ "fetch" ], spawnOptions).then(function () {
|
|
64
|
+
log.debug(" - switch to master");
|
|
65
|
+
return spawn("git", [ "checkout", "master" ], spawnOptions);
|
|
66
|
+
}).then(function () {
|
|
67
|
+
log.debug(" - fast-forward to HEAD");
|
|
68
|
+
return spawn("git", [ "rebase" ], spawnOptions);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}, innerDeferred.promise);
|
|
72
|
+
innerDeferred.resolve();
|
|
73
|
+
return finalPromise;
|
|
74
|
+
}).then(function () {
|
|
75
|
+
log.info('git submodule magick complete');
|
|
76
|
+
resolve();
|
|
77
|
+
}).catch(function (err) {
|
|
78
|
+
reject(err);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
const
|
|
3
|
-
readline = require("readline");
|
|
4
|
-
|
|
5
|
-
interface AskOptions {
|
|
6
|
-
inputStream: NodeJS.ReadStream,
|
|
7
|
-
outputStream: NodeJS.WriteStream,
|
|
8
|
-
done: ((data: string) => boolean)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const defaultOptions: AskOptions = {
|
|
12
|
-
inputStream: process.stdin,
|
|
13
|
-
outputStream: process.stdout,
|
|
14
|
-
done: (s: string) => true // grab only the first line
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
async function ask(message: string, opts?: AskOptions): Promise<string> {
|
|
18
|
-
opts = Object.assign({}, defaultOptions, opts || {});
|
|
19
|
-
const { done } = opts;
|
|
20
|
-
const rl = readline.createInterface({
|
|
21
|
-
input: opts.inputStream,
|
|
22
|
-
output: opts.outputStream
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const lines: string[] = [];
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
rl.question(message, (line: string) => {
|
|
28
|
-
lines.push(line);
|
|
29
|
-
const all = lines.join("\n");
|
|
30
|
-
if (done(all)) {
|
|
31
|
-
rl.close();
|
|
32
|
-
resolve(all);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = {
|
|
39
|
-
ask
|
|
40
|
-
}
|
|
41
|
-
})();
|
|
1
|
+
(function() {
|
|
2
|
+
const
|
|
3
|
+
readline = require("readline");
|
|
4
|
+
|
|
5
|
+
interface AskOptions {
|
|
6
|
+
inputStream: NodeJS.ReadStream,
|
|
7
|
+
outputStream: NodeJS.WriteStream,
|
|
8
|
+
done: ((data: string) => boolean)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const defaultOptions: AskOptions = {
|
|
12
|
+
inputStream: process.stdin,
|
|
13
|
+
outputStream: process.stdout,
|
|
14
|
+
done: (s: string) => true // grab only the first line
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
async function ask(message: string, opts?: AskOptions): Promise<string> {
|
|
18
|
+
opts = Object.assign({}, defaultOptions, opts || {});
|
|
19
|
+
const { done } = opts;
|
|
20
|
+
const rl = readline.createInterface({
|
|
21
|
+
input: opts.inputStream,
|
|
22
|
+
output: opts.outputStream
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const lines: string[] = [];
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
rl.question(message, (line: string) => {
|
|
28
|
+
lines.push(line);
|
|
29
|
+
const all = lines.join("\n");
|
|
30
|
+
if (done(all)) {
|
|
31
|
+
rl.close();
|
|
32
|
+
resolve(all);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
ask
|
|
40
|
+
}
|
|
41
|
+
})();
|