From 2490833ef1dfb6eb75675708cd08f7412725b76c Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Fri, 18 Mar 2022 11:16:41 -0600 Subject: [PATCH] add piston nix pkg for coffeescript] --- packages/coffeescript/2.5.1/build.sh | 10 ---- packages/coffeescript/2.5.1/environment | 1 - packages/coffeescript/2.5.1/metadata.json | 5 -- packages/coffeescript/2.5.1/run | 3 -- packages/coffeescript/2.5.1/test.coffee | 1 - runtimes/default.nix | 1 + runtimes/node-coffeescript.nix | 57 +++++++++++++++++++++++ 7 files changed, 58 insertions(+), 20 deletions(-) delete mode 100755 packages/coffeescript/2.5.1/build.sh delete mode 100644 packages/coffeescript/2.5.1/environment delete mode 100644 packages/coffeescript/2.5.1/metadata.json delete mode 100644 packages/coffeescript/2.5.1/run delete mode 100644 packages/coffeescript/2.5.1/test.coffee create mode 100644 runtimes/node-coffeescript.nix diff --git a/packages/coffeescript/2.5.1/build.sh b/packages/coffeescript/2.5.1/build.sh deleted file mode 100755 index 58d99b2..0000000 --- a/packages/coffeescript/2.5.1/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Download and install NodeJS -curl "https://nodejs.org/dist/v15.10.0/node-v15.10.0-linux-x64.tar.xz" -o node.tar.xz -tar xf node.tar.xz --strip-components=1 -rm node.tar.xz -export PATH=$PWD/bin:$PATH - -# Install CoffeeScript via npm and done -npm install --global coffeescript@2.5.1 diff --git a/packages/coffeescript/2.5.1/environment b/packages/coffeescript/2.5.1/environment deleted file mode 100644 index bd0ff98..0000000 --- a/packages/coffeescript/2.5.1/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/coffeescript/2.5.1/metadata.json b/packages/coffeescript/2.5.1/metadata.json deleted file mode 100644 index 23380d1..0000000 --- a/packages/coffeescript/2.5.1/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "coffeescript", - "version": "2.5.1", - "aliases": ["coffeescript", "coffee"] -} diff --git a/packages/coffeescript/2.5.1/run b/packages/coffeescript/2.5.1/run deleted file mode 100644 index 5d8cc03..0000000 --- a/packages/coffeescript/2.5.1/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -coffee "$@" diff --git a/packages/coffeescript/2.5.1/test.coffee b/packages/coffeescript/2.5.1/test.coffee deleted file mode 100644 index b3a8f72..0000000 --- a/packages/coffeescript/2.5.1/test.coffee +++ /dev/null @@ -1 +0,0 @@ -console.log "OK" \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 2f230c9..372ec79 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -59,4 +59,5 @@ args: { "dotnet-sdk-visual-basic" = import ./dotnet-sdk-visual-basic.nix args; "fpc-pascal" = import ./fpc-pascal.nix args; "brainfuck" = import ./brainfuck.nix args; + "node-coffeescript" = import ./node-coffeescript.nix args; } diff --git a/runtimes/node-coffeescript.nix b/runtimes/node-coffeescript.nix new file mode 100644 index 0000000..8f006ea --- /dev/null +++ b/runtimes/node-coffeescript.nix @@ -0,0 +1,57 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.nodePackages.coffee-script; +in piston.mkRuntime { + language = "coffeescript"; + version = pkg.version; + runtime = "node"; + + aliases = [ + "coffee" + ]; + + run = '' + ${pkg}/bin/coffee "$@" + ''; + + tests = [ + # stdout test + (piston.mkTest { + files = { + "test.coffee" = '' + console.log "OK" + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.coffee"; + }) + + # args test + (piston.mkTest { + files = { + "test.coffee" = '' + console.log process.argv[2] + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.coffee"; + }) + + # stdin test + (piston.mkTest { + files = { + "test.coffee" = '' + process.stdin.on('data', (data) => console.log(data.toString())) + ''; + }; + args = []; + stdin = "OK"; + packages = []; + main = "test.coffee"; + }) + ]; +} \ No newline at end of file