Skip to content

Commit

Permalink
Docker workflow actually works boo!
Browse files Browse the repository at this point in the history
  • Loading branch information
ftripier committed Oct 25, 2017
1 parent e22f4a3 commit 616a61d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ RUN eval `opam config env`
RUN opam install core re2 menhir
RUN opam config env >> ~/.profile
RUN opam config env >> ~/.bashrc
WORKDIR /source
COPY ./compiler /compiler
COPY ./build.sh /compiler
WORKDIR /compiler
RUN /compiler/build.sh
RUN ln -s /compiler/_build/spooky.native /usr/local/bin/compile
ENTRYPOINT [ "compile" ]
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ In Spookylang they must also be scary, or your program won't compile.



## The Spookiest Emojis 😱
### The Spookiest Emojis 😱

There's nothing less scary than a keyword.

Expand All @@ -67,7 +67,7 @@ There's nothing less scary than a keyword.

Surprise is a key element of being scared.

It will come as no surprise to you, then, that Spookyland employs the element of surprise in its mandate to spook. Not unlike MongoDB, the spookylang runtime will unpredictably produce terrifying output.
It will come as no surprise to you, then, that Spookyland employs the element of surprise in its mandate to spook. Not unlike MongoDB, the spookylang runtime will occasionally and unpredictably produce terrifying output.


# Building It 🍬
Expand All @@ -77,5 +77,8 @@ The Spookylang compiler is written in WOAH!Caml, a dialect of OCaml wherein the
1. Sweaty
2. Relatively new to OCaml
3. Screaming
4. Veiny

In order to protect our practitioners from the rank OCaml amateurity of our researchers (over 200 compiler warnings. Sorry Jane Street!) we've provided a docker-based workflow. Simply run `docker-compose up` in the repo directory and you should find a scary binary by the name of `spooky.native`. Steel yourself for the overwhelming senselessness of fear and run `./spooky.native examples/hell_world.spooky` to test it out.
In order to protect our practitioners from the rank OCaml-building amateurity of our researchers we've provided a docker-based workflow. Provided you have a relatively modern version of docker installed, you may brace yourself against the overwhelming senselessness of fear and run `./docker-compile.sh examples/hell_world.spooky` to test out an example (the first time will run a bit slow due to building the docker image and the aforementioned OCaml-building amateurism - over 200 compiler warnings, sorry Jane Street!).

`docker-compile.sh` will build and persist a docker image dubbed `spookybox` (don't go in there!), and can be run on any spooky file you desire. This very repo helpfully contains a decent amount of source files in the `examples` subdirectory.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ ocamlbuild \
-tag short_paths \
-cflags "-w A-4-33-40-41-42-43-34-44" \
-cflags -strict-sequence \
compiler/spooky.native
spooky.native
1 change: 1 addition & 0 deletions compiler/isItScary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ let spooky_words = create_spooky_words_regex [
"brain";
"haunted";
"gut";
"hell";
]

let not_scary_words = create_spooky_words_regex (* these words arent spooky, but code reuse *) [
Expand Down
7 changes: 7 additions & 0 deletions docker-compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

if ! docker images | grep -q spookybox
then
docker build . --tag spookybox > /dev/null
fi
docker run --rm -v `pwd`:/source spookybox "/source/${1}"
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
build-compiler:
spooky-compiler:
build: .
volumes:
- .:/source
command: /source/build.sh

0 comments on commit 616a61d

Please sign in to comment.