Skip to content

Commit 8d3bfff

Browse files
Daniel BorowskiDaniel Borowski
authored andcommitted
updated language
1 parent 1c8f8f0 commit 8d3bfff

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The input JSON payload expects two parameters: `language` and a `files` array wi
5252
* C++
5353
* C#
5454
* Clojure
55+
* Elixir
5556
* Go
5657
* Java
5758
* JavaScript

language/elixir/elixir.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package elixir
2+
3+
import (
4+
"github.com/coderbyte-org/cb-code-runner/cmd"
5+
"github.com/coderbyte-org/cb-code-runner/util"
6+
"path/filepath"
7+
)
8+
9+
func Run(files []string, stdin string) (string, string, error) {
10+
workDir := filepath.Dir(files[0])
11+
sourceFiles := util.FilterByExtension(files, "ex")
12+
args := append([]string{"elixirc"}, sourceFiles...)
13+
return cmd.RunStdin(workDir, stdin, args...)
14+
}

language/language.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/coderbyte-org/cb-code-runner/language/typescript"
1616
"github.com/coderbyte-org/cb-code-runner/language/clojure"
1717
"github.com/coderbyte-org/cb-code-runner/language/bash"
18+
"github.com/coderbyte-org/cb-code-runner/language/elixir"
1819
)
1920

2021
type runFn func([]string, string) (string, string, error)
@@ -34,6 +35,7 @@ var languages = map[string]runFn{
3435
"typescript": typescript.Run,
3536
"clojure": clojure.Run,
3637
"bash": bash.Run,
38+
"elixir": elixir.Run,
3739
}
3840

3941
func IsSupported(lang string) bool {

0 commit comments

Comments
 (0)