Skip to content

Commit

Permalink
Fix pathman
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Nov 25, 2023
1 parent 27f390f commit a85eb7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 41 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "domcloud-bridge",
"version": "0.33.0",
"version": "0.34.0",
"description": "Deployment runner for DOM Cloud",
"main": "app.js",
"engines": {
Expand Down
56 changes: 16 additions & 40 deletions src/executor/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,30 +379,6 @@ export default async function runConfig(config, domain, writer, sandbox = false)
}
}
break;
case 'ftp':
enabled = isFeatureEnabled('ftp');
if (value === "off") {
await writeLog("$> Disabling FTP");
if (enabled) {
await virtExec("disable-feature", value, {
domain,
ftp: true,
});
} else {
await writeLog("Already disabled");
}
} else {
if (!enabled) {
await writeLog("$> Enabling FTP");
await virtExec("enable-feature", value, {
domain,
ftp: true,
});
} else {
await writeLog("FTP is already enabled");
}
}
break;
case 'firewall':
if (process.env.MODE === 'dev') {
break;
Expand All @@ -422,13 +398,13 @@ export default async function runConfig(config, domain, writer, sandbox = false)
if (value == 'off') {
await writeLog("$> removing Python engine");
await sshExec("rm -rf ~/.pyenv");
await sshExec("pathman remove ~/.pyenv/bin && pathman remove ~/.pyenv/shims; source ~/.bashrc");
await sshExec("pathman remove ~/.pyenv/bin && pathman remove ~/.pyenv/shims");
await sshExec("sed -i '/pyenv/d' ~/.bashrc");
} else {
const parg = getPythonVersion(value);
await writeLog("$> changing Python engine to " + parg.version);
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash); source ~/.bashrc");
await sshExec("command -v pyenv &> /dev/null || (curl -sS https://webinstall.dev/pyenv | bash); source ~/.bashrc");
await sshExec("command -v pyenv &> /dev/null || (curl -sS https://webinstall.dev/pyenv | bash); source ~/.config/envman/PATH.env");
if (parg.binary) {
await sshExec(`cd ~/tmp && mkdir -p ~/.pyenv/versions/${parg.version}`);
await sshExec(`wget -O python.tar.zst "${parg.binary}" && tar -axf python.tar.zst && rm $_`);
Expand All @@ -448,7 +424,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
await writeLog("$> removing Node engine");
await sshExec("rm -rf ~/.local/opt/node-* ~/.local/opt/node ~/Downloads/webi/node");
await sshExec("rm -rf ~/.cache/yarn ~/.cache/node ~/.config/yarn ~/.npm");
await sshExec("pathman remove ~/.local/opt/node/bin ; source ~/.bashrc");
await sshExec("pathman remove ~/.local/opt/node/bin");
} else {
if (value == "latest" || value == "current") {
arg = ""
Expand All @@ -459,7 +435,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
}
await writeLog("$> changing Node engine to " + (value || 'lts'));
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc");
await sshExec("pathman add .local/opt/node/bin ; source ~/.bashrc");
await sshExec("pathman add .local/opt/node/bin ; source ~/.config/envman/PATH.env");
await sshExec(`curl -sS https://webinstall.dev/node${arg} | bash`);
await sshExec("command -v corepack &> /dev/null || npm i -g corepack && corepack enable");
await sshExec("node --version");
Expand All @@ -470,7 +446,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
if (arg == 'off') {
await writeLog("$> removing Deno engine");
await sshExec("rm -rf ~/.local/opt/deno-* ~/.deno ~/.local/bin/deno ~/Downloads/webi/deno");
await sshExec("pathman remove ~/.deno/bin/ ; source ~/.bashrc");
await sshExec("pathman remove ~/.deno/bin/");
} else {
if (value == "latest" || value == "current") {
arg = ""
Expand All @@ -482,7 +458,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
await writeLog("$> changing Deno engine to " + (value || 'stable'));
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc");
await sshExec(`curl -sS https://webinstall.dev/deno${arg} | bash`);
await sshExec("mkdir -p ~/.deno/bin/ && pathman add $_ ; source ~/.bashrc");
await sshExec("mkdir -p ~/.deno/bin/ && pathman add ~/.deno/bin/ ; source ~/.config/envman/PATH.env");
await sshExec("deno --version");
}
break;
Expand All @@ -493,7 +469,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
await writeLog("$> removing Golang engine");
await sshExec("chmod -R 0700 ~/.local/opt/go-*");
await sshExec("rm -rf ~/.local/opt/go-* ~/.cache/go-build ~/.local/opt/go ~/go ~/Downloads/webi/golang");
await sshExec("pathman remove .local/opt/go/bin ; source ~/.bashrc");
await sshExec("pathman remove .local/opt/go/bin");
} else {
if (value == "latest" || value == "current") {
arg = ""
Expand All @@ -504,7 +480,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
}
await writeLog("$> changing Golang engine to " + (value || 'stable'));
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc");
await sshExec(`curl -sS https://webinstall.dev/golang${arg} | WEBI__GO_ESSENTIALS=true bash ; source ~/.bashrc`);
await sshExec(`curl -sS https://webinstall.dev/golang${arg} | WEBI__GO_ESSENTIALS=true bash ; source ~/.config/envman/PATH.env`);
await sshExec("go version");
}
break;
Expand All @@ -513,13 +489,13 @@ export default async function runConfig(config, domain, writer, sandbox = false)
if (value == 'off') {
await writeLog("$> removing Rust engine");
await sshExec("rustup self uninstall -y");
await sshExec("pathman remove $HOME/.cargo/bin ; source ~/.bashrc");
await sshExec("pathman remove $HOME/.cargo/bin");
break;
} else {
await writeLog(value ? "$> changing Rust engine to " + value : "$> installing Rust engine");
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc");
await sshExec(`command -v rustup &> /dev/null || (curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal)`);
await sshExec(`pathman add $HOME/.cargo/bin ; source ~/.bashrc`);
await sshExec(`pathman add $HOME/.cargo/bin ; source ~/.config/envman/PATH.env`);
if (value && value != "stable" && value != "current" && value != "latest") {
await sshExec(`rustup toolchain install ${value} && rustup default ${value}`);
}
Expand All @@ -545,7 +521,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
await writeLog("$> removing Bun engine");
await sshExec("chmod -R 0700 ~/.local/opt/bun-*");
await sshExec("rm -rf ~/.local/opt/bun-* ~/.local/opt/bun ~/Downloads/webi/bun");
await sshExec("pathman remove .local/opt/bun/bin ; source ~/.bashrc");
await sshExec("pathman remove .local/opt/bun/bin");
} else {
if (value == "latest" || value == "current" || !value || value == "lts") {
arg = ""
Expand All @@ -554,7 +530,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
}
await writeLog("$> changing Bun engine to " + (value || 'latest'));
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc");
await sshExec(`curl -sS https://webinstall.dev/bun${arg} | bash ; source ~/.bashrc`);
await sshExec(`curl -sS https://webinstall.dev/bun${arg} | bash ; source ~/.config/envman/PATH.env`);
await sshExec("bun --version");
}
break;
Expand All @@ -563,7 +539,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
if (arg == 'off') {
await writeLog("$> removing Zig engine");
await sshExec("rm -rf ~/.local/opt/zig ~/Downloads/webi/zig");
await sshExec("pathman remove .local/opt/zig/bin ; source ~/.bashrc");
await sshExec("pathman remove .local/opt/zig/bin");
} else {
if (value == "latest" || value == "current" || !value || value == "lts") {
arg = ""
Expand All @@ -572,7 +548,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
}
await writeLog("$> changing Zig engine to " + (value || 'latest'));
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc");
await sshExec(`curl -sS https://webinstall.dev/zig${arg} | bash ; source ~/.bashrc`);
await sshExec(`curl -sS https://webinstall.dev/zig${arg} | bash ; source ~/.config/envman/PATH.env`);
await sshExec("zig --version");
}
break;
Expand All @@ -581,7 +557,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
if (arg == 'off') {
await writeLog("$> removing Dotnet engine");
await sshExec("rm -rf ~/.dotnet");
await sshExec("pathman remove .dotnet ; source ~/.bashrc");
await sshExec("pathman remove ~/.dotnet");
} else {
if (value == "latest" || value == "current") {
arg = "-- --version latest"
Expand All @@ -593,7 +569,7 @@ export default async function runConfig(config, domain, writer, sandbox = false)
await writeLog("$> changing Dotnet engine to " + (value || 'lts'));
await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc");
await sshExec(`curl -sS https://dot.net/v1/dotnet-install.sh | bash -s ${arg}`);
await sshExec(`pathman add ~/.dotnet ; source ~/.bashrc`);
await sshExec(`pathman add ~/.dotnet ; source ~/.config/envman/PATH.env`);
await sshExec("dotnet --version");
}
break;
Expand Down

0 comments on commit a85eb7c

Please sign in to comment.