Skip to content

Commit

Permalink
cleanups + testing - more done on Linux distros
Browse files Browse the repository at this point in the history
  • Loading branch information
mapoart committed Sep 13, 2020
1 parent 33c3e6a commit cbd2e97
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 21 deletions.
5 changes: 4 additions & 1 deletion lib/osys.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ module.exports.version = () => {
.execSync("cat /etc/*release | grep -E ^VERSION_ID")
.toString()
.trim();
return distName.replace('VERSION_ID="', "").replace('"', "");
return distName
.replace('VERSION_ID="', "")
.replace('"', "")
.replace("VERSION_ID=", "");
} else {
return false;
}
Expand Down
27 changes: 22 additions & 5 deletions nexss-file/lib/fileExtraOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ const { error, success, info, ok } = require("../../lib/log");
const { yellow, red, bold } = require("../../lib/color");
const { which } = require("../../lib/terminal");
const fs = require("fs");
module.exports.extraFunctions = templatePath => {
module.exports.extraFunctions = (templatePath) => {
// Extra operation for the template like installations, files copy, info
if (fs.existsSync(`${templatePath}.js`)) {
console.log("Additional files and commands for this file. Please wait..");
const extraOptions = require(`${templatePath}.js`);
const files = extraOptions.files || [];
const path = require("path");
files.forEach(element => {
files.forEach((element) => {
const elementPath = path.join(path.dirname(templatePath), element);
const destinationPath = NEXSS_PROJECT_SRC_PATH
? path.join(NEXSS_PROJECT_SRC_PATH, path.dirname(element))
Expand Down Expand Up @@ -40,14 +40,31 @@ ${
let commands = extraOptions.commands;

if (commands && commands.forEach) {
const {
replaceCommandByDist,
dist,
} = require(`${process.env.NEXSS_SRC_PATH}/lib/osys`);

// const distName = dist();

// TODO: Later to cleanup this config file !!
// switch (distName) {
// default:
// languageConfig.compilers.ruby.install = replaceCommandByDist(
// languageConfig.compilers.ruby.install
// );
// break;
// }

// FIXME: to check this part!!
commands.forEach(cmd => {
commands.forEach((cmd2) => {
// TODO: better error handling
// console.log(cmd);
cmd = replaceCommandByDist(cmd2);
if (cmd) {
try {
require("child_process").execSync(`${cmd}`, {
stdio: "inherit"
stdio: "inherit",
});
} catch (err) {
error("==========================================================");
Expand Down Expand Up @@ -82,7 +99,7 @@ ${
const descriptions = extraOptions.descriptions || [];
if (descriptions.length > 0) {
// warn("Some information about installed packages.");
descriptions.forEach(desc => {
descriptions.forEach((desc) => {
info(bold("Info from additional third party libraries package:"));
info(desc);
});
Expand Down
33 changes: 18 additions & 15 deletions tests/languages.nexss-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ let values = Object.keys(languages);
//values = [];
// values = values.slice(1, 30);

const {
replaceCommandByDist,
dist,
} = require(`${process.env.NEXSS_SRC_PATH}/lib/osys`);

const distName = dist();

module.exports = {
values,
testsSelect: [1, 2],
Expand All @@ -22,7 +29,6 @@ module.exports = {
".swift", // is not implemented on windows yet
// OTHER ISSUES
// ".html",
".tcl", // Wrong unicode characters
".pd", // To check
".ps1",
// ".d", // dome compiler proble, default.d not found
Expand All @@ -49,32 +55,21 @@ module.exports = {
: [
".cpp", // Oracle Linux 8 does dont have rapid json in the main repo
".cc",
".groovy", // sdk PATH is not reloaded (the same as rust) - How to reload / from child_process of nodejs
".html", // is used only for templates
".swift",
// NOT AVAILABLE ON LINUX/MAC
".ahk",
".au3",
".vbs",
".wsf",
".pd",
".bat",

// Other issues
".jl", // issues with the permissions etc. look later
".ps1", //Shows Error on nexss my.ps1 --nocache --nxsTest --x=123 ### ERROR on linux.
".cs", //Sometimes shows dotnet-script not found
".ex", // Better install
".exs",
".erl", // TO implement
".hs", // TO implement
".hx", // TO implement
".java", // TO implement,
".kts", // TO IMPLEMENT default, helloWorld
".kt", // TO IMPLEMENT default, helloWorld
".rb", // TO implement
".scala", // TO implement
".nim", // TO implement
".hy", // TO implement
".coco", // TO IMPLEMENT default, helloWorld
".coco", // TO IMPLEMENT default, helloWorld
".f90", // TO IMPLEMENT default, helloWorld
".d", // ACtivate function / make it automatic
".v", // TO implement
Expand All @@ -83,6 +78,14 @@ module.exports = {
".m", // TO implement
".raku", // finish installer
".adb", // Ada: TO IMPLEMENT default, helloWorld (filename must be default not Default!)
// =======================================================================================
// ONLY WINDOWS BELOW - SO NOT IMPLEMENTED
".ahk",
".au3",
".vbs",
".wsf",
".pd",
".bat",
],
tests: [
{
Expand Down

0 comments on commit cbd2e97

Please sign in to comment.