Skip to content

Commit

Permalink
Added Open Suse Leap and Open Suse Tumbleweed, memory for globals and…
Browse files Browse the repository at this point in the history
… more
  • Loading branch information
mapoart committed Sep 16, 2020
1 parent 9f86482 commit 6faaddb
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 18 deletions.
5 changes: 3 additions & 2 deletions config/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ Object.assign(global, require("../lib/ansi"));
const dev_colors = require("../lib/core/dev-colors");

const functions = {
fs: require("fs"),
path: require("path"),
fs: require("fs"), // https://nodejs.org/api/fs.html
path: require("path"), // https://nodejs.org/api/path.html
dev_colors,
mem: process.memoryUsage, // https://nodejs.org/api/process.html#process_process_memoryusage
};

Object.assign(global, functions);
3 changes: 3 additions & 0 deletions lib/osys.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ module.exports.getInstallCommandByDist = (update) => {
case "CentOS Linux":
case "RHEL Linux":
return `${sudo}yum ${operation} -y`;
case "openSUSE Leap":
case "openSUSE Tumbleweed":
return `${sudo}zypper -n ${operation}`;
default:
return `${sudo}apt-get ${operation} -y`;
}
Expand Down
5 changes: 4 additions & 1 deletion nexss-language/lib/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ module.exports.getLang = (ext, recreateCache) => {
config.osPackageManagers[Object.keys(config.osPackageManagers)[0]];
if (langRepositories[ext]) {
ensureInstalled(osPM.keyOfItem, osPM.installation);
ensureInstalled("git", `${osPM.install} git`);
ensureInstalled(
"git",
`${osPM.install ? osPM.install : osPM.installCommand} git`
);

const repoName = require("path").basename(langRepositories[ext]);
const repoPath = `${NEXSS_LANGUAGES_PATH}/${repoName}`;
Expand Down
4 changes: 2 additions & 2 deletions nexss-start/lib/writeableStdout.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ module.exports.writeableStdout = () =>
timeElapsed(chunk.nxsTime);
} catch (error) {
if (process.argv.indexOf("--nxsModule") >= 0) {
console.log(JSON.stringify({ nxsOut: chunk }));
process.stdout.write(JSON.stringify({ nxsOut: chunk }));
} else {
console.log(
process.stdout.write(
typeof chunk === "object" ? JSON.stringify(chunk) : chunk
);
}
Expand Down
7 changes: 0 additions & 7 deletions tests/Dockerfiles/OpenSuse.Dockerfile

This file was deleted.

12 changes: 12 additions & 0 deletions tests/Dockerfiles/OpenSuseLeap.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM opensuse/leap

# RUN zypper -n ar http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_Leap_42.1/ Devel:Languages:NodeJS
# RUN zypper -n --gpg-auto-import-keys ref Devel:Languages:NodeJS

# RUN zypper -n in patterns-openSUSE-devel_C_C++ gcc-c++

# RUN zypper -n in npm

RUN zypper -n install curl tar gzip
# export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
CMD ["/bin/bash"]
7 changes: 7 additions & 0 deletions tests/Dockerfiles/OpenSuseTumbleweed.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM opensuse/tumbleweed

RUN zypper -n install curl tar gzip
RUN zypper -n in nodejs npm

# export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
CMD ["/bin/bash"]
5 changes: 3 additions & 2 deletions tests/Dockerfiles/_linuxDist.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ function pathToDocker(p) {
const pathNexssCli = pathToDocker(path.resolve(process.cwd(), "../../"));
const pathDotNexss = pathToDocker(path.join(require("os").homedir(), ".nexss"));
// const command = `docker run -d -t ${imageName} bash -c "npm i @nexssp/cli -g && nexss && nexss test all --onlyErrors && /bin/bash`;
// const command = `docker run -i -d -v ${pathNexssCli}:/nexssCli -v ${pathDotNexss}:/root/.nexss -v /root/.nexss/cache -e DEBIAN_FRONTEND=noninteractive -t ${imageName} /bin/bash -c "cd nexssCli && chmod +x nexss.js && ln -s $(pwd)/nexss.js /usr/bin/nexss && mkdir /work && cd /work && /bin/bash" `;
const command = `docker run -i -d -v ${pathNexssCli}:/nexssCli -v ${pathDotNexss}:/root/.nexss -v /root/.nexss/cache -e DEBIAN_FRONTEND=noninteractive -t ${imageName} /bin/bash -c "cd nexssCli && chmod +x nexss.js && ln -s $(pwd)/nexss.js /usr/bin/nexss && mkdir /work && cd /work && /bin/bash" `;
// const command = `docker run -d -it ${imageName} bash -c "npm i @nexssp/cli -g && nexss && /bin/bash`;
const command = `docker run -d -t ${imageName} bin/sh -c "git clone --depth=1 https://github.com/nexssp/cli.git && cd cli && chmod +x nexss.js && ln -s $(pwd)/nexss.js /usr/bin/nexss && nexss && nexss test errors"`;
// const command = `docker run -d -t ${imageName} bin/sh -c "git clone --depth=1 https://github.com/nexssp/cli.git && cd cli && chmod +x nexss.js && ln -s $(pwd)/nexss.js /usr/bin/nexss && nexss && nexss test errors"`;
// const command = `docker run -d -it ${imageName} bin/sh`;
try {
var res = execSync(
// You can build packages inside the container, for dev whatever is needed.
Expand Down
2 changes: 1 addition & 1 deletion tests/Nexssfiles/test1.nexss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Output/Log "This parameter"
// Benchmarking
// --nxsTime
// Output/End --_if=${myvariable} "End of the script.." "${up('THis is a text which will be written up')}"

Output/End --_memory="${mem().rss/(1024*1024)}" "${red(`${_memory}`)} MB."
// Debug
// Debug --nxsDebug OR Debug OR Id --nxsDebug
4 changes: 1 addition & 3 deletions tests/languages.nexss-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ module.exports = {
".swift", // is not implemented on windows yet
// OTHER ISSUES
// ".html",
".pd", // To check
".ps1",
// ".d", // dome compiler proble, default.d not found
".pd", // This language might be removed..
".exs",
".ex",
".erl", // Compiler needs to be installed during adding a file (compile of lib is needed)
Expand Down
1 change: 1 addition & 0 deletions tests/nexssStorage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"myvariable":"this is loooong value which is a second parameter.."}
31 changes: 31 additions & 0 deletions tests/pipe.nexss-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
let values = ["Nexss"];

module.exports = {
values,
startFrom: "",
endsWith: "",
omit: [],
tests: [
{
title: "NEXSS_ pipes",
onError: "stop", // global value,
notEval: true, // Means that parameters will not be evaluated (like below it ${..} will be passed)
tests: [
{
title: "Simply Pipe",
params: [
"nexss Id --nxsAs=MY1 | nexss Id --nxsAs=MY2",
/"MY1":".*".*"MY2":".*"/,
],
},
{
title: "Long Pipe",
params: [
"nexss Id --nxsAs=MY1 | nexss Id --nxsAs=MY2 | nexss Id --nxsAs=MY3 | nexss Id --nxsAs=MY4 | nexss Id --nxsAs=MY5 | nexss Id --nxsAs=MY6",
/"MY1":".*".*"MY2":".*".*"MY3":".*".*"MY4":".*".*"MY5":".*".*"MY6":".*"/,
],
},
],
},
],
};

0 comments on commit 6faaddb

Please sign in to comment.