From 3d4b75706f0a681b2c710129b9adf5352d062e83 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Sat, 1 Feb 2020 14:04:25 -0600 Subject: [PATCH] Initial commit --- .dockerignore | 5 +++++ .gitignore | 1 + .pyspelling.yml | 12 ++++++++++++ Dockerfile | 26 ++++++++++++++++++++++++++ README.md | 5 +++++ check_spelling.sh | 36 ++++++++++++++++++++++++++++++++++++ pipeline.yml | 32 ++++++++++++++++++++++++++++++++ requirements.txt | 1 + tag | 1 + upload_pipeline.sh | 11 +++++++++++ 10 files changed, 130 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 .pyspelling.yml create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 check_spelling.sh create mode 100644 pipeline.yml create mode 100644 requirements.txt create mode 100644 tag create mode 100644 upload_pipeline.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7bf0377 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +README.md +pipeline.yml +tag +upload_pipeline.sh +venv/ \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eba74f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv/ \ No newline at end of file diff --git a/.pyspelling.yml b/.pyspelling.yml new file mode 100644 index 0000000..33317e9 --- /dev/null +++ b/.pyspelling.yml @@ -0,0 +1,12 @@ +spellchecker: aspell +matrix: + - name: renpy_dialogue + aspell: + lang: en + hunspell: + lang: en-us + dictionary: + wordlists: + - dictionary/en-custom.txt + output: dictionary/renpy_dialogue_en_custom.dic + encoding: utf-8 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7fd08f3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM python:3-slim + +LABEL maintainer="Drew Short" + +ARG PYSPELLING_VERSION=2.5.1 + +RUN mkdir -p /opt/checker \ + /source + +VOLUME /source + +COPY . /opt/checker + +RUN apt-get -y update \ + && apt-get -y --no-install-recommends install \ + aspell \ + aspell-en \ + awk \ + hunspell \ + hunspell-en-us \ + sed \ + && rm -Rf /var/lib/apt/lists/* + +RUN python -m pip install -r /opt/checker/requirements.txt + +WORKDIR /opt/checker diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c13955 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Ren'Py Dialogue Checker + +[![Concourse](https://concourse.nulloctet.com/api/v1/teams/docker/pipelines/renpy-dialogue-checker/jobs/build-image/badge)](https://concourse.nulloctet.com/teams/docker/pipelines/renpy-dialogue-checker) + +Docker image build for checking renpy dialogue diff --git a/check_spelling.sh b/check_spelling.sh new file mode 100644 index 0000000..dade5b4 --- /dev/null +++ b/check_spelling.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -e + +usage(){ + echo "usage: check_spelling.sh " + exit 1 +} + +start_dir=$(pwd) +script_dir=$(dirname "$0") +cd "$script_dir" + +target_dir="$1" +source_dir="$2" + +cp .pyspelling.yml "$target_dir" + +cd "$target_dir" + +# Determine what to ignore +find "$source_dir" -type f -name "*.rpy" | xargs grep -Eno "#ignorespelling" | sed -r -e "s=${source_dir}==" | awk 'BEGIN {FS=":"}; {printf "^%s:%s\n", $1, $2}' > ignore_directives + +# Find suspect words +pyspelling -n renpy_dialogue -S dialogue.txt | tail -n+4 | head -n -3 > suspect_words + +# Print the suspect words +awk 'BEGIN {FS="\t"}; {printf "%s:%s\t%s\n", $4, $5, $3}' < dialogue.tab | column -ts $'\t' > pretty_dialogue.tab +echo "Ignored lines:" +grep -f ignore_directives pretty_dialogue.tab | grep --color -w -f suspect_words +printf "\nSuspected misspellings:\n" +grep -v -f ignore_directives pretty_dialogue.tab | grep --color -w -f suspect_words + +cd "$start_dir" + +exit 0 \ No newline at end of file diff --git a/pipeline.yml b/pipeline.yml new file mode 100644 index 0000000..07bb47d --- /dev/null +++ b/pipeline.yml @@ -0,0 +1,32 @@ +--- +resources: + - name: git-resource + type: git + icon: git + source: + uri: ssh://git@git.nulloctet.com:8437/docker/renpy-dialogue-checker.git + private_key: | + ((pull_key)) + ignore_paths: + - pipeline.yml + - upload_pipeline.sh + - README.md + - name: git-resource-image + type: docker-image + icon: docker + source: + repository: ((nexus_docker_write.host))/sothr/renpy-dialogue-checker + username: ((nexus_docker_write.username)) + password: ((nexus_docker_write.password)) + +jobs: + - name: build-image + plan: + - get: git-resource + trigger: true + - put: git-resource-image + params: + build: git-resource + tag_file: git-resource/tag + tag_as_latest: true + get_params: {skip_download: true} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..59f7f3b --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyspelling==2.5.1 diff --git a/tag b/tag new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/tag @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/upload_pipeline.sh b/upload_pipeline.sh new file mode 100644 index 0000000..6272f25 --- /dev/null +++ b/upload_pipeline.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +TEAM=docker +PIPELINE=renpy-dialogue-checker + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +pushd "${DIR}" || true + +fly -t ${TEAM} set-pipeline --pipeline ${PIPELINE} --config pipeline.yml + +popd || true