From c86b5599fdf599b1dda4f9ef3d5568865de9e92d Mon Sep 17 00:00:00 2001
From: Frank Sauerburger <frank@sauerburger.com>
Date: Tue, 29 Aug 2017 16:40:48 +0200
Subject: [PATCH] First attempt to run doxec in CI

This is the first attempt to test the README file using doxec itself.
---
 .gitlab-ci.yml | 12 ++++++++++--
 Dockerfile     |  2 +-
 README.md      | 23 +++++++++++++++--------
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 09f4f73..83e61fa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,6 @@
-image: ${CI_REGISTRY}/${CI_PROJECT_PATH}/ubuntu_python3:latest
+image: ${CI_REGISTRY_IMAGE}/ubuntu_python3:latest
+
+LABEL maintainer "frank@sauerburger.com"
 
 stages:
   - test
@@ -14,5 +16,11 @@ doxec_doctest:
   script:
     - python3 -m doctest doxec/*.py
 
-     
+README:
+    stage: test
+    variables:
+      DOXEC_COLOR: 0
+
+    script:
+     - bin/doxec --color README.md 
 
diff --git a/Dockerfile b/Dockerfile
index 98f9413..f766eb2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,6 +3,6 @@
 FROM ubuntu:16.04
 
 RUN apt-get update && apt-get install -y  \
-  python3 \
+  python3 python3-setuptools git recode\
   && rm -rf /var/lib/apt/lists/*
 
diff --git a/README.md b/README.md
index 5094f51..2088b82 100644
--- a/README.md
+++ b/README.md
@@ -16,10 +16,11 @@ This ensures that the code snippets work as intended.
 
 You can simply clone the repository and run the setup script to get doxec.
 
+
+<!-- console -->
 ```bash
-$ git clone https://srv.sauerburger.com/esel/doxec.git doxec_install
-$ cd doxec_install
-$ python3 setup.py install
+$ git clone https://srv.sauerburger.com/frank/doxec.git doxec_install
+$ cd doxec_install && python3 setup.py install
 ```
 
 # Usage
@@ -82,6 +83,8 @@ accepts `<pre>` and `</pre>` as code block delimiters.
 ### Example
 
 A full example of a imaginary bash tutorial (hello_world.md) can look like this. 
+
+<!-- write hello_world.md -->
 <pre>
 A mandatory step in learning a new technology in computer science is to
 run a 'hello world' example. Your first step in bash should be no exception.
@@ -95,9 +98,17 @@ Hello World!
 ```
 </pre>
 
+<!-- console
+```
+$ recode html..ascii hello_world.md
+```
+-->
+
 To verify that the code snipped in this tutorial works as expected run
+<!-- console_output -->
 ```bash
 $ doxec hello_world.md
+Doxec -- Copyright (c) 2017 Frank Sauerburger
 /home/esel/rpriv/doxec/hello_world.md:6     console_output ... 
 --- $ echo "Hello World!"
 --- Hello World!
@@ -105,8 +116,8 @@ $ doxec hello_world.md
 --------------------------------------------------------------------------------
 Failed:     0
 Total:      1
-
 ```
+
 The *console_output* command runs the lines starting with `$` in a bash shell
 and compares the output list below.
 
@@ -137,7 +148,3 @@ The following table summarizes the implemented commands.
 | `console` | *none* | Run all lines starting with `$`. All other lines are ignored. This operation fails, if the return value of a command is non-zero. |
 | `console_output` | *none* | Run all lines starting with `$`. All following lines without a leading `$`, are compared to the `stdout` of the previous command. This operation fails, if the outputs differ, or the return value is non-zero. |
 
-# Trivia
-In this early version doxec I have not implemented some kind of meta-execution to
-run doxec on this README file, so ironically the tutorial for doxec could be
-out-of-sync with the actual code.
-- 
GitLab