From 506917be39cb9739e3a27f6d4756449a34dc43ce Mon Sep 17 00:00:00 2001 From: Uwe Arnold Date: Sun, 8 Jul 2018 00:15:09 +0200 Subject: [PATCH 1/6] Fix: ansible-galaxy minus to underscore --- .travis.yml | 2 +- README.md | 10 +++++----- meta/main.yml | 2 +- requirements.yml | 4 ++-- tests/test.yml | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2037f1d..6ae7e13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ install: - ansible --version # Link github repo to ansible-galaxy name - - ln -s $PWD ../while-true-do.nginx + - ln -s $PWD ../while_true_do.nginx # Run the tests script: diff --git a/README.md b/README.md index bb379b0..41601a7 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,16 @@ This role is needed to setup nginx. ## Installation -Install from [Ansible Galaxy](https://galaxy.ansible.com/while-true-do/nginx) +Install from [Ansible Galaxy](https://galaxy.ansible.com/while_true_do/nginx) ``` -ansible-galaxy install while-true-do.nginx +ansible-galaxy install while_true_do.nginx ``` Install from [Github](https://github.com/while-true-do/ansible-role-nginx) ``` -git clone https://github.com/while-true-do/ansible-role-nginx.git while-true-do.nginx +git clone https://github.com/while-true-do/ansible-role-nginx.git while_true_do.nginx ``` ## Requirements @@ -99,7 +99,7 @@ Simple Example: ```yaml - hosts: servers roles: - - { role: while-true-do.nginx } + - { role: while_true_do.nginx } ``` Advanced Example: @@ -107,7 +107,7 @@ Advanced Example: ```yaml - hosts: servers roles: - - { role: while-true-do.nginx, wtd_nginx_worker_processes: "8", wtd_nginx_tcp_nopush: "on" } + - { role: while_true_do.nginx, wtd_nginx_worker_processes: "8", wtd_nginx_tcp_nopush: "on" } ``` ## Testing diff --git a/meta/main.yml b/meta/main.yml index 312dec4..100a9ea 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,5 +1,5 @@ dependencies: - - while-true-do.repo-epel + - while_true_do.repo-epel galaxy_info: author: while-true-do.org diff --git a/requirements.yml b/requirements.yml index 95c2d09..72acb2f 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,3 +1,3 @@ --- -# Install while-true-do.repo-epel from galaxy -- src: while-true-do.repo-epel +# Install while_true_do.repo-epel from galaxy +- src: while_true_do.repo-epel diff --git a/tests/test.yml b/tests/test.yml index 7303bc3..fdf1704 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -2,4 +2,4 @@ - hosts: localhost remote_user: root roles: - - while-true-do.nginx + - while_true_do.nginx From ef341649ca0268a64043088bb3aba032f2172c91 Mon Sep 17 00:00:00 2001 From: Uwe Arnold Date: Mon, 16 Jul 2018 21:26:48 +0200 Subject: [PATCH 2/6] Polish: metadata --- .travis.yml | 4 ++- docs/CODE_OF_CONDUCT.md | 3 +-- docs/COMMIT_TEMPLATE.md | 12 ++++----- docs/CONTRIBUTING.md | 5 ++-- docs/ISSUE_TEMPLATE.md | 4 ++- docs/PULL_REQUEST_TEMPLATE.md | 10 +++++-- tests/test-whitespace.sh | 50 +++++++++++++++++++++++++++++++++++ update-meta-files.sh | 14 +++++----- 8 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 tests/test-whitespace.sh diff --git a/.travis.yml b/.travis.yml index 6ae7e13..68fef4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ --- language: python -python: +python: - "2.7" - "3.6" @@ -32,6 +32,8 @@ script: - tests/test-ansible.sh - chmod +x tests/test-spelling.sh - tests/test-spelling.sh + - chmod +x tests/test-whitespace.sh + - tests/test-whitespace.sh notifications: webhooks: diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md index 19565f0..5681a38 100644 --- a/docs/CODE_OF_CONDUCT.md +++ b/docs/CODE_OF_CONDUCT.md @@ -1,7 +1,7 @@ # Code of Conduct | While True Do Code of Conduct -This guideline is only a snapshot. Please have a look [here](https://github.com/while-true-do/community/docs/) to check the latest version. +This guideline is only a snapshot. Please have a look [here](https://github.com/while-true-do/community/tree/master/docs) to check the latest version. ## Welcome @@ -32,7 +32,6 @@ Examples of behaviour that contributes to creating a positive environment: Examples of unacceptable behaviour by participants: - - The use of sexualized language or imagery and unwelcome sexual attention or advances - Trolling, insulting/derogatory comments, and personal or political attacks - Public or private harassment diff --git a/docs/COMMIT_TEMPLATE.md b/docs/COMMIT_TEMPLATE.md index 7c26738..04e62fd 100644 --- a/docs/COMMIT_TEMPLATE.md +++ b/docs/COMMIT_TEMPLATE.md @@ -1,8 +1,8 @@ ### Type of Report diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md index 127a7de..ccb6f45 100644 --- a/docs/PULL_REQUEST_TEMPLATE.md +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -1,24 +1,30 @@ + # Subject of max. 50 characters + + ## Reference + + - Resolves: #12, #13 - See also: #33, #44 ## (Optional) People + + diff --git a/tests/test-ansible.sh b/tests/test-ansible.sh index 11fcd1f..79ec029 100644 --- a/tests/test-ansible.sh +++ b/tests/test-ansible.sh @@ -3,53 +3,58 @@ # Generic test script for ansible roles. # Variables -WTD_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +WTD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" WTD_COLOR_BLUE='\e[1;34m' WTD_COLOR_GREEN='\e[1;32m' WTD_COLOR_RED='\e[1;31m' WTD_COLOR_OFF='\e[0m' +WTD_HR_LINE="****************************************" # Script -printf "$WTD_COLOR_BLUE -**************************************** \n\ -*** Ansible Testing *** \n\ -**************************************** \n\ -$WTD_COLOR_OFF" +printf "%b" "$WTD_COLOR_BLUE" +printf "%s\\n" "$WTD_HR_LINE" +printf "*** %s ***\\n" "Ansible Testing" +printf "%s\\n" "$WTD_HR_LINE" +printf "%b" "$WTD_COLOR_OFF" -printf "*** Step 1: Create valid ansible.cfg *** \n" +printf "*** Step 1: Create valid ansible.cfg ***\\n" printf '[defaults]\nroles_path=../' > "$WTD_SCRIPT_DIR/../ansible.cfg" -printf "**************************************** \n" +printf "%s\\n" "$WTD_HR_LINE" -printf "*** Step 2: Install Dependencies *** \n" -if [ -f $WTD_SCRIPT_DIR/../requirements.yml ]; then +printf "*** Step 2: Install Dependencies ***\\n" +if [ -f "$WTD_SCRIPT_DIR/../requirements.yml" ]; then ansible-galaxy install -v -r "$WTD_SCRIPT_DIR/../requirements.yml" fi -printf "**************************************** \n" +printf "%s\\n" "$WTD_HR_LINE" -printf "*** Step 3: Syntax Check *** \n" +printf "*** Step 3: Syntax Check ***\\n" ansible-playbook "$WTD_SCRIPT_DIR/test.yml" -i "$WTD_SCRIPT_DIR/inventory" -vv --syntax-check || WTD_ERR=true -printf "**************************************** \n" +printf "%s\\n" "$WTD_HR_LINE" -printf "*** Step 4: Linting *** \n" +printf "*** Step 4: Linting ***\\n" ansible-lint -Rv "$WTD_SCRIPT_DIR/test.yml" || WTD_ERR=true -printf "**************************************** \n" +printf "%s\\n" "$WTD_HR_LINE" -printf "*** Step 5: Clean Up *** \n" +printf "*** Step 5: Clean Up ***\\n" rm -v "$WTD_SCRIPT_DIR/../ansible.cfg" -printf "**************************************** \n" +printf "%s\\n" "$WTD_HR_LINE" if [ $WTD_ERR ]; then - printf "$WTD_COLOR_RED -**************************************** \n\ -*** Error occured - Tests failed *** \n\ -**************************************** \n\ - $WTD_COLOR_OFF" + printf "\\n" + printf "%b" "$WTD_COLOR_RED" + printf "%s\\n" "$WTD_HR_LINE" + printf "*** %s ***\\n" \ + "Error occured - Tests failed" + printf "%s\\n" "$WTD_HR_LINE" + printf "%b" "$WTD_COLOR_OFF" exit 1 else - printf "$WTD_COLOR_GREEN -**************************************** \n\ -*** Tests successful *** \n\ -**************************************** \n\ - $WTD_COLOR_OFF" + printf "\\n" + printf "%b" "$WTD_COLOR_GREEN" + printf "%s\\n" "$WTD_HR_LINE" + printf "*** %s ***\\n" \ + "Tests successful" + printf "%s\\n" "$WTD_HR_LINE" + printf "%b" "$WTD_COLOR_OFF" exit 0 fi diff --git a/tests/test-spelling.sh b/tests/test-spelling.sh index a523229..a6f7b5b 100644 --- a/tests/test-spelling.sh +++ b/tests/test-spelling.sh @@ -3,39 +3,43 @@ # Generic test script for Spellchecking markdown files. # Variables -WTD_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +WTD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" WTD_COLOR_BLUE='\e[1;34m' WTD_COLOR_GREEN='\e[1;32m' WTD_COLOR_RED='\e[1;31m' WTD_COLOR_OFF='\e[0m' +WTD_HR_LINE="****************************************" # Script -printf "$WTD_COLOR_BLUE -**************************************** \n\ -*** Spell Checking *** \n\ -**************************************** \n\ -$WTD_COLOR_OFF" +printf "%b" "$WTD_COLOR_BLUE" +printf "%s\\n" "$WTD_HR_LINE" +printf "*** %s ***\\n" "Spell Checking" +printf "%s\\n" "$WTD_HR_LINE" +printf "%b" "$WTD_COLOR_OFF" -BADWORDS=$(sed '/^```/,/^```/d' "$WTD_SCRIPT_DIR/../README.md" | aspell --lang=en --encoding=utf-8\ - --personal="$WTD_SCRIPT_DIR/.aspell.en.pws" list) +BADWORDS=$(sed "/^\`\`\`/,/^\`\`\`/d" "$WTD_SCRIPT_DIR/../README.md" | aspell --lang=en --encoding=utf-8 \ + --personal="$WTD_SCRIPT_DIR/.aspell.en.pws" list) -BADWORDS_COUNT=$(echo $BADWORDS | wc -w) +BADWORDS_COUNT=$(echo "$BADWORDS" | wc -w) -if [ $BADWORDS_COUNT -gt 0 ]; then - printf "$WTD_COLOR_RED -Error occured - Found $BADWORDS_COUNT bad word(s) \n\ -\n\ -Bad Words: \n\ -$BADWORDS \n\ -\n\ -**************************************** \n\ -$WTD_COLOR_OFF" +if [ "$BADWORDS_COUNT" -gt 0 ]; then + printf "\\n" + printf "%b" "$WTD_COLOR_RED" + printf "%s\\n" \ + "Error occured - Found $BADWORDS_COUNT bad word(s)" + printf "\\n" + printf "%s\\n" "Bad Words:" + printf "%s\\n" "$BADWORDS" + printf "\\n" + printf "%s\\n" "$WTD_HR_LINE" + printf "%b" "$WTD_COLOR_OFF" exit 1; else - printf "$WTD_COLOR_GREEN -**************************************** \n\ -*** Spellchecking successful *** \n\ -**************************************** \n\ - $WTD_COLOR_OFF" + printf "\\n" + printf "%b" "$WTD_COLOR_GREEN" + printf "%s\\n" "$WTD_HR_LINE" + printf "*** %s ***\\n" "Spellchecking successful" + printf "%s\\n" "$WTD_HR_LINE" + printf "%b" "$WTD_COLOR_OFF" exit 0; fi diff --git a/tests/test-whitespace.sh b/tests/test-whitespace.sh index 6b87986..966dc25 100644 --- a/tests/test-whitespace.sh +++ b/tests/test-whitespace.sh @@ -3,48 +3,48 @@ # Generic test script for finding trailing whitespace. # Variables -WTD_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +WTD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" WTD_COLOR_BLUE='\e[1;34m' WTD_COLOR_GREEN='\e[1;32m' WTD_COLOR_RED='\e[1;31m' WTD_COLOR_OFF='\e[0m' +WTD_HR_LINE="****************************************" # Script -printf "$WTD_COLOR_BLUE -**************************************** \n\ -*** Whitespace Checking *** \n\ -**************************************** \n\ -$WTD_COLOR_OFF" +printf "%b" "$WTD_COLOR_BLUE" +printf "%s\\n" "$WTD_HR_LINE" +printf "*** %s ***\\n" "Whitespace Checking" +printf "%s\\n" "$WTD_HR_LINE" +printf "%b" "$WTD_COLOR_OFF" -RESULT=$(find . -path "./.git" -prune -o -name "*.md" -prune -o -name "*.md.j2" -o -type f -exec grep -nE ".*\s+$" {} +) +RESULT=$(find "$WTD_SCRIPT_DIR/../" -path "*/.git" -prune -o -name "*.md" -prune -o -name "*.md.j2" -o -type f -exec grep -nE ".*\\s+$" {} +) EXIT_CODE=$? -RESULT_MD=$(find . -path ./.git -prune -o -regextype sed -regex "\(.*\.md\)\|\(.*\.md\.j2\)" -exec grep -nE ".*\s+$" {} +) +RESULT_MD=$(find "$WTD_SCRIPT_DIR/../" -path "*/.git" -prune -o -regextype sed -regex "\\(.*\\.md\\)\\|\\(.*\\.md\\.j2\\)" -exec grep -nE ".*\\s+$" {} +) EXIT_CODE_MD=$? if [ "$EXIT_CODE" -eq 0 ]; then - printf "$WTD_COLOR_RED -Error occured - Found trailing whitespace \n\ -$RESULT \n\ -\n\ -**************************************** \n\ -$WTD_COLOR_OFF" + printf "\\n" + printf "%b" "$WTD_COLOR_RED" + printf "%s\\n" "Error occured - Found trailing whitespace" + printf "\\n" + printf "%s\\n" "$RESULT" + printf "\\n" + printf "%s" "$WTD_HR_LINE" + printf "%b" "$WTD_COLOR_OFF" if [ "$EXIT_CODE_MD" -eq 0 ]; then - printf "\n\ -Please also check the below Markdown files manually: \n\ -$RESULT_MD \n" + printf "\\n%s\\n%s\\n" "Please also check the below Markdown files manually:" "$RESULT_MD" fi exit 1; else - printf "$WTD_COLOR_GREEN -**************************************** \n\ -*** Whitespace checking successful *** \n\ -**************************************** \n\ - $WTD_COLOR_OFF" + printf "\\n" + printf "%b" "$WTD_COLOR_GREEN" + printf "%s\\n" "$WTD_HR_LINE" + printf "*** %s ***\\n" "Whitespace checking successful" + printf "%s\\n" "$WTD_HR_LINE" + printf "%b" "$WTD_COLOR_OFF" if [ "$EXIT_CODE_MD" -eq 0 ]; then - printf "\n\ -Please also check the below Markdown files manually: \n\ -$RESULT_MD \n" + printf "\\n%s\\n%s\\n" "Please also check the below Markdown files manually:" "$RESULT_MD" fi exit 0; fi