mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-30 04:59:32 +00:00
remove logger special
This commit is contained in:
parent
d12a587f11
commit
3ea6544f77
@ -2,17 +2,12 @@ const util = require("util");
|
|||||||
const exec = util.promisify(require("child_process").exec);
|
const exec = util.promisify(require("child_process").exec);
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const Log = require("logger");
|
||||||
|
|
||||||
class gitHelper {
|
class gitHelper {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.gitRepos = [];
|
this.gitRepos = [];
|
||||||
this.baseDir = path.normalize(__dirname + "/../../../");
|
this.baseDir = path.normalize(__dirname + "/../../../");
|
||||||
if (process.env.JEST_WORKER_ID === undefined) {
|
|
||||||
this.Log = require("logger");
|
|
||||||
} else {
|
|
||||||
// if we are running with jest
|
|
||||||
this.Log = require("../../../tests/unit/mocks/logger.js");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getRefRegex(branch) {
|
getRefRegex(branch) {
|
||||||
@ -31,7 +26,7 @@ class gitHelper {
|
|||||||
async isGitRepo(moduleFolder) {
|
async isGitRepo(moduleFolder) {
|
||||||
let res = await this.execShell("cd " + moduleFolder + " && git remote -v");
|
let res = await this.execShell("cd " + moduleFolder + " && git remote -v");
|
||||||
if (res.stderr) {
|
if (res.stderr) {
|
||||||
this.Log.error("Failed to fetch git data for " + moduleFolder + ": " + res.stderr);
|
Log.error("Failed to fetch git data for " + moduleFolder + ": " + res.stderr);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -44,7 +39,7 @@ class gitHelper {
|
|||||||
moduleFolder = moduleFolder + "modules/" + moduleName;
|
moduleFolder = moduleFolder + "modules/" + moduleName;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.Log.info("Checking git for module: " + moduleName);
|
Log.info("Checking git for module: " + moduleName);
|
||||||
// Throws error if file doesn't exist
|
// Throws error if file doesn't exist
|
||||||
fs.statSync(path.join(moduleFolder, ".git"));
|
fs.statSync(path.join(moduleFolder, ".git"));
|
||||||
// Fetch the git or throw error if no remotes
|
// Fetch the git or throw error if no remotes
|
||||||
@ -76,13 +71,13 @@ class gitHelper {
|
|||||||
// the hash is only needed for the mm repo
|
// the hash is only needed for the mm repo
|
||||||
res = await this.execShell("cd " + repo.folder + " && git rev-parse HEAD");
|
res = await this.execShell("cd " + repo.folder + " && git rev-parse HEAD");
|
||||||
if (res.stderr) {
|
if (res.stderr) {
|
||||||
this.Log.error("Failed to get current commit hash for " + repo.module + ": " + res.stderr);
|
Log.error("Failed to get current commit hash for " + repo.module + ": " + res.stderr);
|
||||||
}
|
}
|
||||||
gitInfo.hash = res.stdout;
|
gitInfo.hash = res.stdout;
|
||||||
}
|
}
|
||||||
res = await this.execShell("cd " + repo.folder + " && git status -sb");
|
res = await this.execShell("cd " + repo.folder + " && git status -sb");
|
||||||
if (res.stderr) {
|
if (res.stderr) {
|
||||||
this.Log.error("Failed to get git status for " + repo.module + ": " + res.stderr);
|
Log.error("Failed to get git status for " + repo.module + ": " + res.stderr);
|
||||||
// exit without git status info
|
// exit without git status info
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user