diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3351ce2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.log +node_modules diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cd5ba44 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +export PATH := bin:$(PATH) + +.PHONY: build-image +build-image: + docker build . -f docker/Dockerfile.build -t riju:build + +.PHONY: build-shell +build-shell: build-image + docker run -it --rm -v $(PWD):/src riju:build diff --git a/bin/docker b/bin/docker new file mode 100755 index 0000000..79eba1b --- /dev/null +++ b/bin/docker @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [[ "${OSTYPE:-}" != darwin* ]] && [[ "${EUID}" != 0 ]]; then + exec sudo -E docker "$@" +else + exec docker "$@" +fi diff --git a/build/build.js b/build/build.js new file mode 100644 index 0000000..e69de29 diff --git a/build/debug.js b/build/debug.js new file mode 100644 index 0000000..e30bddb --- /dev/null +++ b/build/debug.js @@ -0,0 +1,28 @@ +const fs = require("fs").promises; +const process = require("process"); + +const YAML = require("yaml"); + +async function main() { + const args = process.argv.slice(2); + + if (args.length !== 1) { + console.error("usage: debug.js LANG"); + process.exit(1); + } + + const [lang] = args; + + console.log( + JSON.stringify( + YAML.parse(await fs.readFile(`langs/${lang}.yaml`, "utf-8")), + null, + 2 + ) + ); +} + +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build new file mode 100644 index 0000000..aa44537 --- /dev/null +++ b/docker/Dockerfile.build @@ -0,0 +1,9 @@ +FROM ubuntu:rolling + +COPY docker/scripts/build/install.bash /tmp/ +RUN /tmp/install.bash + +WORKDIR /src +COPY docker/scripts/build/pid1.bash /usr/local/sbin/ +ENTRYPOINT ["/usr/local/sbin/pid1.bash"] +CMD ["bash"] diff --git a/docker/scripts/build/install.bash b/docker/scripts/build/install.bash new file mode 100755 index 0000000..6e2407b --- /dev/null +++ b/docker/scripts/build/install.bash @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +export DEBIAN_FRONTEND=noninteractive + +apt-get update +(yes || true) | unminimize + +apt-get install -y curl gnupg lsb-release + +curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - +curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - + +ubuntu_ver="$(lsb_release -rs)" +ubuntu_name="$(lsb_release -cs)" + +node_repo="$(curl -sS https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)" + +tee -a /etc/apt/sources.list.d/custom.list >/dev/null <- + python3 -u +main: "main.py" +template: | + print("Hello, world!") +run: "python3 -u -i main.py" +scope: + code: | + x = 123 * 234 + +format: + run: >- + black - + input: | + print('Hello, world!') + +pkg: + install: "pip3 install --user NAME" + uninstall: "pip3 uninstall NAME" + search: >- + python3 -c 'import json; from xmlrpc import client; print(json.dumps(client.ServerProxy("https://pypi.org/pypi").search({"name": "NAME"})))' | jq -r 'map(.name) | .[]' + +lsp: + start: "Microsoft.Python.LanguageServer" + init: + interpreter: + properties: + InterpreterPath: "/usr/bin/python3" + code: | + import func + item: "functools" diff --git a/package.json b/package.json new file mode 100644 index 0000000..7b0e167 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "riju", + "version": "0.0.0", + "license": "MIT", + "private": true, + "dependencies": { + "yaml": "^1.10.0" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..a24537e --- /dev/null +++ b/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +yaml@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" + integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==