Skip to content

Commit

Permalink
Classroom concept, issue #313 (#314)
Browse files Browse the repository at this point in the history
* Classroom concept, issue #313

* Improved classroom concept documentation

* Removed teaching instructions, linked to DockerHub

* Update README.md

* Update README.md

Co-authored-by: Gary Rennie <[email protected]>
  • Loading branch information
odiraneyya and Gazler authored Mar 16, 2022
1 parent a712bd5 commit 90f741b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ruby:slim

LABEL org.opencontainers.image.authors="[email protected]"

RUN apt update && apt install -y git

ENV DATA_PATH="/data"
ENV REPO_PATH="/root/githug"
ENV LEVEL_PATH="/git_hug"
ENV GITHUG_PROFILE_INPUT="$LEVEL_PATH/.profile.yml"
ENV GITHUG_HISTORY_OUTPUT="$DATA_PATH/history.txt"
ENV GITHUG_PROFILE_OUTPUT="$DATA_PATH/profile.yml"

RUN mkdir -p $DATA_PATH
ADD . $REPO_PATH
WORKDIR $REPO_PATH
RUN gem build
RUN gem install *.gem

WORKDIR /
RUN echo "y" | $GEM_HOME/bin/githug

WORKDIR $LEVEL_PATH

RUN printf "history -c\nHISTSIZE= \nHISTFILESIZE= \n\
echo '--- NEW SESSION ---' >> $GITHUG_HISTORY_OUTPUT\n\
export PATH=\"\$GEM_HOME/bin:\$PATH\"\ngithug reset\n" >> ~/.bashrc

RUN printf "history -a\ncat \$HISTFILE >> $GITHUG_HISTORY_OUTPUT\n\
cp $GITHUG_PROFILE_INPUT $GITHUG_PROFILE_OUTPUT" >> ~/.bash_logout
RUN printf ". ~/.bashrc\n" > ~/.bash_profile

ENTRYPOINT ["/bin/bash", "--login"]
VOLUME $LEVEL_PATH
VOLUME $DATA_PATH
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ To install Githug, run
If you get a complaint about permissions, you can rerun the command with `sudo`:

sudo gem install githug

#### Usage with Docker

An unofficial _Docker_ image for this project by [@odiraneyya](https://github.com/odiraneyya) is available on ([Docker Hub](https://hub.docker.com/r/orwa84/githug)).

### Starting the Game

Expand Down Expand Up @@ -148,3 +152,5 @@ The easiest way to test a level is:
Please note that the `githug test` command can be run as `githug test --errors` to get an error stack trace from your solve method.

It would be ideal if you add an integration test for your level. These tests live in `spec/githug_spec` and **must** be run in order. If you add a level but do not add a test, please add a simple `skip_level` test case similar to the `contribute` level.


0 comments on commit 90f741b

Please sign in to comment.