-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7400b5b
commit 6d43c7d
Showing
4 changed files
with
40 additions
and
42 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
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,44 +1,46 @@ | ||
const shell = require('shelljs') | ||
const { exec } = require('child_process') | ||
const { paths } = require('./install-docs-config.json') | ||
const shell = require("shelljs"); | ||
Check failure on line 1 in scripts/install-flixel-docs-repo.cjs GitHub Actions / test_matrix (test:js)
|
||
const { exec } = require("child_process"); | ||
Check failure on line 2 in scripts/install-flixel-docs-repo.cjs GitHub Actions / test_matrix (test:js)
|
||
const { paths } = require("./install-docs-config.json"); | ||
Check failure on line 3 in scripts/install-flixel-docs-repo.cjs GitHub Actions / test_matrix (test:js)
|
||
|
||
if (!shell.which('git')) { | ||
shell.echo('Sorry, this script requires git') | ||
shell.exit(1) | ||
if (!shell.which("git")) { | ||
shell.echo("Sorry, this script requires git"); | ||
Check failure on line 6 in scripts/install-flixel-docs-repo.cjs GitHub Actions / test_matrix (test:js)
Check failure on line 6 in scripts/install-flixel-docs-repo.cjs GitHub Actions / test_matrix (test:js)
|
||
shell.exit(1); | ||
} | ||
|
||
console.log('Installing flixel-docs to the following paths:') | ||
console.log(paths.join('\n')) | ||
console.log("Installing flixel-docs to the following paths:"); | ||
console.log(paths.join("\n")); | ||
|
||
const cwd = shell.pwd().stdout | ||
console.log('Current folder: ' + cwd) | ||
const cwd = shell.pwd().stdout; | ||
console.log("Current folder: " + cwd); | ||
|
||
for (const path of paths) { | ||
installDocsToDir(cwd + path) | ||
installDocsToDir(cwd + path); | ||
} | ||
|
||
async function installDocsToDir (path) { | ||
if (shell.test('-e', path + '/.git')) { | ||
console.log('Updating flixel-docs in ' + path + '...') | ||
shell.cd(path) | ||
exec('git fetch --all', (err, stdout, _) => { | ||
if (err) { | ||
console.error(err) | ||
return | ||
} | ||
async function installDocsToDir(path) { | ||
if (shell.test("-e", path + "/.git")) { | ||
console.log("Updating flixel-docs in " + path + "..."); | ||
shell.cd(path); | ||
exec("git fetch --all", (err, stdout, _) => { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
|
||
exec('git pull', (pullerr, pullstdout, _) => { | ||
if (pullerr) { | ||
console.error(pullerr) | ||
return | ||
} | ||
console.log(pullstdout.toString()) | ||
}) | ||
exec("git pull", (pullerr, pullstdout, _) => { | ||
if (pullerr) { | ||
console.error(pullerr); | ||
return; | ||
} | ||
console.log(pullstdout.toString()); | ||
}); | ||
|
||
shell.cd(cwd) | ||
}) | ||
} else { | ||
console.log('Cloning flixel-docs to ' + path + '...') | ||
exec('git clone --depth 1 --no-single-branch https://github.com/haxeflixel/flixel-docs ' + path) | ||
} | ||
shell.cd(cwd); | ||
}); | ||
} else { | ||
console.log("Cloning flixel-docs to " + path + "..."); | ||
exec( | ||
"git clone --depth 1 --no-single-branch https://github.com/haxeflixel/flixel-docs " + path, | ||
); | ||
} | ||
} |