├── hooks
└── TEST
│ └── post-commit
│ ├── SA-shellcheck-001.expected
│ ├── SA-cleanup.sh
│ └── SA-setup.sh
├── TEST
├── markit
│ ├── FVT-setup.sh
│ ├── SA-setup.sh
│ ├── FVT-cleanup.sh
│ ├── SA-cleanup.sh
│ └── SA-shellcheck-001.expected
├── check-markit
│ ├── SA-setup.sh
│ ├── FVT-cleanup.sh
│ ├── SA-cleanup.sh
│ ├── SA-shellcheck-001.expected
│ └── FVT-setup.sh
└── find-code.sh
│ ├── SA-setup.sh
│ ├── FVT-cleanup.sh
│ ├── SA-cleanup.sh
│ ├── SA-shellcheck-001.expected
│ └── FVT-setup.sh
├── testfiles
├── TEST
│ └── sample.sh
│ │ ├── SA-setup.sh
│ │ └── SA-cleanup.sh
├── foo.pl
├── sample.csh
├── sample.h
├── Dockerfile
├── sample.xml
├── sample.MK
├── sample.yaml
├── Makefile
├── sample.htm
├── sample.pl
├── sample.sh
├── sample.scala
├── sample.c
├── sample.rb
├── sample.go
└── sample.bash
├── images
├── github.png
├── twitter.png
├── linkedin.png
├── markit-output.gif
├── construction-icon.gif
├── check-markit-output.gif
├── clone.table.md
└── view.table.md
├── presentation
├── markit-presentation-18-10-04-13.odp
├── markit-presentation-18-10-07-01.odp
├── markit-presentation-18-10-07-02.odp
├── markit-presentation-18-10-07-03.odp
├── markit-presentation-18-10-07-04.odp
├── markit-presentation-18-10-07-05.odp
├── markit-presentation-18-10-07-06.odp
├── markit-presentation-18-10-07-07.odp
├── markit-presentation-18-10-23-03.odp
├── markit-presentation-18-11-09-01.odp
├── iphone-network
└── markit-presentation-NOTES-18-10-07-05
├── .github
├── ISSUE_TEMPLATE
│ ├── comment.md
│ ├── incident_report.md
│ └── feature_request.md
└── config
├── LICENSE
├── SECURITY.md
├── .gitignore
├── find-code.sh
├── README.md
├── check-markit
├── CHANGELOG.md
└── markit
/hooks/TEST/post-commit/SA-shellcheck-001.expected:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/TEST/markit/FVT-setup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/FVT-setup.sh
--------------------------------------------------------------------------------
/TEST/markit/SA-setup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/SA-setup.sh
--------------------------------------------------------------------------------
/TEST/check-markit/SA-setup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/SA-setup.sh
--------------------------------------------------------------------------------
/TEST/find-code.sh/SA-setup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/SA-setup.sh
--------------------------------------------------------------------------------
/TEST/markit/FVT-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/FVT-cleanup.sh
--------------------------------------------------------------------------------
/TEST/markit/SA-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/SA-cleanup.sh
--------------------------------------------------------------------------------
/TEST/check-markit/FVT-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/FVT-cleanup.sh
--------------------------------------------------------------------------------
/TEST/check-markit/SA-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/SA-cleanup.sh
--------------------------------------------------------------------------------
/TEST/find-code.sh/FVT-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/FVT-cleanup.sh
--------------------------------------------------------------------------------
/TEST/find-code.sh/SA-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../hooks/EXAMPLES/SA-cleanup.sh
--------------------------------------------------------------------------------
/hooks/TEST/post-commit/SA-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../../hooks/EXAMPLES/SA-cleanup.sh
--------------------------------------------------------------------------------
/hooks/TEST/post-commit/SA-setup.sh:
--------------------------------------------------------------------------------
1 | ../../../hooks/EXAMPLES/SA-setup.sh
--------------------------------------------------------------------------------
/testfiles/TEST/sample.sh/SA-setup.sh:
--------------------------------------------------------------------------------
1 | ../../../hooks/EXAMPLES/SA-setup.sh
--------------------------------------------------------------------------------
/testfiles/TEST/sample.sh/SA-cleanup.sh:
--------------------------------------------------------------------------------
1 | ../../../hooks/EXAMPLES/SA-cleanup.sh
--------------------------------------------------------------------------------
/images/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/images/github.png
--------------------------------------------------------------------------------
/images/twitter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/images/twitter.png
--------------------------------------------------------------------------------
/images/linkedin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/images/linkedin.png
--------------------------------------------------------------------------------
/images/markit-output.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/images/markit-output.gif
--------------------------------------------------------------------------------
/images/construction-icon.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/images/construction-icon.gif
--------------------------------------------------------------------------------
/images/check-markit-output.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/images/check-markit-output.gif
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-04-13.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-04-13.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-07-01.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-07-01.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-07-02.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-07-02.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-07-03.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-07-03.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-07-04.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-07-04.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-07-05.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-07-05.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-07-06.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-07-06.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-07-07.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-07-07.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-10-23-03.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-10-23-03.odp
--------------------------------------------------------------------------------
/presentation/markit-presentation-18-11-09-01.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BradleyA/markit/HEAD/presentation/markit-presentation-18-11-09-01.odp
--------------------------------------------------------------------------------
/testfiles/foo.pl:
--------------------------------------------------------------------------------
1 |
2 | # testfiles/foo.pl 3.178.346 2019-02-06T17:05:27.874631-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.177
3 | # update user help message for untracked files
4 |
5 |
6 |
7 | testing
8 |
--------------------------------------------------------------------------------
/testfiles/sample.csh:
--------------------------------------------------------------------------------
1 | #!/bin/csh -f
2 | # testfiles/sample.csh 3.168.333 2019-02-06T11:36:33.474462-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.167
3 | # add support for tcsh csh ksh etc #59 testing
4 | ###
5 | echo Hello, World! csh
6 |
--------------------------------------------------------------------------------
/testfiles/sample.h:
--------------------------------------------------------------------------------
1 | /* */
2 | /* sample.h 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37 */
3 | /* New release not backward compatible with markchaeck because of formatting */
4 | /* */
5 |
6 | void myPrintHelloMake(void);
7 |
--------------------------------------------------------------------------------
/TEST/find-code.sh/SA-shellcheck-001.expected:
--------------------------------------------------------------------------------
1 |
2 | In SA-shellcheck-001 line 240:
3 | ssh -t "${USER}"@"${NODE}" "echo -e '${BOLD}${YELLOW}\c' ; ${REMOTE_COMMAND} ; echo -e '${NORMAL}\c'"
4 | ^-- SC2029: Note that, unescaped, this expands on the client side.
5 |
6 |
--------------------------------------------------------------------------------
/testfiles/Dockerfile:
--------------------------------------------------------------------------------
1 | ######################
2 | # Dockerfile 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37
3 | # New release not backward compatible with markchaeck because of formatting
4 | #
5 | FROM busybox:latest
6 | LABEL MAINTAINER Some One
7 | CMD ["echo 'Hello World'"]
8 |
--------------------------------------------------------------------------------
/TEST/check-markit/SA-shellcheck-001.expected:
--------------------------------------------------------------------------------
1 |
2 | In SA-shellcheck-001 line 236:
3 | REPOSITORY_COMMAND=$(echo "curl \-L ${REPOSITORY_COMMAND}/get/master.zip -o ${TMP_MARKIT_DIR}/master.zip ; unzip -qq ${TMP_MARKIT_DIR}/master.zip -d ${TMP_MARKIT_DIR}/")
4 | ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
5 |
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/comment.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Comment
3 | about: "Information and communications about technology, allows the exchange of knownledge."
4 | title: "Comment - [enter command if available] - [enter brief description]"
5 | labels: 'needs investigation'
6 | assignees: BradleyA
7 |
8 | ---
9 |
10 | **Tell us what you are thinking about:**
11 |
12 | ->
13 |
--------------------------------------------------------------------------------
/testfiles/sample.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Hello World
9 |
10 |
--------------------------------------------------------------------------------
/testfiles/sample.MK:
--------------------------------------------------------------------------------
1 | #
2 | # sample.MK 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37
3 | # New release not backward compatible with markchaeck because of formatting
4 | #
5 | CC=gcc
6 | CFLAGS=-I.
7 | DEPS = hellomake.h
8 | OBJ = hellomake.o hellofunc.o
9 |
10 | %.o: %.c $(DEPS)
11 | $(CC) -c -o $@ $< $(CFLAGS)
12 |
13 | hellomake: $(OBJ)
14 | gcc -o $@ $^ $(CFLAGS)
15 |
--------------------------------------------------------------------------------
/presentation/iphone-network:
--------------------------------------------------------------------------------
1 |
2 | # presentation/iphone-network 3.155.318 2019-02-01T13:37:18.854506-06:00 (CST) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.154-3-gf172d1d
3 | # add presentation and notes
4 |
5 | NOTES:
6 | 1) Connect iphone to laptop USB
7 | 2) Touch Settings
8 | 3) Touch Cellular
9 | 4) Touch Personal Hotspot
10 | 5) Touch slider to activate Personal Hotspot
11 | 6) If you see a screen, touch Wi-Fi and USB only
12 | iphone is now tethered, select iphone as network
13 |
14 |
--------------------------------------------------------------------------------
/.github/config:
--------------------------------------------------------------------------------
1 | [core]
2 | repositoryformatversion = 0
3 | filemode = true
4 | bare = false
5 | logallrefupdates = true
6 | [remote "origin"]
7 | url = https://github.com/BradleyA/markit.git
8 | pushurl = https://github.com/BradleyA/markit.git
9 | pushurl = https://axebbq@bitbucket.org/axebbq/markit.git
10 | pushurl = https://BradleyAxe@gitlab.com/BradleyAxe/markit.git
11 | fetch = +refs/heads/*:refs/remotes/origin/*
12 | [branch "master"]
13 | remote = origin
14 | merge = refs/heads/master
15 |
--------------------------------------------------------------------------------
/testfiles/sample.yaml:
--------------------------------------------------------------------------------
1 | version: "3"
2 | # sample.yaml 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37
3 | # New release not backward compatible with markchaeck because of formatting
4 | #
5 | #
6 | jobs:
7 | - name: hello-world
8 | plan:
9 | - task: say-hello
10 | config:
11 | platform: linux
12 | image_resource:
13 | type: docker-image
14 | source: {repository: ubuntu}
15 | run:
16 | path: echo
17 | args: ["Hello, world!"]
18 |
--------------------------------------------------------------------------------
/testfiles/Makefile:
--------------------------------------------------------------------------------
1 |
2 | # testfiles/Makefile 3.170.337 2019-02-06T15:29:59.071732-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.169-2-ga54656e
3 | # test Makefile
4 |
5 | # Define required macros here
6 | SHELL = /bin/sh
7 |
8 | OBJS = main.o hello.o
9 | CFLAG = -Wall -g
10 | CC = gcc
11 | INCLUDE =
12 | LIBS = -lm
13 |
14 | hello:${OBJ}
15 | ${CC} ${CFLAGS} ${INCLUDES} -o $@ ${OBJS} ${LIBS}
16 |
17 | clean:
18 | -rm -f *.o core *.core a.out
19 |
20 | .cpp.o:
21 | ${CC} ${CFLAGS} ${INCLUDES} -c $<
22 |
--------------------------------------------------------------------------------
/testfiles/sample.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
11 |
12 | Hello World!
13 |
14 |
15 | Hello World!
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/testfiles/sample.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | # testfiles/sample.pl 3.160.325 2019-02-06T10:40:57.091399-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.159
3 | # added comment to run perl script
4 | # sample.pl 3.39.180 2018-08-04_13:27:21_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.38
5 | # New release not backward compatible with markchaeck because of formatting
6 | #
7 | # $ perl sample.pl
8 | use strict;
9 | use warnings;
10 |
11 | print "Hello world in perl\n";
12 | print 42, "\n";
13 |
14 |
--------------------------------------------------------------------------------
/testfiles/sample.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # testfiles/sample.sh 4.2.6.1140 2021-01-03T21:16:06.711575-06:00 (CST) https://github.com/BradleyA/markit.git master uadmin three-rpi3b.cptx86.com 4.2.5-5-ge8abe43
3 | # testfiles/sample.sh --> recording animation after editing testfile/sample.sh
4 | # testfiles/sample.sh 3.209.502 2019-02-25T14:07:27.899183-06:00 (CST) https://github.com/BradleyA/markit.git uadmin six-rpi3b.cptx86.com 3.208-2-g334d4ff
5 | # test git push using markit to github, gitlab, and bitbucket close #63
6 | ### ./sample.sh
7 | echo "Hello World"
8 |
--------------------------------------------------------------------------------
/testfiles/sample.scala:
--------------------------------------------------------------------------------
1 | // HelloWorld.scala
2 | // testfiles/sample.scala 3.126.282 2018-10-23T22:00:44.269863-05:00 (CDT) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.125-2-gb772e50
3 | // added comment on how to run sample code for c ruby scala go
4 | // sample.scala 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37
5 | // New release not backward compatible with markchaeck because of formatting
6 | //
7 | // scalac sample.scala
8 | object HelloWorld {
9 | def main(args: Array[String]) {
10 | println("Hello, world!")
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/testfiles/sample.c:
--------------------------------------------------------------------------------
1 | /* */
2 | /* testfiles/sample.c 3.125.281 2018-10-23T21:30:27.421207-05:00 (CDT) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.125-1-geb6e839 */
3 | /* updated comments about how to run a.out */
4 | /* sample.c 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37 */
5 | /* New release not backward compatible with markchaeck because of formatting */
6 | /* */
7 | /* $ gcc sample.c */
8 | /* $ ./a.out */
9 | #include
10 | int main()
11 | {
12 | // printf() displays the string inside quotation
13 | printf("Hello, World!");
14 | return 0;
15 | }
16 |
--------------------------------------------------------------------------------
/testfiles/sample.rb:
--------------------------------------------------------------------------------
1 | #
2 | # testfiles/sample.rb 3.126.282 2018-10-23T22:00:44.221633-05:00 (CDT) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.125-2-gb772e50
3 | # added comment on how to run sample code for c ruby scala go
4 | # sample.rb 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37
5 | # New release not backward compatible with markchaeck because of formatting
6 | #
7 | # ruby sample.rb
8 | class HelloWorld
9 | def initialize(name)
10 | @name = name.capitalize
11 | end
12 | def sayHi
13 | puts "Hello #{@name}!"
14 | end
15 | end
16 |
17 | hello = HelloWorld.new("World")
18 | hello.sayHi
19 |
--------------------------------------------------------------------------------
/testfiles/sample.go:
--------------------------------------------------------------------------------
1 | //
2 | // testfiles/sample.go 3.159.324 2019-02-06T10:31:06.641225-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.158
3 | // add build comment to sample.go
4 | // testfiles/sample.go 3.125.280 2018-10-23T21:23:22.550260-05:00 (CDT) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.125
5 | // added example on how to run go program
6 | // sample.go 3.38.179 2018-08-04_13:18:57_CDT https://github.com/BradleyA/markit uadmin three-rpi3b.cptx86.com 3.37
7 | // New release not backward compatible with markchaeck because of formatting
8 | //
9 | // $ go run sample.go
10 | // hello world
11 | // $ go build sample.go
12 | // $ ./sample
13 | // hello world in go
14 | //
15 | package main
16 |
17 | import "fmt"
18 |
19 | func main() {
20 | fmt.Println("hello world in go")
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/incident_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Incident Report
3 | about: Report incident you are having
4 | title: "Incident Report - [enter command causing incident] - [enter brief description]"
5 | labels: bug,needs investigation
6 | assignees: BradleyA
7 |
8 | ---
9 |
10 | **Tell us about your incident:**
11 | A clear and concise description, 'what is your incident?'
12 |
13 | ->
14 |
15 | **To reproduce your incident:**
16 | Steps to reproduce your incident:
17 | 1. Go to ->
18 | 2. Enter/Click on ->
19 | 3. Select/Scroll-Down to ->
20 | 4. See error ->
21 |
22 | **Actual results:**
23 | If applicable, add screenshots to help explain your incident.
24 |
25 | ->
26 |
27 | **Expected results:**
28 | A clear and concise description of what results you expected.
29 |
30 | ->
31 |
32 | **Version:**
33 | - OS ( lsb_release -a; Ubuntu 14.04 Ubuntu 16.04 Ubuntu 20.04 )
34 |
35 | ->
36 |
37 | - Command: ( check-markit 4.1.4.803 2020-08-29T22:25:47.061044-05:00 (CDT) https://github.com/BradleyA/markit.git master uadmin )
38 |
39 | ->
40 |
--------------------------------------------------------------------------------
/testfiles/sample.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # testfiles/sample.bash 4.2.9-beta.1.1151 2021-06-08T13:31:04.697362-05:00 (CDT) https://github.com/BradleyA/markit.git master uthree three.cptx86.com 4.2.9-1-g687b283
3 | # testfiles/sample.bash --> testing patch level Semantic Versioning 4.2.9-beta.1
4 | # testfiles/sample.bash 3.167.332 2019-02-06T11:34:55.480714-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.166
5 | # add support for tcsh csh ksh etc #59 testing
6 | # testfiles/sample.sh 3.155.319 2019-02-05T13:02:22.031043-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.155
7 | # testing patch level Semantic Versioning
8 | # testfiles/sample.sh 3.130.286 2018-11-08T18:59:51.665183-06:00 (CST) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.129
9 | # test for meetup
10 | # sample.sh 3.114.267 2018-10-11T11:24:19-05:00 (CDT) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.113
11 | # update example file after test
12 | #
13 | # ./sample.sh
14 | ###
15 |
16 | echo "Hello World"
17 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Bradley Allen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/TEST/markit/SA-shellcheck-001.expected:
--------------------------------------------------------------------------------
1 |
2 | In SA-shellcheck-001 line 22:
3 | COMMAND_NAME=$(echo "${0}" | sed 's/^.*\///') # 3.541
4 | ^-- SC2001: See if you can use ${variable//search/replace} instead.
5 |
6 |
7 | In SA-shellcheck-001 line 206:
8 | if ! $( __gitdir > /dev/null 2>&1 ) ; then
9 | ^-- SC2091: Remove surrounding $() to avoid executing output.
10 |
11 |
12 | In SA-shellcheck-001 line 230:
13 | CURRENT_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1))
14 | ^-- SC2046: Quote this to prevent word splitting.
15 |
16 |
17 | In SA-shellcheck-001 line 244:
18 | cd $(git rev-parse --show-toplevel)
19 | ^-- SC2046: Quote this to prevent word splitting.
20 |
21 |
22 | In SA-shellcheck-001 line 263:
23 | if ! $(touch "${TEMP_FILE}" > /dev/null 2>&1 ) ; then
24 | ^-- SC2091: Remove surrounding $() to avoid executing output.
25 |
26 |
27 | In SA-shellcheck-001 line 384:
28 | tail -n $(wc -l "${FILE_NAME}" | awk '{print $1 - 1}') "${FILE_NAME}" >> "${TEMP_FILE}"
29 | ^-- SC2046: Quote this to prevent word splitting.
30 |
31 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature Request
3 | about: Suggest an idea for this repository, Thank you
4 | title: "Feature Request --> [enter command if available] - [enter brief description]"
5 | labels: new command/service,needs investigation
6 | assignees: BradleyA
7 |
8 | ---
9 |
10 | **Tell us about your feature request:**
11 | A clear and concise description of what you want to happen or the change you would like to see. Use a use case to describe how a person would actually use your request to accomplish a goal. Thank you.
12 |
13 | ->
14 |
15 | **Describe how your feature request could work:**
16 | Steps to demonstrate your feature request.
17 | 1. Go to ->
18 | 2. Enter/Click on ->
19 | 3. Select/Scroll-Down to ->
20 |
21 | **How are you currently working without your feature request?**
22 | A description of any alternative solutions or features you've considered or are using today.
23 |
24 | ->
25 |
26 | **Version:**
27 | - OS ( lsb_release -a ; Ubuntu 14.04 Ubuntu 16.04 Ubuntu 20.04 )
28 |
29 | ->
30 |
31 | - Command: ( check-markit 4.1.4.803 2020-08-29T22:25:47.061044-05:00 (CDT) https://github.com/BradleyA/markit.git master uadmin )
32 |
33 | ->
34 |
--------------------------------------------------------------------------------
/presentation/markit-presentation-NOTES-18-10-07-05:
--------------------------------------------------------------------------------
1 |
2 | # presentation/markit-presentation-NOTES-18-10-07-05 3.155.318 2019-02-01T13:37:26.582928-06:00 (CST) https://github.com/BradleyA/markit bradley zero.cptx86.com 3.154-3-gf172d1d
3 | # add presentation and notes
4 |
5 |
6 | markit-presentation-NOTES-18-10-07-05
7 |
8 | Demo
9 | echo ${PATH} check to see if /usr/local/bin is include in ${PATH}
10 | open github and login to your account : cptx86
11 | search user:BradleyA
12 | locate BradleyA/markit repository and select it and fork it
13 | cd
14 | mkdir -p ~/github/
15 | cd ~/github/
16 | git clone https://github.com//markit
17 | cd markit
18 | sudo cp -p ./markit /usr/local/bin
19 | sudo cp -p ./check-markit /usr/local/bin
20 | markit --help
21 | (DEMO account) vi ~/.gitconfig ; uncomment user.name cptx86
22 |
23 | Demo
24 | head -3 /usr/local/bin/markit
25 | (Note: the following commands will need to be done in your GitLab repository, the following is an example)
26 | cd testfiles
27 | vi foo.sh
28 | markit
29 | git add foo.sh
30 | markit
31 | vi foobar.sh
32 | markit
33 | cat ./foo.sh
34 |
35 | Demo
36 | check-markit --help
37 | check-markit -f ./foo.sh
38 |
39 | Demo
40 | check-markit markit
41 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | ## Security Policy
2 |
3 | This security policy applies to any vulnerabilities. Thank you for taking the time and effort to report security vulnerabilities. There is no monetary rewards for vulnerability disclosures in this repository.
4 |
5 | ## Reporting a Vulnerability
6 |
7 | If you believe you have found a security vulnerability, please submit your report to: allen.bradley@ymail.com
8 |
9 | In your report please include:
10 |
11 | * In email subject line enter in all caps; - SECURITY INCIDENT - ACTION REQUESTED -
12 |
13 | * A brief description of the type of vulnerability.
14 |
15 | * Steps to reproduce. These steps should be benign, non-destructive, proof of concept. This helps to ensure that the report can be triaged quickly and accurately.
16 |
17 | ## What to expect
18 |
19 | After you have submitted your report, we will aim to triage your report within 10 working days.
20 |
21 | Priority for remediation is assessed by looking at the impact, severity, and exploit complexity. Vulnerability reports might take some time to triage or address. You are welcome to enquire on the status but should avoid doing so more than once every 14 days. This allows our teams to focus on the remediation. You may be invited to confirm that the solution covers the vulnerability adequately.
22 |
23 | ## General Guidance
24 |
25 | You must NOT:
26 |
27 | * Break any applicable law or regulations.
28 |
29 | * Attempt or report any form of denial of service, e.g. overwhelming a service with a high volume of requests.
30 |
31 | * Submit reports detailing non-exploitable vulnerabilities, or reports indicating that the services do not fully align with your best practices.
32 |
33 | * Communicate any vulnerabilities or associated details other than by means described in this policy.
34 |
35 | * Perform social engineering or phishing attacks.
36 |
37 | * Demand financial compensation in order to disclose any vulnerabilities.
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # .gitignore (sudo apt-get install git-all)
2 | # .gitignore 4.1.139.1081 2020-12-13T22:27:52.848781-06:00 (CST) https://github.com/BradleyA/markit master uadmin three-rpi3b.cptx86.com 4.1.138
3 | # .gitignore --> testing
4 | # .gitignore 3.594.958 2020-10-18T16:02:16.726384-05:00 (CDT) https://github.com/BradleyA/user-files.git master uadmin one-rpi3b.cptx86.com 3.593
5 | # .gitignore --> add hooks/ git-TEST-commit-automation directories
6 | # .gitignore 3.306.535 2019-08-16T17:15:26.734333-05:00 (CDT) https://github.com/BradleyA/user-files.git uadmin one-rpi3b.cptx86.com 3.305-2-g62999fe
7 | # .gitignore add *.test-case-output .netrc
8 | # .gitignore 1.0.6 2018-02-15_10:58:09_CST uadmin four-rpi3b.cptx86.com 1.0
9 | # Inital commit of basic .gitignore settings
10 | # all git-TEST-commit-automation files other than custom test cases in TEST directories
11 | hooks/
12 | # ignore
13 | *.test-case-output
14 | .netrc
15 | .env
16 | chefignore
17 | .gitignore
18 | .dockerignore
19 | # editor #
20 | **/*~
21 | **/*.bak
22 | **/*.sw[abcdefghijklmnop]
23 | **/*#
24 | # IDE #
25 | /.idea/workspace.xml
26 | /.idea/tasks.xml
27 | .classpath
28 | .project
29 | .settings
30 | .metadata
31 | *.iml
32 | *.ipr
33 | # thanks to octocat@github.com for some of these
34 | # Compile #
35 | **/*.dll
36 | **/*.exe
37 | **/*.o
38 | **/*.pyc
39 | **/*.pyo
40 | **/*.swf
41 | **/*.air
42 | **/*.ipa
43 | **/*.apk
44 | **/*.slo
45 | **/*.lo
46 | **/*.obj
47 | **/*.lai
48 | **/*.la
49 | **/*.a
50 | **/*.lib
51 | **/*.gch
52 | **/*.pch
53 | **/*.ilk
54 | **/*.map
55 | **/*.exp
56 | **/*.dylib
57 | # Executables #
58 | **/*.exe
59 | **/*.exe~
60 | **/*.out
61 | **/*.app
62 | # Packages #
63 | **/*.7z
64 | **/*.dmg
65 | **/*.gz
66 | **/*.iso
67 | **/*.jar
68 | **/*.rar
69 | **/*.tar
70 | **/*.zip
71 | # Logs and databases #
72 | **/*.log
73 | **/*.sql
74 | **/*.sqlite
75 | # Other #
76 | **/target/
77 | **/*.war
78 | **/*.ear
79 | ###
80 |
--------------------------------------------------------------------------------
/images/clone.table.md:
--------------------------------------------------------------------------------
1 | #### 2020 GitHub clones
2 | Date: | 01-06 | 01-13 | 01-27 | 02-03 | 02-10 | 02-17 | 02-24 | 03-02 | 03-09 | 03-23 | 03-30 | 04-06 | 04-13 | 04-20 | 04-27 | 05-04 | 05-18 | 05-25 | 06-01 | 06-29 | 07-06 | 07-13 | 07-27 | 08-03 | 08-10 | 08-17 | 08-24 | 08-31 | 09-07 | 09-14 | 09-21 | 09-28 | 10-05 | 10-12 | 10-19 | 10-26 | 11-02 | 11-09 | 11-16 | 11-23 | 11-30 | 12-07 | 12-14
3 | |:--- |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---:
4 | Clones: | 6 | 14 | 2 | 6 | 2 | 2 | 3 | 2 | 2 | 1 | 1 | 6 | 4 | 14 | 1 | 13 | 19 | 1 | 1 | 23 | 7 | 3 | 9 | 1 | 7 | 12 | 97 | 4 | 32 | 2 | 1 | 19 | 5 | 21 | 45 | 33 | 8 | 15 | 14 | 1 | 18 | 11 | 8
5 | Unique clones: | 5 | 10 | 2 | 3 | 2 | 2 | 2 | 2 | 2 | 1 | 1 | 6 | 3 | 11 | 1 | 10 | 12 | 1 | 1 | 18 | 7 | 3 | 9 | 1 | 7 | 7 | 18 | 4 | 11 | 2 | 1 | 11 | 5 | 11 | 12 | 16 | 8 | 9 | 11 | 1 | 14 | 9 | 7
6 |
7 | Total clones: 496
8 | ###### Updated: 2020-12-16
9 |
10 | #### 2019 GitHub clones
11 | Date: | 07-15 | 07-22 | 07-29 | 08-05 | 08-12 | 08-19 | 08-26 | 09-02 | 09-09 | 09-16 | 09-23 | 09-30 | 10-07 | 10-14 | 10-21 | 12-09 | 12-16 | 12-23 | 12-30
12 | |:--- |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---:
13 | Clones: | 1 | 2 | 1 | 2 | 2 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 7 | 12 | 1 | 2 | 2 | 8 | 9
14 | Unique clones: | 1 | 2 | 1 | 2 | 2 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 3 | 5 | 1 | 1 | 2 | 6 | 6
15 |
16 | Total clones: 58
17 | ###### Updated: 2020-01-04
18 | **Note** Data collection stopped between 10/14/2019 & 12/9/2019
19 |
20 | [Return to README](https://github.com/BradleyA/markit/blob/master/README.md)
21 |
--------------------------------------------------------------------------------
/images/view.table.md:
--------------------------------------------------------------------------------
1 | #### 2020 GitHub visitors
2 | Date: | 01-06 | 01-13 | 01-20 | 01-27 | 02-03 | 02-10 | 02-17 | 02-24 | 03-02 | 03-09 | 03-16 | 03-23 | 03-30 | 04-06 | 04-13 | 04-20 | 05-04 | 05-11 | 05-18 | 05-25 | 06-01 | 06-08 | 06-15 | 06-22 | 06-29 | 07-06 | 07-13 | 07-20 | 07-27 | 08-03 | 08-10 | 08-17 | 08-24 | 08-31 | 09-07 | 09-14 | 09-21 | 09-28 | 10-05 | 10-12 | 10-19 | 10-26 | 11-02 | 11-09 | 11-16 | 11-23 | 11-30 | 12-07 | 12-14
3 | |:--- |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---:
4 | Views: | 82 | 102 | 2 | 6 | 28 | 17 | 8 | 1 | 3 | 7 | 17 | 7 | 1 | 21 | 39 | 78 | 53 | 5 | 159 | 1 | 9 | 2 | 1 | 4 | 33 | 25 | 6 | 8 | 39 | 21 | 19 | 175 | 566 | 11 | 102 | 20 | 2 | 111 | 84 | 150 | 146 | 54 | 23 | 28 | 18 | 2 | 20 | 52 | 4
5 | Unique vistors: | 4 | 3 | 1 | 1 | 6 | 3 | 7 | 1 | 3 | 7 | 2 | 5 | 1 | 2 | 2 | 4 | 5 | 1 | 2 | 1 | 1 | 2 | 1 | 3 | 5 | 2 | 2 | 3 | 4 | 1 | 5 | 7 | 2 | 2 | 2 | 3 | 2 | 2 | 3 | 6 | 2 | 3 | 2 | 4 | 1 | 2 | 6 | 2 | 1
6 |
7 | Total views: 2372
8 | ###### Updated: 2020-12-16
9 |
10 | #### 2019 GitHub Visitors
11 | Date: | 07-15 | 07-22 | 08-05 | 08-12 | 08-19 | 09-02 | 09-09 | 09-16 | 09-23 | 10-07 | 10-14 | 12-09 | 12-16 | 12-23 | 12-30
12 | |:--- |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---:
13 | Views: | 1 | 6 | 11 | 7 | 5 | 15 | 2 | 5 | 4 | 17 | 22 | 1 | 2 | 86 | 75
14 | Unique vistors: | 1 | 4 | 3 | 1 | 2 | 2 | 1 | 2 | 2 | 5 | 3 | 1 | 2 | 3 | 2
15 |
16 | Total views: 259
17 | ###### Updated: 2020-01-04
18 |
19 | **Note** Data collection stopped between 10/14/2019 & 12/9/2019
20 |
21 | [Return to README](https://github.com/BradleyA/markit/blob/master/README.md)
22 |
--------------------------------------------------------------------------------
/find-code.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # find-code.sh 4.2.1.1114 2020-12-22T21:01:38.358134-06:00 (CST) https://github.com/BradleyA/markit.git master uadmin three-rpi3b.cptx86.com 4.1.146-24-g68844ef
3 | # check-markit find-code.sh markit --> release ready for production
4 | #86# find-code.sh - Search systems from clones from repositories
5 | ### Production standard 5.3.559 Copyright # 3.559
6 | # Copyright (c) 2020 Bradley Allen # 3.555
7 | # MIT License is online in the repository as a file named LICENSE" # 3.559
8 | ### Production standard 3.0 shellcheck
9 | ### Production standard 1.3.614 DEBUG variable
10 | # Order of precedence: environment variable, default code
11 | if [[ "${DEBUG}" == "" ]] ; then DEBUG="0" ; fi # 0 = debug off, 1 = debug on, 'export DEBUG=1', 'unset DEBUG' to unset environment variable (bash)
12 | if [[ "${DEBUG}" == "2" ]] ; then set -x ; fi # Print trace of simple commands before they are executed
13 | if [[ "${DEBUG}" == "3" ]] ; then set -v ; fi # Print shell input lines as they are read
14 | if [[ "${DEBUG}" == "4" ]] ; then set -e ; fi # Exit immediately if non-zero exit status
15 | if [[ "${DEBUG}" == "5" ]] ; then set -e -o pipefail ; fi # Exit immediately if non-zero exit status and exit if any command in a pipeline errors
16 | #
17 | #
18 | BOLD=$(tput -Txterm bold)
19 | UNDERLINE=$(tput -Txterm sgr 0 1) # 0.3.583
20 | NORMAL=$(tput -Txterm sgr0)
21 | RED=$(tput setaf 1)
22 | YELLOW=$(tput setaf 3)
23 | BLUE=$(tput setaf 4)
24 | PURPLE=$(tput setaf 5)
25 | CYAN=$(tput setaf 6)
26 | WHITE=$(tput setaf 7)
27 |
28 | ### Production standard 7.3.602 Default variable value
29 | DEFAULT_CLUSTER="us-tx-cluster-1/"
30 | DEFAULT_DATA_DIR="/usr/local/data/"
31 | DEFAULT_SYSTEMS_FILE="SYSTEMS"
32 |
33 | ### Production standard 8.3.541 --usage
34 | COMMAND_NAME=$(echo "${0}" | sed 's/^.*\///') # 3.541
35 | display_usage() {
36 | echo -e "\n${NORMAL}${COMMAND_NAME}\n Search systems for .git repositories"
37 | echo -e "\n${BOLD}USAGE${NORMAL}"
38 | echo -e " ${COMMAND_NAME} [-c ] [-d ] [-s ]\n"
39 | echo " ${COMMAND_NAME} [--help | -help | help | -h | h | -?]"
40 | echo " ${COMMAND_NAME} [--usage | -usage | -u]"
41 | echo " ${COMMAND_NAME} [--version | -version | -v]"
42 | }
43 |
44 | ### Production standard 0.3.615 --help
45 | display_help() {
46 | display_usage
47 | # Displaying help DESCRIPTION in English en_US.UTF-8, en.UTF-8, C.UTF-8
48 | echo -e "\n${BOLD}DESCRIPTION${NORMAL}"
49 | echo -e "\nThis script reads ${DEFAULT_DATA_DIR}${DEFAULT_CLUSTER}${DEFAULT_SYSTEMS_FILE} file for hosts"
50 | echo "to search for .git repositories in ~/.. directories."
51 | echo -e "\nThe // includes one FQDN or IP address per"
52 | echo "line for all hosts in the cluster. Lines in that begin with a"
53 | echo "'#' are comments. The is used by markit/find-code.sh,"
54 | echo "Linux-admin/cluster-command/cluster-command.sh, docker-TLS/copy-registry-tls.sh,"
55 | echo "pi-display/create-message/create-display-message.sh, and other scripts. A"
56 | echo "different can be used by setting the SYSTEMS_FILE environment"
57 | echo "variable or by editing this script and changing DEFAULT_SYSTEMS_FILE."
58 | echo -e "\nThe user may receive password and/or passphrase prompts from a remote system;"
59 | echo "running the following may stop the prompts in your cluster."
60 | echo -e "\t${BOLD}ssh-copy-id @${NORMAL}"
61 | echo "or"
62 | echo -e "\t${BOLD}ssh-copy-id @<192.168.x.x>${NORMAL}"
63 | echo "If that does not resolve the prompting challenge then review the man pages for"
64 | echo "ssh-agent and ssh-add before entering the following in a terminal window."
65 | echo -e "\t${BOLD}eval \$(ssh-agent)${NORMAL}"
66 | echo -e "\t${BOLD}ssh-add${NORMAL}"
67 |
68 | ### Production standard 4.3.587 Documentation Language # 3.550
69 | # Displaying help DESCRIPTION in French fr_CA.UTF-8, fr_FR.UTF-8, fr_CH.UTF-8
70 | if [[ "${LANG}" == "fr_CA.UTF-8" ]] || [[ "${LANG}" == "fr_FR.UTF-8" ]] || [[ "${LANG}" == "fr_CH.UTF-8" ]] ; then
71 | echo -e "\n--> ${LANG}"
72 | echo "" # Your help goes here
73 | echo "Souhaitez-vous traduire la section description?" # Would you like to translate the description section?
74 | elif ! [[ "${LANG}" == "en_US.UTF-8" || "${LANG}" == "en.UTF-8" || "${LANG}" == "C.UTF-8" ]] ; then # 3.550
75 | new_message "${LINENO}" "${YELLOW}INFO${WHITE}" " Your language, ${LANG}, is not supported. Would you like to translate the description section?" 1>&2
76 | fi
77 |
78 | echo -e "\n${BOLD}ENVIRONMENT VARIABLES${NORMAL}"
79 | echo "If using the bash shell, enter; 'export DEBUG=1' on the command line to set"
80 | echo "the environment variable DEBUG to '1' (0 = debug off, 1 = debug on). Use the"
81 | echo "command, 'unset DEBUG' to remove the exported information from the environment"
82 | echo "variable DEBUG. You are on your own defining environment variables if"
83 | echo "you are using other shells."
84 |
85 | ### Production standard 1.3.614 DEBUG variable
86 | echo " DEBUG (default off '0') The DEBUG environment variable can be set" # 1.3.550
87 | echo " to 0, 1, 2, 3, 4 or 5. The setting '' or 0 will turn off" # 1.3.550
88 | echo " all DEBUG messages during execution of this script. The" # 1.3.550
89 | echo " setting 1 will print all DEBUG messages during execution." # 1.3.550
90 | echo " Setting 2 (set -x) will print a trace of simple commands" # 1.3.550
91 | echo " before they are executed. Setting 3 (set -v) will print" # 1.3.550
92 | echo " shell input lines as they are read. Setting 4 (set -e) will" # 1.3.550
93 | echo " exit immediately if non-zero exit status is recieved with" # 1.3.550
94 | echo " some exceptions. Setting 5 (set -e -o pipefail) will do" # 1.3.550
95 | echo " setting 4 and exit if any command in a pipeline errors. For" # 1.3.550
96 | echo " more information about the set options, see man bash." # 1.3.550
97 | #
98 | echo " CLUSTER Cluster name (default '${DEFAULT_CLUSTER}')"
99 | echo " DATA_DIR Data directory (default '${DEFAULT_DATA_DIR}')"
100 | echo " SYSTEMS_FILE Name of file that includes hosts in cluster"
101 | echo " (default '${DEFAULT_SYSTEMS_FILE}')"
102 |
103 | echo -e "\n${BOLD}OPTIONS${NORMAL}"
104 | echo -e "Order of precedence: CLI options, environment variable, default value.\n" # 0.3.595
105 | echo " --help, -help, help, -h, h, -?" # 0.3.595
106 | echo -e "\tOn-line brief reference manual\n" # 0.3.595
107 | echo " --usage, -usage, -u" # 0.3.595
108 | echo -e "\tOn-line command usage\n" # 0.3.595
109 | echo " --version, -version, -v" # 0.3.595
110 | echo -e "\tOn-line command version\n" # 0.3.595
111 | #
112 | echo " --cluster , -c , --cluster=, -c=" # 0.3.595
113 | echo -e "\tCluster name (default '${DEFAULT_CLUSTER}')\n"
114 | echo " --datadir , -d , --datadir=, -d=" # 0.3.595
115 | echo -e "\tData directory (default '${DEFAULT_DATA_DIR}')\n"
116 | echo " --systems , -s , --systems=, -s=" # 0.3.595
117 | echo -e "\tName of systems file (default '${DEFAULT_SYSTEMS_FILE}')"
118 |
119 | ### Production standard 6.3.547 Architecture tree
120 | echo -e "\n${BOLD}ARCHITECTURE TREE${NORMAL}" # STORAGE & CERTIFICATION
121 | echo "/usr/local/data/ <-- Data directory"
122 | echo "└── / <-- Cluster name"
123 | echo " └── SYSTEMS <-- List of hosts in cluster"
124 |
125 | echo -e "\n${BOLD}DOCUMENTATION${NORMAL}"
126 | echo " ${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md${NORMAL}"
127 |
128 | echo -e "\n${BOLD}EXAMPLES${NORMAL}"
129 | echo -e " Search systems for .git repositories using defaults\n\t${BOLD}${COMMAND_NAME}${NORMAL}\n" # 0.3.595
130 | echo -e " Search systems for .git repositories using a different .\n\t${BOLD}${COMMAND_NAME} -c australia-southeast1 ${NORMAL}\n" # 0.3.595
131 | echo -e " Search systems for .git repositories using a different .\n\t${BOLD}${COMMAND_NAME} -s SYSTEMS-RASPBERRY ${NORMAL}" # 0.3.595
132 |
133 | echo -e "\n${BOLD}SEE ALSO${NORMAL}" # 0.3.615
134 | echo " ${BOLD}check-markit${NORMAL} Check the release version of a file" # 0.3.615
135 | echo -e "\twith the remote Git repository release version" # 0.3.615
136 | echo -e "\t(${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md${NORMAL})\n" # 0.3.615
137 | echo " ${BOLD}markit${NORMAL} Mark tracked modified file(s), in your local" # 0.3.615
138 | echo -e "\tGit repository and push those changes to a remote Git repository" # 0.3.615
139 | echo -e "\t(${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md${NORMAL})" # 0.3.615
140 |
141 | echo -e "\n${BOLD}AUTHOR${NORMAL}"
142 | echo " ${COMMAND_NAME} was written by Bradley Allen "
143 |
144 | echo -e "\n${BOLD}REPORTING BUGS${NORMAL}" # 0.3.595
145 | echo " Report ${COMMAND_NAME} bugs ${UNDERLINE}https://github.com/BradleyA/markit/issues/new/choose${NORMAL}" # 0.3.595
146 |
147 | ### Production standard 5.3.559 Copyright
148 | echo -e "\n${BOLD}COPYRIGHT${NORMAL}"
149 | echo " Copyright (c) 2020 Bradley Allen"
150 | echo " MIT License is online in the repository as a file named LICENSE"
151 | }
152 |
153 | # Date and time function ISO 8601
154 | get_date_stamp() {
155 | DATE_STAMP=$(date +%Y-%m-%dT%H:%M:%S.%6N%:z)
156 | TEMP=$(date +%Z)
157 | DATE_STAMP="${DATE_STAMP} (${TEMP})"
158 | }
159 |
160 | # Fully qualified domain name FQDN hostname
161 | LOCALHOST=$(hostname -f)
162 |
163 | # Version
164 | # Assumptions for the next two lines of code: The second line in this script includes the script path & name as the second item and
165 | # the script version as the third item separated with space(s). The tool I use is called 'markit'. See example line below:
166 | # template/template.sh 3.517.783 2019-09-13T18:20:42.144356-05:00 (CDT) https://github.com/BradleyA/user-files.git uadmin one-rpi3b.cptx86.com 3.516
167 | SCRIPT_NAME=$(head -2 "${0}" | awk '{printf $2}') # Different from ${COMMAND_NAME}=$(echo "${0}" | sed 's/^.*\///'), SCRIPT_NAME = includes Git repository directory and can be used any where in script (for dev, test teams)
168 | SCRIPT_VERSION=$(head -2 "${0}" | awk '{printf $3}')
169 | if [[ "${SCRIPT_NAME}" == "" ]] ; then SCRIPT_NAME="${0}" ; fi
170 | if [[ "${SCRIPT_VERSION}" == "" ]] ; then SCRIPT_VERSION="v?.?" ; fi
171 |
172 | # GID
173 | GROUP_ID=$(id -g)
174 |
175 | ### Production standard 2.3.614 Log format (WHEN WHERE WHAT Version Line WHO UID:GID [TYPE] Message)
176 | new_message() { # $1="${LINENO}" $2="DEBUG INFO ERROR WARN" $3="message"
177 | get_date_stamp
178 | echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${BOLD}${CYAN}${SCRIPT_NAME}${NORMAL}[$$] ${BOLD}${BLUE}${SCRIPT_VERSION} ${PURPLE}${1}${NORMAL} ${USER} ${UID}:${GROUP_ID} ${BOLD}[${2}]${NORMAL} ${3}" # 2.3.614
179 | }
180 |
181 | # INFO
182 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}INFO${WHITE}" "${BOLD}${CYAN} Started...${NORMAL}" 1>&2 ; fi # 1.3.614
183 |
184 | # Added following code because USER is not defined in crobtab jobs
185 | if ! [[ "${USER}" == "${LOGNAME}" ]] ; then USER=${LOGNAME} ; fi
186 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "DEBUG" " Setting USER to support crobtab... USER >${YELLOW}${USER}${WHITE}< LOGNAME >${YELLOW}${LOGNAME}${WHITE}<" 1>&2 ; fi # 2.3.578
187 |
188 | # DEBUG # 1.3.614
189 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Name_of_command >${YELLOW}${SCRIPT_NAME}${WHITE}< Name_of_arg1 >${YELLOW}${1}${WHITE}< Name_of_arg2 >${YELLOW}${2}${WHITE}< Name_of_arg3 >${YELLOW}${3}${WHITE}< Version of bash ${YELLOW}${BASH_VERSION}${WHITE}" 1>&2 ; fi # 1.3.614
190 |
191 | ### Production standard 9.3.606 Parse CLI options and arguments
192 | while [[ "${#}" -gt 0 ]] ; do
193 | case "${1}" in
194 | --help|-help|help|-h|h|-\?) display_help | more ; exit 0 ;;
195 | --usage|-usage|usage|-u) display_usage ; exit 0 ;;
196 | --version|-version|version|-v) echo "${SCRIPT_NAME} ${SCRIPT_VERSION}" ; exit 0 ;;
197 | -c|--cluster) if [[ "${2}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; CLUSTER=${2} ; shift 2 ;; # 9.3.596
198 | -c=*|--cluster=*) CLUSTER="${1#*=}" ; if [[ "${CLUSTER}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; shift ;; # 9.3.596
199 | -d|--datadir) if [[ "${2}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; DATA_DIR=${2} ; shift 2 ;; # 9.3.596
200 | -d=*|--datadir=*) DATA_DIR="${1#*=}" ; if [[ "${DATA_DIR}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; shift ;; # 9.3.596
201 | -s|--systems) if [[ "${2}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; SYSTEMS_FILE=${2} ; shift 2 ;; # 9.3.596
202 | -s=*|--systems=*) SYSTEMS_FILE="${1#*=}" ; if [[ "${SYSTEMS_FILE}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; shift ;; # 9.3.596
203 | *) echo -e "\n${BOLD} Invalid option, ${YELLOW}${1}${WHITE}, try ${YELLOW}--usage${NORMAL}\n" ; exit 1 ; ;; # 9.3.606
204 | esac
205 | done
206 |
207 | ###
208 |
209 | ### Production standard 7.3.602 Default variable value
210 | # Order of precedence: CLI argument, environment variable, default code
211 | if [[ "${CLUSTER}" == "" ]] ; then CLUSTER="${DEFAULT_CLUSTER}" ; fi
212 | if [[ "${DATA_DIR}" == "" ]] ; then DATA_DIR="${DEFAULT_DATA_DIR}" ; fi
213 | if [[ "${SYSTEMS_FILE}" == "" ]] ; then SYSTEMS_FILE="${DEFAULT_SYSTEMS_FILE}" ; fi
214 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " CLUSTER >${BOLD}${CYAN}${CLUSTER}${NORMAL}< DATA_DIR >${BOLD}${CYAN}${DATA_DIR}${NORMAL}< SYSTEMS_FILE >${BOLD}${CYAN}${SYSTEMS_FILE}${NORMAL}< PATH >${BOLD}${CYAN}${PATH}${NORMAL}<" 1>&2 ; fi
215 | #
216 | # Check if ${DATA_DIR} directory is on system
217 | if ! [[ -d "${DATA_DIR}" ]] ; then
218 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " Path to cluster data directory, ${DATA_DIR}, not found." 1>&2
219 | exit 1
220 | fi
221 | #
222 | # Check if ${CLUSTER} directory is on system
223 | if ! [[ -d "${DATA_DIR}"/"${CLUSTER}" ]] ; then
224 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " Cluster directory name, ${CLUSTER}, not found." 1>&2
225 | exit 1
226 | fi
227 | #
228 | # Check if ${SYSTEMS_FILE} file contains /
229 | if [[ "${SYSTEMS_FILE}" == *"/"* ]] ; then
230 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " SYSTEMS filename, ${SYSTEMS_FILE}, includes a '/'." 1>&2
231 | exit 1
232 | fi
233 | #
234 | # Check if ${SYSTEMS_FILE} file is on system, one FQDN or IP address per line for all hosts in cluster
235 | if ! [[ -e "${DATA_DIR}"/"${CLUSTER}"/"${SYSTEMS_FILE}" ]] || ! [[ -s "${DATA_DIR}"/"${CLUSTER}"/"${SYSTEMS_FILE}" ]] ; then
236 | new_message "${LINENO}" "${YELLOW}WARN${WHITE}" " Name of systems file, ${SYSTEMS_FILE} not found or empty. Creating ${SYSTEMS_FILE} file and including local host. Edit ${DATA_DIR}/${CLUSTER}/${SYSTEMS_FILE} file and add additional hosts that are in the cluster." 1>&2
237 | echo -e "### List of hosts used by cluster-command.sh & create-message.sh" > "${DATA_DIR}/${CLUSTER}/${SYSTEMS_FILE}"
238 | echo -e "# One FQDN or IP address per line for all hosts in cluster" > "${DATA_DIR}/${CLUSTER}/${SYSTEMS_FILE}"
239 | echo -e "###" > "${DATA_DIR}/${CLUSTER}/${SYSTEMS_FILE}"
240 | echo "${LOCALHOST}" > "${DATA_DIR}/${CLUSTER}/${SYSTEMS_FILE}"
241 | fi
242 |
243 | # Loop through hosts in ${SYSTEMS_FILE} file
244 | REMOTE_COMMAND="find ~/.. 2>/dev/null -type d -name '.git' -print | sed 's/^.*\.\./ \~/' | sed 's/\/\.git//'"
245 | REMOTEHOST=$(grep -v "#" "${DATA_DIR}/${CLUSTER}/${SYSTEMS_FILE}")
246 | for NODE in ${REMOTEHOST} ; do
247 | echo -e "\n${BOLD} --> ${CYAN}${NODE}${NORMAL} ->${PURPLE}${REMOTE_COMMAND}${WHITE}<-"
248 | if [[ "${LOCALHOST}" != "${NODE}" ]] ; then
249 | ssh -t "${USER}"@"${NODE}" "echo -e '${BOLD}${YELLOW}\c' ; ${REMOTE_COMMAND} ; echo -e '${NORMAL}\c'"
250 | else
251 | eval "echo -e '${BOLD}${YELLOW}\c' ; ${REMOTE_COMMAND} ; echo -e '${NORMAL}\c'"
252 | fi
253 | done
254 |
255 | #
256 | new_message "${LINENO}" "${YELLOW}INFO${WHITE}" "${BOLD}${CYAN} Operation finished...${NORMAL}" 1>&2 # 1.3.614
257 | ###
258 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # markit
2 | [](https://github.com/BradleyA/markit/releases/tag/4.2.1)
3 | 
4 | [](https://github.com/BradleyA/markit/commits/)
5 | [](https://github.com/BradleyA/markit/commits/)
6 |
7 | [](https://github.com/BradleyA/markit/issues/new/choose)
8 | [](https://github.com/BradleyA/markit/issues?q=is%3Aopen+is%3Aissue)
9 | [](https://github.com/BradleyA/markit/issues?q=is%3Aclosed+is%3Aissue)
10 | 
11 | 
12 |
13 | [
](https://github.com/BradleyA/markit/blob/master/images/clone.table.md)
14 | [
](https://github.com/BradleyA/markit/blob/master/images/view.table.md)
15 | [](https://github.com/BradleyA/markit/)
16 | 
17 | [](LICENSE)
18 |
19 | ## Goal
20 | Answer one question over the phone by looking at the code; ***What version are you running?**
21 |
22 | #### If you like this repository, select in the upper-right corner, [](https://GitHub.com/BradleyA/markit/stargazers/), thank you.
23 |
24 | ## Table of content
25 |
26 |
27 | - [Description](#Description)
28 | - [Objectives](#Objectives)
29 | - [Quick Start Tutorials](#Quick-Start-Tutorials)
30 | - [Clone](#Clone)
31 | - [Install latest markit command](#Install-latest-markit-command)
32 | - [Usage: markit](#Usage-markit)
33 | - [Output: markit](#Output-markit)
34 | - [Usage: check-markit](#Usage-check-markit)
35 | - [Output: check-markit](#Output-check-markit)
36 | - [Usage: find-code.sh](#Usage-find-codesh)
37 | - [Output: find-code.sh](#Output-find-codesh)
38 | ----
39 | - [Contribute](#Contribute)
40 | - [Author](#Author)
41 | - [Tested OS](#Tested-OS)
42 | - [Design Principles](#Design-Principles)
43 | - [License](#License)
44 |
45 |
46 |
47 | ----
48 |
49 | ## Description
50 | Bash script that adds Git Verion Control information into files and git add, git commit, git pushes them to GitHub, Bitbucket, and/or GitLab. Most scripts in this repository support --help and --usage options.
51 |
52 | **Markit** is a bash script that is a wrapper around these Git commands; git add ${FILE_NAME}, git commit -m "${FILE_MESSAGE}", git tag -a ${RELEASE_VERSION}, and git push --follow-tags. It automates this Git commit process and adds two comment lines of metadata about file changes to all tracked modified files in your local Git repository. This metadata allows any person to answer the question; What version are you running?
53 |
54 | Markit supports [Semantic Versioning](https://semver.org/) (MAJOR.MINOR.PATCH) and alphanumeric versioning (1.2.5-beta.1). Markit will display the current version before prompting you to enter the next version. Markit includes the number of commits with the version in the file(s). I find this helpful when commiting several different changes while working on the same PATCH.
55 |
56 | If environment variable MARKITLOCAL is set to 1, markit automates this git commit process, but does not push to GitHub repository or Bitbucket repository or GitLab project. I find this helpful when working without network access to a remote Git repository. If using the bash shell, enter; 'export MARKITLOCAL=1' on the command line to set the MARKITLOCAL environment variable to '1'. Use the command, 'unset MARKITLOCAL' to remove the exported information from the MARKITLOCAL environment variable. You are on your own defining environment variables if you are using other shells.
57 |
58 | The two comment lines of metadata include:
59 |
60 | * file_name, version.commits, date, time, time zone, repository URL, Git branch, user, hostname, previous version
61 | * file name(s) updated and a one line breif description about changes made to the file(s)
62 |
63 | Markit currently supports files with these file extensions:
64 |
65 | c(c), C++(cc|cpp|c++|cxx), C header(h|H|hpp), C++ header(hxx|Hxx|HXX), Go(go), HTML(html|htm), Java(java|class|jar), JavaScript(js), Kotlin(kt|kts), Makefile(mk|MK), Pascal(p|pp|paa), Perl(pl|PL|psh), PHP(php|php3|php4|ph3|ph4), PowerShell(ps1|msh), Python(py), R(R), Ruby(rb), Rust(rs|rlib), Scala(scala|sc), Shell(sh|bash|csh|tcsh|ksh), Terraform(tf|tfstate), Text(txt), XML(xml), YAML(yml|yaml)
66 |
67 | Markit currently supports these files without file extensions: Dockerfile, Makefile. There will be a prompt to add comment character(s) for unknown file names when needed and a prompt to add a description about the changes.
68 |
69 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
70 |
71 | ## Objectives
72 |
73 |
74 | * Any person without knowledge of Git or GitHub or Bitbucket or GitLab or markit to be able to answer one question;
75 | **What version are you running?**
76 | * Supports [Semantic Versioning](https://semver.org/) (MAJOR.MINOR.PATCH) and alphanumeric versioning (v0.1.64-alpha)
77 | * Only update modified files by inserting two comment lines with metadata
78 | * Insert the lines of metadata after the first line in files
79 | * Support GitHub
80 | * Use git commit message as part of metadata
81 | * Use git tag as part of metadata
82 | * Include date and remote Git repository as part of metadata
83 | * Include path with filename in remote Git repository as part of metadata
84 | * Don't create any requirements for markit other than the version and those required by Git
85 | * Support several file extensions for comment character
86 | * Support Bitbucket and GitLab
87 | * Support Git local repository without network access (without 'git push')
88 | * Support push to multiple Git remote repositories at once (edit .git/config)
89 | * I use alias release-notes='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit' to help build release notes
90 |
91 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
92 |
93 |
94 |
95 | ## Quick Start Tutorials
96 |
97 | 1) First make a copy of or fork this GitHub repository so you can modify the test files while learning how simple it is to work with markit.
98 |
99 | * To fork a GitHub repository you need to be logged into your GitHub account.
100 |
101 | * Go to repository **https://github.com/BradleyA/markit**
102 |
103 | * Click the fork icon in the upper right
104 |
105 | 2) Second download or clone the forked copy of markit from your GitHub \/markit to your Linux system.
106 |
107 | * Enter the following command with the name of your repository,
108 |
109 | git clone https://github.com//markit.git
110 |
111 | * Change into the cloned directory on your Linux system.
112 |
113 | cd markit
114 |
115 | 3) Third make a change to the file, testfiles/sample.sh, then git tag, git commit, and git push the change to your local and remote GitHub repository.
116 |
117 | * Make any change to testfiles/sample.sh.
118 |
119 | vi testfiles/sample.sh
120 |
121 | * Run ./markit and enter the next version number when prompted and a brief description of the changes to testfiles/sample.sh. You will be prompted for your GitHub password when Git pushes testfiles/sample.sh to your remote GitHub repository.
122 |
123 | ./markit
124 |
125 | **That is it!**
126 |
127 | Check if your local version of testfiles/sample.sh is the same version that is on your remote Git repository.
128 |
129 | ./check-markit -f ./testfiles/sample.sh
130 |
131 | On GitHub go to your Forked markit repository settings page and check the box next to Issues. Then open the first GitHub issue on your forked markit Git repository, #1.
132 |
133 | Modify test file, testfiles/sample.sh, by adding a blank line to learn how markit works.
134 |
135 | vi testfiles/sample.sh
136 |
137 | #!/bin/bash
138 | # testfiles/sample.sh 3.197.368 2019-02-08T20:33:53.600661-06:00 (CST) https://github.com/BradleyA/markit uadmin six-rpi3b.cptx86.com 3.196-1-g46f4c0d
139 | # test markit for sample.sh
140 | #
141 | # ./sample.sh
142 | ###
143 |
144 | echo "Hello World"
145 |
146 | Run ./markit. Enter the next version number when prompted and this brief description '[testing markit issue changes close #1](https://help.github.com/articles/closing-issues-using-keywords/)'. You will be prompted for your GitHub password when git pushes testfiles/sample.sh to your remote forked markit Git repository.
147 |
148 | ./markit
149 |
150 | The file testfiles/sample.sh has been updated with metadata, git tag, git commit, git push, and the issue #1 on GitHub has been [closed](https://help.github.com/articles/closing-issues-using-keywords/).
151 |
152 | View ./markit help pages to learn more about how markit works with tracked and untracked files and without network access to remote Git repository.
153 |
154 | ./markit --help
155 |
156 | Continue testing with the other test files to help you integrate markit with your development solutions. Open a GitHub issue and then modify two test files. When running markit enter a message and include the GitHub issue number and GitHub will update the issue.
157 |
158 | #### If you like this repository, select in the upper-right corner, [](https://GitHub.com/BradleyA/markit/stargazers/), thank you.
159 |
160 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
161 |
162 | ## Clone
163 |
164 | To Install, change into a directory that you want to download the scripts. Use git to pull or clone these scripts into the directory. If you do not have Git installed then enter; "sudo apt-get install git" if using Debian/Ubuntu. Other Linux distribution install methods can be found here: https://git-scm.com/download/linux. On the GitHub page of this script use the "HTTPS clone URL" with the 'git clone' command.
165 |
166 | git clone https://github.com/BradleyA/markit
167 | cd markit
168 |
169 | Copy markit, check-markit, and find-code.sh to a directory that is included in your PATH (/usr/local/bin or ~/bin).
170 |
171 | cp -p {./markit,./check-markit,./find-code.sh} /usr/local/bin
172 |
173 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
174 |
175 | ## Install latest markit command
176 | To install the latest commit of markit, change to the directory you want to download the script to (cd /usr/local/bin) and enter the follow command.
177 |
178 | curl -L https://api.github.com/repos/BradleyA/markit/tarball | tar -xzf - --wildcards BradleyA-markit-*/markit ; mv BradleyA-markit-*/markit . ; rm -r BradleyA-markit-*
179 |
180 |
181 | To install the latest commit of check-markit, change markit to check-markit in the above command.
182 |
183 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
184 |
185 | ## Usage: markit
186 | Mark **tracked modified file(s)**, in your local Git repository and push those changes to a remote Git repository. This example shows markit pushing to three remote Git repositories; GitHub, GitLab, and Bitbucket. Enter **markit --help** to see how .git/config was edited to support three repositories.
187 |
188 | markit
189 |
190 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
191 |
192 | ## Output: markit
193 |
194 |
195 | Note: The above markit output includes the output from git-TEST-commit-automation solution.
196 |
197 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
198 |
199 | ## Usage: check-markit
200 | Check the release version of a file with the remote Git repository release version. The **check-markit** script allows you to check if there is a newer release version of a file. The following example uses the file 'markit', but can be used with any file that was marked with markit.
201 |
202 | check-markit markit
203 |
204 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
205 |
206 | ## Output: check-markit
207 |
208 |
209 |
210 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
211 |
212 | ## Usage: find-code.sh
213 | Search each system found in // file for .git repositories in ~/.. directories.
214 |
215 | find-code.sh
216 |
217 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
218 |
219 | ## Output: find-code.sh
220 | 2020-10-19T08:52:23.693833-05:00 (CDT) six-rpi3b.cptx86.com find-code.sh[8972] 4.1.10.856 169 uadmin 10000:10000 [INFO] Started...
221 |
222 | --> five-rpi3b.cptx86.com ->find ~/.. 2>/dev/null -type d -name '.git' -print | sed 's/^.*\.\./ \~/' | sed 's/\/\.git//'<-
223 | # ##### All connections monitored ##### #
224 | ~/uadmin/github/BradleyA/Linux-admin
225 | ~/uadmin/github/BradleyA/docker-security-infrastructure
226 | ~/uadmin/github/BradleyA/git-TEST-commit-automation
227 | ~/uadmin/github/BradleyA/pi-display
228 | ~/uadmin/github/BradleyA/markit
229 | ~/uadmin/github/BradleyA/git-TEST-commit
230 | ~/uadmin/github/BradleyA/Search-docker-registry-v2-script
231 | ~/uadmin/github/BradleyA/user-files
232 | ~/uadmin/github/animated-GIF/ttygif
233 | ~/uadmin/github/animated-GIF/ttyrec
234 | ~/uadmin/github/animated-GIF/gifsicle
235 | ~/uadmin/github/animated-GIF/giflossy
236 | ~/uadmin/temp/temp/docker-security-infrastructure
237 | Connection to five-rpi3b.cptx86.com closed.
238 |
239 | --> six-rpi3b.cptx86.com ->find ~/.. 2>/dev/null -type d -name '.git' -print | sed 's/^.*\.\./ \~/' | sed 's/\/\.git//'<-
240 | ~/uadmin/github/animated-GIF/ttygif
241 | ~/uadmin/github/animated-GIF/ttyrec
242 | ~/uadmin/github/animated-GIF/gifsicle
243 | ~/uadmin/github/animated-GIF/giflossy
244 | ~/uadmin/github/franiglesias/versiontag
245 | ~/bob/github/BradleyA/pi-display
246 | 2020-10-19T08:52:24.919012-05:00 (CDT) six-rpi3b.cptx86.com find-code.sh[8972] 4.1.10.856 230 uadmin 10000:10000 [INFO] Operation finished...
247 |
248 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
249 |
250 | ----
251 |
252 | #### Contribute
253 | Please do contribute! Issues, comments, and pull requests are welcome. Thank you for your help improving software.
254 |
255 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
256 |
257 | #### Author
258 | [
](https://github.com/BradleyA/) [
](https://www.linkedin.com/in/bradleyhallen) [](https://twitter.com/bradleyaustintx/)
[](https://github.com/BradleyA?tab=followers)
259 |
260 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
261 |
262 | #### Stars
263 | [](https://github.com/BradleyA/markit/stargazers)
264 |
265 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
266 |
267 | #### Forks
268 | [](https://github.com/BradleyA/markit/network/members)
269 |
270 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
271 |
272 | #### Tested OS
273 | * Ubuntu 14.04.6 LTS (amd64,armv7l)
274 | * Ubuntu 16.04.7 LTS (amd64,armv7l)
275 | * Ubuntu 18.04.5 LTS (amd64,armv7l)
276 | * Raspbian GNU/Linux 10 (buster)
277 |
278 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
279 |
280 | #### Design Principles
281 | * Have a simple setup process and a minimal learning curve
282 | * Be usable as non-root
283 | * Be easy to install and configure
284 |
285 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
286 |
287 | #### License
288 | MIT License
289 |
290 | Copyright (c) 2020 [Bradley Allen](https://www.linkedin.com/in/bradleyhallen)
291 |
292 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
293 |
294 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
295 |
296 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
297 |
298 | [Return to top](https://github.com/BradleyA/markit/blob/master/README.md#markit)
299 |
--------------------------------------------------------------------------------
/check-markit:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # check-markit 4.2.1.1114 2020-12-22T21:01:38.222906-06:00 (CST) https://github.com/BradleyA/markit.git master uadmin three-rpi3b.cptx86.com 4.1.146-24-g68844ef
3 | # check-markit find-code.sh markit --> release ready for production
4 | #86# check-markit - check file release with repository release
5 | ### Production standard 5.3.559 Copyright # 3.559
6 | # Copyright (c) 2020 Bradley Allen # 3.555
7 | # MIT License is online in the repository as a file named LICENSE" # 3.559
8 | ### Production standard 3.0 shellcheck
9 | ### Production standard 1.3.614 DEBUG variable
10 | # Order of precedence: environment variable, default code
11 | if [[ "${DEBUG}" == "" ]] ; then DEBUG="0" ; fi # 0 = debug off, 1 = debug on, 'export DEBUG=1', 'unset DEBUG' to unset environment variable (bash)
12 | if [[ "${DEBUG}" == "2" ]] ; then set -x ; fi # Print trace of simple commands before they are executed
13 | if [[ "${DEBUG}" == "3" ]] ; then set -v ; fi # Print shell input lines as they are read
14 | if [[ "${DEBUG}" == "4" ]] ; then set -e ; fi # Exit immediately if non-zero exit status
15 | if [[ "${DEBUG}" == "5" ]] ; then set -e -o pipefail ; fi # Exit immediately if non-zero exit status and exit if any command in a pipeline errors
16 | #
17 | BOLD=$(tput -Txterm bold)
18 | UNDERLINE=$(tput -Txterm sgr 0 1) # 0.3.583
19 | NORMAL=$(tput -Txterm sgr0)
20 | RED=$(tput setaf 1)
21 | YELLOW=$(tput setaf 3)
22 | BLUE=$(tput setaf 4)
23 | PURPLE=$(tput setaf 5)
24 | CYAN=$(tput setaf 6)
25 | WHITE=$(tput setaf 7)
26 |
27 | ### Production standard 7.0 Default variable value
28 | FILE_NAME=""
29 | MARKIT_FILE=""
30 | TMP_MARKIT_DIR=$(mktemp --directory /tmp/TMP_MARKIT_DIRXXXXXX) # Create a temporary directory
31 |
32 | ### Production standard 8.3.541 --usage
33 | COMMAND_NAME=$(echo "${0}" | sed 's/^.*\///') # 3.541
34 | display_usage() {
35 | echo -e "\n${NORMAL}${COMMAND_NAME}\n check file release with repository release"
36 | echo -e "\n${BOLD}USAGE${NORMAL}"
37 | echo " ${COMMAND_NAME} "
38 | echo -e " ${COMMAND_NAME} [--filename / | -f /]\n"
39 | echo " ${COMMAND_NAME} [--help | -help | help | -h | h | -?]"
40 | echo " ${COMMAND_NAME} [--usage | -usage | -u]"
41 | echo " ${COMMAND_NAME} [--version | -version | -v]"
42 | }
43 |
44 | ### Production standard 0.3.615 --help
45 | display_help() {
46 | display_usage
47 | # Displaying help DESCRIPTION in English en_US.UTF-8, en.UTF-8, C.UTF-8 # 3.550
48 | echo -e "\n${BOLD}DESCRIPTION${NORMAL}"
49 | echo "Check the release of a file that was marked using markit with the GitHub"
50 | echo "repository or Bitbucket repository or GitLab project release. Check-markit may"
51 | echo "require --filename option to include the relative or absolute path with the"
52 | echo "file name."
53 | echo -e "\nCheck-markit only works on files that are marked after 2018-02-27."
54 | echo -e "\nCheck-markit only works with markit files that used the https:// URLs for"
55 | echo "GitHub, Bitbucket, and GitLab repositories. Check-markit does not currently"
56 | echo "support files with SSH URLs for GitHub, Bitbucket, and GitLab repositories."
57 |
58 | ### Production standard 4.3.587 Documentation Language # 3.550
59 | # Displaying help DESCRIPTION in French fr_CA.UTF-8, fr_FR.UTF-8, fr_CH.UTF-8
60 | if [[ "${LANG}" == "fr_CA.UTF-8" ]] || [[ "${LANG}" == "fr_FR.UTF-8" ]] || [[ "${LANG}" == "fr_CH.UTF-8" ]] ; then
61 | echo -e "\n--> ${LANG}"
62 | echo "" # Your help goes here
63 | echo "Souhaitez-vous traduire la section description?" # Would you like to translate the description section?
64 | elif ! [[ "${LANG}" == "en_US.UTF-8" || "${LANG}" == "en.UTF-8" || "${LANG}" == "C.UTF-8" ]] ; then # 3.550
65 | new_message "${LINENO}" "${YELLOW}INFO${WHITE}" " Your language, ${LANG}, is not supported. Would you like to translate the description section?" 1>&2
66 | fi
67 |
68 | echo -e "\n${BOLD}ENVIRONMENT VARIABLES${NORMAL}"
69 | echo "If using the bash shell, enter; 'export DEBUG=1' on the command line to set"
70 | echo "the environment variable DEBUG to '1' (0 = debug off, 1 = debug on). Use the"
71 | echo "command, 'unset DEBUG' to remove the exported information from the environment"
72 | echo "variable DEBUG. You are on your own defining environment variables if"
73 | echo "you are using other shells."
74 |
75 | ### Production standard 1.3.614 DEBUG variable
76 | echo " DEBUG (default off '0') The DEBUG environment variable can be set" # 3.550
77 | echo " to 0, 1, 2, 3, 4 or 5. The setting '' or 0 will turn off" # 3.550
78 | echo " all DEBUG messages during execution of this script. The" # 3.550
79 | echo " setting 1 will print all DEBUG messages during execution." # 3.550
80 | echo " Setting 2 (set -x) will print a trace of simple commands" # 3.550
81 | echo " before they are executed. Setting 3 (set -v) will print" # 3.550
82 | echo " shell input lines as they are read. Setting 4 (set -e) will" # 3.550
83 | echo " exit immediately if non-zero exit status is recieved with" # 3.550
84 | echo " some exceptions. Setting 5 (set -e -o pipefail) will do" # 3.550
85 | echo " setting 4 and exit if any command in a pipeline errors. For" # 3.550
86 | echo " more information about the set options, see man bash." # 3.550
87 |
88 | echo -e "\n${BOLD}OPTIONS${NORMAL}"
89 | echo -e "Order of precedence: CLI options, environment variable, default value.\n" # 0.3.595
90 | echo " --help, -help, help, -h, h, -?" # 0.3.595
91 | echo -e "\tOn-line brief reference manual\n" # 0.3.595
92 | echo " --usage, -usage, -u" # 0.3.595
93 | echo -e "\tOn-line command usage\n" # 0.3.595
94 | echo " --version, -version, -v" # 0.3.595
95 | echo -e "\tOn-line command version\n" # 0.3.595
96 | #
97 | echo " --filename /, -f"
98 | echo -e "\tInclude the relative or absolute path with the file name"
99 |
100 | echo -e "\n${BOLD}DOCUMENTATION${NORMAL}"
101 | echo " ${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md${NORMAL}" # 0.3.583
102 |
103 | echo -e "\n${BOLD}EXAMPLES${NORMAL}"
104 | echo -e " Check file named sample.c release in relative path testfile/ with\n repository release." # 0.3.550
105 | echo -e "\t${BOLD}${COMMAND_NAME} -f testfiles/sample.c${NORMAL}\n" # 0.3.550
106 | echo " Check file named markit release with repository release." # 0.3.550
107 | echo -e "\t${BOLD}${COMMAND_NAME} markit${NORMAL}" # 0.3.550
108 |
109 | echo -e "\n${BOLD}SEE ALSO${NORMAL}" # 0.3.615
110 | echo " ${BOLD}markit${NORMAL} Mark tracked modified file(s), in your local" # 0.3.615
111 | echo -e "\tGit repository and push those changes to a remote Git repository" # 0.3.615
112 | echo -e "\t(${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md${NORMAL})\n" # 0.3.615
113 | echo " ${BOLD}find-code.sh${NORMAL} Search each system found in" # 0.3.615
114 | echo -e "\t/ file for .git repositories in ~/.. directories" # 0.3.615
115 | echo -e "\t(${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md#usage-find-codesh${NORMAL})\n" # 0.3.615
116 |
117 | echo -e "\n${BOLD}AUTHOR${NORMAL}" # 3.550
118 | echo " ${COMMAND_NAME} was written by Bradley Allen " # 3.550
119 |
120 | echo -e "\n${BOLD}REPORTING BUGS${NORMAL}" # 3.550
121 | echo " Report ${COMMAND_NAME} bugs ${UNDERLINE}https://github.com/BradleyA/markit/issues/new/choose${NORMAL}" # 0.3.583
122 |
123 | ### Production standard 5.3.559 Copyright # 3.559
124 | echo -e "\n${BOLD}COPYRIGHT${NORMAL}" # 3.550
125 | echo " Copyright (c) 2020 Bradley Allen" # 3.550
126 | echo " MIT License is online in the repository as a file named LICENSE" # 3.559
127 | }
128 |
129 | # Date and time function ISO 8601
130 | get_date_stamp() {
131 | DATE_STAMP=$(date +%Y-%m-%dT%H:%M:%S.%6N%:z)
132 | TEMP=$(date +%Z)
133 | DATE_STAMP="${DATE_STAMP} (${TEMP})"
134 | }
135 |
136 | # Fully qualified domain name FQDN hostname
137 | LOCALHOST=$(hostname -f)
138 |
139 | # Version
140 | # Assumptions for the next two lines of code: The second line in this script includes the script path & name as the second item and
141 | # the script version as the third item separated with space(s). The tool I use is called 'markit'. See example line below:
142 | # template/template.sh 3.517.783 2019-09-13T18:20:42.144356-05:00 (CDT) https://github.com/BradleyA/user-files.git uadmin one-rpi3b.cptx86.com 3.516
143 | SCRIPT_NAME=$(head -2 "${0}" | awk '{printf $2}') # Different from ${COMMAND_NAME}=$(echo "${0}" | sed 's/^.*\///'), SCRIPT_NAME = includes Git repository directory and can be used any where in script (for dev, test teams)
144 | SCRIPT_VERSION=$(head -2 "${0}" | awk '{printf $3}')
145 | if [[ "${SCRIPT_NAME}" == "" ]] ; then SCRIPT_NAME="${0}" ; fi
146 | if [[ "${SCRIPT_VERSION}" == "" ]] ; then SCRIPT_VERSION="v?.?" ; fi
147 |
148 | # GID
149 | GROUP_ID=$(id -g)
150 |
151 | ### Production standard 2.3.614 Log format (WHEN WHERE WHAT Version Line WHO UID:GID [TYPE] Message)
152 | new_message() { # $1="${LINENO}" $2="DEBUG INFO ERROR WARN" $3="message"
153 | get_date_stamp
154 | echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${BOLD}${CYAN}${SCRIPT_NAME}${NORMAL}[$$] ${BOLD}${BLUE}${SCRIPT_VERSION} ${PURPLE}${1}${NORMAL} ${USER} ${UID}:${GROUP_ID} ${BOLD}[${2}]${NORMAL} ${3}" # 2.3.614
155 | }
156 |
157 | # INFO
158 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}INFO${WHITE}" "${BOLD}${CYAN} Started...${NORMAL}" 1>&2 ; fi # 1.3.614
159 |
160 | # Added following code because USER is not defined in crobtab jobs
161 | if ! [[ "${USER}" == "${LOGNAME}" ]] ; then USER=${LOGNAME} ; fi
162 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Setting USER to support crobtab... USER >${YELLOW}${USER}${WHITE}< LOGNAME >${YELLOW}${LOGNAME}${WHITE}<" 1>&2 ; fi # 1.3.614
163 |
164 | # DEBUG # 1.3.614
165 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Name_of_command >${YELLOW}${SCRIPT_NAME}${WHITE}< Name_of_arg1 >${YELLOW}${1}${WHITE}< Name_of_arg2 >${YELLOW}${2}${WHITE}< Name_of_arg3 >${YELLOW}${3}${WHITE}< Version of bash ${YELLOW}${BASH_VERSION}${WHITE}" 1>&2 ; fi # 1.3.614
166 |
167 | ### Production standard 9.3.606 Parse CLI options and arguments
168 | while [[ "${#}" -gt 0 ]] ; do
169 | case "${1}" in
170 | --help|-help|help|-h|h|-\?) display_help | more ; exit 0 ;;
171 | --usage|-usage|usage|-u) display_usage ; exit 0 ;;
172 | --version|-version|version|-v) echo "${SCRIPT_NAME} ${SCRIPT_VERSION}" ; exit 0 ;;
173 | #
174 | -f|--filename) if [[ "${2}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; MARKIT_FILE=${2} ; shift 2 ;; # 9.3.605
175 | -f=*|--filename=*) MARKIT_FILE="${1#*=}" ; if [[ "${MARKIT_FILE}" == "" ]] ; then echo -e "\n${BOLD} Argument for ${YELLOW}${1}${WHITE} is not found on command line.${NORMAL}\n" ; exit 1 ; fi ; shift ;; # 9.3.605
176 | # *) echo -e "\n${BOLD} Invalid option, ${YELLOW}${1}${WHITE}, try ${YELLOW}--usage${NORMAL}\n" ; exit 1 ; ;; # 9.3.606
177 | *) break ;; # 9.3.607
178 | esac
179 | done
180 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Variable... MARKIT_FILE >${BOLD}${CYAN}${MARKIT_FILE}${NORMAL}<" 1>&2 ; fi # 1.3.614
181 |
182 | ###
183 |
184 | ### Check if argument 1 is blank
185 | if [[ "${1}" == "" ]] && [[ "${MARKIT_FILE}" == "" ]] ; then
186 | display_usage
187 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " File not found on command line" 1>&2
188 | exit 1
189 | fi
190 |
191 | # Check if argument 1 is found on system
192 | if [[ "${MARKIT_FILE}" == "" ]] ; then
193 | # check if first character is a '-'
194 | if [[ "${1:0:1}" == "-" ]] ; then echo -e "\n${BOLD} Invalid option, ${YELLOW}${1}${WHITE}, try ${YELLOW}--usage${NORMAL}\n" ; exit 1 ; fi
195 | # Locate file in the PATH
196 | TEMP=$(whereis "${1}")
197 | MARKIT_FILE=$(echo "${TEMP}" | awk '{print $2}' )
198 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Locate file in the PATH... MARKIT_FILE >${BOLD}${CYAN}${MARKIT_FILE}${NORMAL}<" 1>&2 ; fi # 1.3.614
199 | # Check if MARKIT_FILE is blank, not found on system
200 | if [[ "${MARKIT_FILE}" == "" ]] ; then
201 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " ${1} not found; use --file / or -f / option" 1>&2
202 | display_usage
203 | exit 1
204 | fi
205 | fi
206 |
207 | # Parse file FILE_NAME from MARKIT_FILE
208 | FILE_NAME=$(echo "${MARKIT_FILE}" | sed 's/.*\///')
209 | # Check if file exists and has a size greater than zero || if file exists and is readable
210 | if [[ ! -s "${MARKIT_FILE}" ]] || [[ ! -r "${MARKIT_FILE}" ]] ; then
211 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " ${MARKIT_FILE} file is not found or is empty or is not readable" 1>&2
212 | exit 1
213 | fi
214 | REPOSITORY_COMMAND=$(grep git "${MARKIT_FILE}" | grep -m 1 "${FILE_NAME}" | awk '{print $6}' | sed 's/\.git$//')
215 | MARKIT_FILE_RELEASE=$(grep git "${MARKIT_FILE}" | grep -m 1 "${FILE_NAME}" | awk '{print $3}')
216 | MARKIT_FILE_DATE=$(grep git "${MARKIT_FILE}" | grep -m 1 "${FILE_NAME}" | awk '{print $4}')
217 | #
218 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " MARKIT_FILE >${BOLD}${CYAN}${MARKIT_FILE}${NORMAL}< FILE_NAME >${BOLD}${CYAN}${FILE_NAME}${NORMAL}< REPOSITORY_COMMAND >${BOLD}${CYAN}${REPOSITORY_COMMAND}${NORMAL}< MARKIT_FILE_RELEASE >${BOLD}${CYAN}${MARKIT_FILE_RELEASE}${NORMAL}<" 1>&2 ; fi # 1.3.614
219 |
220 | # Check file to determine if it was marked before markit release 3.10.142 2018-02-27.
221 | if ! grep -q "https" <<< ${REPOSITORY_COMMAND} ; then
222 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " ${MARKIT_FILE} is not marked with markit or the --file option was not used or git origin did not include https address (git remote -v) when marked or file was marked after 2018-02-27." 1>&2
223 | exit 1
224 | fi
225 |
226 | ### >>>
227 | # need to make sure that script is able to contact GitHib or Bitbucket or GitLab before using curl
228 | # add a test
229 | ### >>>
230 | ### Determine name of repository
231 | if grep -q "github" <<< ${REPOSITORY_COMMAND} ; then
232 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Checking GitHub for ${BOLD}${CYAN}${FILE_NAME}${NORMAL} repository release information" 1>&2 ; fi # 1.3.614
233 | REPOSITORY_COMMAND=$(echo "${REPOSITORY_COMMAND}" | sed 's/github.com/api.github.com\/repos/')
234 | REPOSITORY_COMMAND="curl \-L ${REPOSITORY_COMMAND}/tarball | tar --directory ${TMP_MARKIT_DIR} -xzf - "
235 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " REPOSITORY_COMMAND >${BOLD}${CYAN}${REPOSITORY_COMMAND}${NORMAL}<" 1>&2 ; fi # 1.3.614
236 | elif grep -q "gitlab" <<< ${REPOSITORY_COMMAND} ; then
237 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Checking GitLab for ${BOLD}${FILE_NAME}${NORMAL} repository release information" 1>&2 ; fi # 1.3.614
238 | REPOSITORY_PROJECT_NAME=$(echo "${REPOSITORY_COMMAND}" | sed 's/^https:\/\/.*\/.*\///' | sed 's/\.git$//')
239 | REPOSITORY_COMMAND=$(echo "${REPOSITORY_COMMAND}" | sed 's/\.git$/\/-\/archive\/master\//')
240 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " MARKIT_FILE >${BOLD}${CYAN}${MARKIT_FILE}${NORMAL}< FILE_NAME >${BOLD}${CYAN}${FILE_NAME}${NORMAL}< REPOSITORY_COMMAND >${BOLD}${CYAN}${REPOSITORY_COMMAND}${NORMAL}< MARKIT_FILE_RELEASE >${BOLD}${CYAN}${MARKIT_FILE_RELEASE}${NORMAL}<" 1>&2 ; fi # 1.3.614
241 | REPOSITORY_COMMAND="curl \-L ${REPOSITORY_COMMAND}${REPOSITORY_PROJECT_NAME}-master.tar.gz | tar --directory ${TMP_MARKIT_DIR} -xzf - "
242 | elif grep -q "bitbucket" <<< ${REPOSITORY_COMMAND} ; then
243 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Checking Bitbucket for ${BOLD}${FILE_NAME}${NORMAL} repository release information" 1>&2 ; fi # 1.3.614
244 | REPOSITORY_COMMAND=$(echo "${REPOSITORY_COMMAND}" | sed 's/\/\/.*@/\/\//')
245 | REPOSITORY_COMMAND=$(echo "curl \-L ${REPOSITORY_COMMAND}/get/master.zip -o ${TMP_MARKIT_DIR}/master.zip ; unzip -qq ${TMP_MARKIT_DIR}/master.zip -d ${TMP_MARKIT_DIR}/")
246 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " REPOSITORY_COMMAND >${BOLD}${CYAN}${REPOSITORY_COMMAND}${NORMAL}<" 1>&2 ; fi # 1.3.614
247 | else
248 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " MARKIT_FILE >${BOLD}${CYAN}${MARKIT_FILE}${NORMAL}< FILE_NAME >${BOLD}${CYAN}${FILE_NAME}${NORMAL}< REPOSITORY_COMMAND >${BOLD}${CYAN}${REPOSITORY_COMMAND}${NORMAL}< MARKIT_FILE_RELEASE >${BOLD}${CYAN}${MARKIT_FILE_RELEASE}${NORMAL}<" 1>&2 ; fi # 1.3.614
249 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " Repository using SSH URLs or other repository like bitbucket, Codebase, Assembla, Fog Creek Kiln, etc." 1>&2
250 | exit 1
251 | fi
252 | ###
253 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " MARKIT_FILE >${BOLD}${CYAN}${MARKIT_FILE}${NORMAL}< FILE_NAME >${BOLD}${CYAN}${FILE_NAME}${NORMAL}< REPOSITORY_COMMAND >${BOLD}${CYAN}${REPOSITORY_COMMAND}${NORMAL}< MARKIT_FILE_RELEASE >${BOLD}${CYAN}${MARKIT_FILE_RELEASE}${NORMAL}<" 1>&2 ; fi # 1.3.614
254 | #
255 | eval "${REPOSITORY_COMMAND}"
256 | REPOSITORY_FILE_NAME_LOCATION=$(find "${TMP_MARKIT_DIR}" -type f -name "${FILE_NAME}" -print)
257 | REPOSITORY_MARKIT_FILE_RELEASE=$(grep git "${REPOSITORY_FILE_NAME_LOCATION}" | grep -m 1 "${FILE_NAME}" | awk '{print $3}')
258 | REPOSITORY_MARKIT_FILE_DATE=$(grep git "${REPOSITORY_FILE_NAME_LOCATION}" | grep -m 1 "${FILE_NAME}" | awk '{print $4}')
259 | cp -f "${REPOSITORY_FILE_NAME_LOCATION}" /tmp/"${FILE_NAME}"
260 | rm -rf "${TMP_MARKIT_DIR}"
261 | ###
262 | echo -e "\n ${BOLD}${CYAN}${MARKIT_FILE}${NORMAL} release ${BOLD}${YELLOW}${MARKIT_FILE_RELEASE}${NORMAL}, commit date ${MARKIT_FILE_DATE}" 1>&2
263 | echo -e "\n ${BOLD}${CYAN}${FILE_NAME}${NORMAL} repository release ${BOLD}${YELLOW}${REPOSITORY_MARKIT_FILE_RELEASE}${NORMAL}, commit date ${REPOSITORY_MARKIT_FILE_DATE}\n" 1>&2
264 | echo "Repository copy placed in /tmp/${FILE_NAME}"
265 |
266 | #
267 | new_message "${LINENO}" "${YELLOW}INFO${WHITE}" "${BOLD}${CYAN} Operation finished...${NORMAL}" 1>&2 # 1.3.614
268 | ###
269 |
--------------------------------------------------------------------------------
/TEST/check-markit/FVT-setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # TEST/check-markit/FVT-setup.sh 4.1.114.1036 2020-11-12T21:18:36.702712-06:00 (CST) https://github.com/BradleyA/markit master uadmin five-rpi3b.cptx86.com 4.1.113
3 | # TEST/check-markit/FVT-setup.sh --> rm FVT-option-filename-009 FVT-option-filename-010 because FVT-option-invalid replaced them
4 | # TEST/check-markit/FVT-setup.sh 4.1.113.1035 2020-11-12T21:14:04.301049-06:00 (CST) https://github.com/BradleyA/markit master uadmin five-rpi3b.cptx86.com 4.1.112
5 | # TEST/check-markit/FVT-setup.sh --> add FVT-option-invalid-001
6 | # TEST/check-markit/FVT-setup.sh 4.1.98.1016 2020-10-30T22:48:23.925754-05:00 (CDT) https://github.com/BradleyA/markit master uadmin three-rpi3b.cptx86.com 4.1.97
7 | # TEST/check-markit/FVT-setup.sh --> added 2 additional test cases FVT-option-filename-009 FVT-option-filename-010
8 | # TEST/check-markit/FVT-setup.sh 4.1.96.1014 2020-10-30T22:35:05.238425-05:00 (CDT) https://github.com/BradleyA/markit master uadmin three-rpi3b.cptx86.com 4.1.95
9 | # TEST/check-markit/FVT-setup.sh --> added links for FVT-option-filename-00?.expected
10 | # TEST/check-markit/FVT-setup.sh 4.1.94.1012 2020-10-30T15:32:55.728345-05:00 (CDT) https://github.com/BradleyA/markit master uadmin five-rpi3b.cptx86.com 4.1.93
11 | # TEST/check-markit/FVT-setup.sh --> update to add FVT-option-filename
12 | #86# hooks/EXAMPLES/FVT-setup.sh - This test script is optional. It is for
13 | # 'Production standard 10.0 TESTing' test cases. Copy it to TEST//.
14 | # If FVT-setup.sh is found in TEST// post-commit executes it.
15 | # Functional Verification Testing (FVT) - verify that the program logic conforms
16 | # to design specification.
17 | ###
18 | ### Production standard 3.0 shellcheck
19 | ### Production standard 5.3.559 Copyright # 3.559
20 | # Copyright (c) 2020 Bradley Allen # 3.555
21 | # MIT License is online in the repository as a file named LICENSE" # 3.559
22 | ### Production standard 1.3.550 DEBUG variable # 3.550
23 | # Order of precedence: environment variable, default code
24 | if [[ "${DEBUG}" == "" ]] ; then DEBUG="0" ; fi # 0 = debug off, 1 = debug on, 'export DEBUG=1', 'unset DEBUG' to unset environment variable (bash)
25 | if [[ "${DEBUG}" == "2" ]] ; then set -x ; fi # Print trace of simple commands before they are executed
26 | if [[ "${DEBUG}" == "3" ]] ; then set -v ; fi # Print shell input lines as they are read
27 | if [[ "${DEBUG}" == "4" ]] ; then set -e ; fi # Exit immediately if non-zero exit status
28 | if [[ "${DEBUG}" == "5" ]] ; then set -e -o pipefail ; fi # Exit immediately if non-zero exit status and exit if any command in a pipeline errors
29 | #
30 | BOLD=$(tput -Txterm bold)
31 | UNDERLINE=$(tput -Txterm sgr 0 1) # 0.3.583
32 | NORMAL=$(tput -Txterm sgr0)
33 | RED=$(tput setaf 1)
34 | YELLOW=$(tput setaf 3)
35 | BLUE=$(tput setaf 4)
36 | PURPLE=$(tput setaf 5)
37 | WHITE=$(tput setaf 7)
38 |
39 | # Date and time function ISO 8601
40 | get_date_stamp() {
41 | DATE_STAMP=$(date +%Y-%m-%dT%H:%M:%S.%6N%:z)
42 | TEMP=$(date +%Z)
43 | DATE_STAMP="${DATE_STAMP} (${TEMP})"
44 | }
45 |
46 | # Fully qualified domain name FQDN hostname
47 | LOCALHOST=$(hostname -f)
48 |
49 | # Version
50 | # Assumptions for the next two lines of code: The second line in this script includes the script path & name as the second item and
51 | # the script version as the third item separated with space(s). The tool I use is called 'markit'. See example line below:
52 | # template/template.sh 3.517.783 2019-09-13T18:20:42.144356-05:00 (CDT) https://github.com/BradleyA/user-files.git uadmin one-rpi3b.cptx86.com 3.516
53 | SCRIPT_NAME=$(head -2 "${0}" | awk '{printf $2}') # Different from ${COMMAND_NAME}=$(echo "${0}" | sed 's/^.*\///'), SCRIPT_NAME = includes Git repository directory and can be used any where in script (for dev, test teams)
54 | SCRIPT_VERSION=$(head -2 "${0}" | awk '{printf $3}')
55 | if [[ "${SCRIPT_NAME}" == "" ]] ; then SCRIPT_NAME="${0}" ; fi
56 | if [[ "${SCRIPT_VERSION}" == "" ]] ; then SCRIPT_VERSION="v?.?" ; fi
57 |
58 | # GID
59 | GROUP_ID=$(id -g)
60 |
61 | ### Production standard 2.3.578 Log format (WHEN WHERE WHAT Version Line WHO UID:GID [TYPE] Message)
62 | new_message() { # $1="${LINENO}" $2="DEBUG INFO ERROR WARN" $3="message"
63 | get_date_stamp
64 | echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${SCRIPT_NAME}[$$] ${BOLD}${BLUE}${SCRIPT_VERSION} ${PURPLE}${1}${NORMAL} ${USER} ${UID}:${GROUP_ID} ${BOLD}[${2}]${NORMAL} ${3}"
65 | }
66 |
67 | # INFO
68 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}INFO${WHITE}" " Started..." 1>&2 ; fi
69 |
70 | # This script does not support -* or help or usage or version
71 | if [[ "${1}" == -* ]] || [[ "${1}" == "help" ]] || [[ "${1}" == "usage" ]] || [[ "${1}" == "version" ]] ; then
72 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " Option, ${YELLOW}${1}${WHITE}, is not supported with ${SCRIPT_NAME}." 1>&2
73 | # User Hint
74 | echo -e " For more information:\n${BOLD}${YELLOW} ${UNDERLINE}https://github.com/BradleyA/git-TEST-commit-automation/tree/master/hooks#git-test-commit-automation------${NORMAL}"
75 | exit 1
76 | fi
77 |
78 | ### Production standard 10.0 TESTing
79 |
80 | if [[ ! -z "${1}" ]] ; then # post-commit must pass REPOSITORY_DIR because post-commit is executed in .git/hooks/ which is not in the repository
81 | REPOSITORY_DIR=${1}
82 | else
83 | REPOSITORY_DIR=$(git rev-parse --show-toplevel) # not called by post-commit
84 | if [[ "${0}" != $(basename "${0}") ]] ; then # script must execute in TEST// directory
85 | cd "$(dirname "${0}")"
86 | fi
87 | fi
88 |
89 | # Uncomment shared TEST cases for TESTing
90 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-0-001" FVT-exit-code-error-0-001
91 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-1-001" FVT-exit-code-error-1-001
92 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-124-001" FVT-exit-code-error-124-001
93 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-124-002" FVT-exit-code-error-124-002
94 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-126-001" FVT-exit-code-error-126-001
95 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-127-001" FVT-exit-code-error-127-001
96 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-128-001" FVT-exit-code-error-128-001
97 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-130-001" FVT-exit-code-error-130-001
98 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-2-001" FVT-exit-code-error-2-001
99 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-add-001" FVT-option-add-001
100 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-001" FVT-option-all-001
101 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-002" FVT-option-all-002
102 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-001" FVT-option-all-hooks-001
103 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-001.expected" FVT-option-all-hooks-001.expected
104 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-002" FVT-option-all-hooks-002
105 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-002.expected" FVT-option-all-hooks-002.expected
106 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-001" FVT-option-clean-001
107 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-002" FVT-option-clean-002
108 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-001" FVT-option-clean-hooks-001
109 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-002" FVT-option-clean-hooks-002
110 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-003" FVT-option-clean-hooks-003
111 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-004" FVT-option-clean-hooks-004
112 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-001" FVT-option-cluster-001
113 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-001.expected" FVT-option-cluster-001.expected
114 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-002" FVT-option-cluster-002
115 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-002.expected" FVT-option-cluster-002.expected
116 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-003" FVT-option-cluster-003
117 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-003.expected" FVT-option-cluster-003.expected
118 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-004" FVT-option-cluster-004
119 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-004.expected" FVT-option-cluster-004.expected
120 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-005" FVT-option-cluster-005
121 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-005.expected" FVT-option-cluster-005.expected
122 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-006" FVT-option-cluster-006
123 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-006.expected" FVT-option-cluster-006.expected
124 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-007" FVT-option-cluster-007
125 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-007.expected" FVT-option-cluster-007.expected
126 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-008" FVT-option-cluster-008
127 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-008.expected" FVT-option-cluster-008.expected
128 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-001" FVT-option-datadir-001
129 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-001.expected" FVT-option-datadir-001.expected
130 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-002" FVT-option-datadir-002
131 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-002.expected" FVT-option-datadir-002.expected
132 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-003" FVT-option-datadir-003
133 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-003.expected" FVT-option-datadir-003.expected
134 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-004" FVT-option-datadir-004
135 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-004.expected" FVT-option-datadir-004.expected
136 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-005" FVT-option-datadir-005
137 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-005.expected" FVT-option-datadir-005.expected
138 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-006" FVT-option-datadir-006
139 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-006.expected" FVT-option-datadir-006.expected
140 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-007" FVT-option-datadir-007
141 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-007.expected" FVT-option-datadir-007.expected
142 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-008" FVT-option-datadir-008
143 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-008.expected" FVT-option-datadir-008.expected
144 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-001" FVT-option-systems-001
145 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-001.expected" FVT-option-systems-001.expected
146 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-002" FVT-option-systems-002
147 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-002.expected" FVT-option-systems-002.expected
148 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-003" FVT-option-systems-003
149 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-003.expected" FVT-option-systems-003.expected
150 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-004" FVT-option-systems-004
151 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-004.expected" FVT-option-systems-004.expected
152 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-005" FVT-option-systems-005
153 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-005.expected" FVT-option-systems-005.expected
154 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-006" FVT-option-systems-006
155 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-006.expected" FVT-option-systems-006.expected
156 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-007" FVT-option-systems-007
157 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-007.expected" FVT-option-systems-007.expected
158 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-008" FVT-option-systems-008
159 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-008.expected" FVT-option-systems-008.expected
160 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-001" FVT-option-filename-001
161 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-001.expected" FVT-option-filename-001.expected
162 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-002" FVT-option-filename-002
163 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-002.expected" FVT-option-filename-002.expected
164 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-003" FVT-option-filename-003
165 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-003.expected" FVT-option-filename-003.expected
166 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-004" FVT-option-filename-004
167 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-004.expected" FVT-option-filename-004.expected
168 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-005" FVT-option-filename-005
169 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-005.expected" FVT-option-filename-005.expected
170 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-006" FVT-option-filename-006
171 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-006.expected" FVT-option-filename-006.expected
172 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-007" FVT-option-filename-007
173 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-007.expected" FVT-option-filename-007.expected
174 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-008" FVT-option-filename-008
175 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-008.expected" FVT-option-filename-008.expected
176 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-001" FVT-option-filename-hooks-001
177 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-001.expected" FVT-option-filename-hooks-001.expected
178 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-002" FVT-option-filename-hooks-002
179 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-002.expected" FVT-option-filename-hooks-002.expected
180 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-003" FVT-option-filename-hooks-003
181 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-003.expected" FVT-option-filename-hooks-003.expected
182 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-004" FVT-option-filename-hooks-004
183 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-004.expected" FVT-option-filename-hooks-004.expected
184 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-005" FVT-option-filename-hooks-005
185 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-005.expected" FVT-option-filename-hooks-005.expected
186 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-006" FVT-option-filename-hooks-006
187 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-006.expected" FVT-option-filename-hooks-006.expected
188 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-007" FVT-option-filename-hooks-007
189 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-007.expected" FVT-option-filename-hooks-007.expected
190 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-008" FVT-option-filename-hooks-008
191 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-008.expected" FVT-option-filename-hooks-008.expected
192 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-009" FVT-option-filename-hooks-009
193 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-009.expected" FVT-option-filename-hooks-009.expected
194 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-010" FVT-option-filename-hooks-010
195 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-010.expected" FVT-option-filename-hooks-010.expected
196 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-011" FVT-option-filename-hooks-011
197 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-011.expected" FVT-option-filename-hooks-011.expected
198 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-012" FVT-option-filename-hooks-012
199 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-012.expected" FVT-option-filename-hooks-012.expected
200 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-001" FVT-option-help-001
201 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-002" FVT-option-help-002
202 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-003" FVT-option-help-003
203 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-004" FVT-option-help-004
204 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-005" FVT-option-help-005
205 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-006" FVT-option-help-006
206 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-001" FVT-option-invalid-001
207 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-001.expected" FVT-option-invalid-001.expected
208 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-002" FVT-option-invalid-002
209 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-002.expected" FVT-option-invalid-002.expected
210 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-001" FVT-option-none-001
211 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-002" FVT-option-none-002
212 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-001" FVT-option-none-hooks-001
213 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-001.expected" FVT-option-none-hooks-001.expected
214 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-002" FVT-option-none-hooks-002
215 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-002.expected" FVT-option-none-hooks-002.expected
216 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-003" FVT-option-none-hooks-003
217 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-003.expected" FVT-option-none-hooks-003.expected
218 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-004" FVT-option-none-hooks-004
219 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-004.expected" FVT-option-none-hooks-004.expected
220 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-001" FVT-option-usage-001
221 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-002" FVT-option-usage-002
222 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-003" FVT-option-usage-003
223 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-004" FVT-option-usage-004
224 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-001" FVT-option-version-001
225 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-002" FVT-option-version-002
226 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-003" FVT-option-version-003
227 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-004" FVT-option-version-004
228 |
229 | #
230 |
231 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "DEBUG" " Operation finished..." 1>&2 ; fi
232 | ###
233 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | **Notes:** Use the following example to guide you to; How to download an earlier release.
2 |
3 | git clone https://github.com/BradleyA/.git --branch 2.42
4 |
5 | ## Next Version Under Construction {Version 4.3.????}
6 | #### Release Name prerelease
7 | #### Release Date ????
8 | * Brief description
9 | * sub-repository
10 | * Brief description
11 |
12 | ### Features Added
13 | * Updated feature||file
14 | * Added the following test cases
15 | * hooks/bin/EXAMPLES/FVT-exit-code-error-0-001
16 | * sub-repository
17 | * directory/command git commit message
18 | * directory/command git commit message closes #XX
19 |
20 | ### Features Changes
21 | ### Features Deprecations
22 | ### Issues
23 | * close #X directory/command git commit message
24 | * sub-repository
25 | * close #XX directory/command git commit message
26 |
27 | ### Misc
28 | * backlog
29 |
30 | # Latest Release --> Version 4.2.1.1114
31 | #### Release Name 4.2.1
32 | #### Release Date 2020-12-22T21:02:03.686774-06:00 (CST)
33 | * Added test cases to be used with repository BradleyA/git-TEST-commit-automation
34 |
35 | ### Features Added
36 | * Updated .github/ISSUE_TEMPLATE/feature_request.md changed command example
37 | * Updated .github/ISSUE_TEMPLATE/incident_report.md changed command example
38 | * Updated .gitignore added hooks/ directory to .gitignore for git-TEST-commit-automation testing
39 | * Updated README.md
40 | * check-markit
41 | * Added unique temporary directory names to support automation, close #84
42 | * Added find-code.sh to check-markit SEE ALSO section
43 | * Check if file starts with '-', Invalid option
44 | * Change --file option to --filename option
45 | * Production standard 1.3.614 DEBUG variable
46 | * Production standard 2.3.614 Log format
47 | * Production standard 0.3.615 --help
48 | * Production standard 9.3.606 Parse CLI options and arguments
49 | * find-code.sh markit
50 | * Change output color to help review of output
51 | * Redesign -c, -d, -s option code
52 | * Production standard 1.3.614 DEBUG variable
53 | * Production standard 2.3.614 Log format
54 | * Production standard 0.3.615 --help
55 | * Production standard 9.3.606 Parse CLI options and arguments
56 | * Production standard 7.3.602 Default variable value
57 | * markit
58 | * Updated if statement syntax from this [] to this [[]]
59 | * Production standard 1.3.614 DEBUG variable
60 | * Production standard 2.3.614 Log format
61 | * Production standard 0.3.615 --help
62 | * Production standard 9.3.606 Parse CLI options and arguments
63 |
64 | ### Issues
65 | * close #84 define unique temporary directory names to support automation
66 | * close #88 look at adding default TEST cases and update README.md
67 |
68 | # Version 4.1.8.836
69 | #### Release Name 4.1.8
70 | #### Release Date 2020-10-03T15:36:36.764370-05:00 (CDT)
71 | * Added ISSUE_TEMPLATES, security policy - SECURITY.md, CHANGELOG.md, clone.table.md, view.table.md
72 | * Added file name(s) to beginning of git commit message, line 2, to help locate file(s) that changed
73 | * Added branch name to line 1, to help locate changes to file(s)
74 | * Added default BradleyA/git-TEST-commit-automation testcases
75 |
76 | ### Features Added
77 | * Added .github/ISSUE_TEMPLATE/feature_request.md
78 | * Added .github/ISSUE_TEMPLATE/incident-report.md
79 | * Added .github/ISSUE_TEMPLATE/comment.md
80 | * Added CHANGELOG.md
81 | * Added SECURITY.md - create repository SECURITY.md, closes #78
82 | * Added images/clone.table.md
83 | * Added images/construction-icon.gif
84 | * Added images/view.table.md
85 | * Updated README.md
86 | * Added default BradleyA/git-TEST-commit-automation testcases for testing during code development
87 | * markit
88 | * Added display_help about how to git push to more than one repository
89 | * Updated Production standards 5.3.559 Copyright, 2.3.578 Log format, 9.3.562 Parse CLI options and arguments, closes #76
90 | * Automate adding file name(s) to beginning of message, closes #75
91 | * Added test cases, closes #73
92 | * Testing changes to markit add branch to line 1, closes #69
93 | * Testing with branching, closes #68
94 | * Added repository and branch to display_help, closes #82
95 | * find-code.sh
96 | * Production standards: 5.3.550 Copyright, 0.3.550 --help, 4.3.550 Documentation Language, 1.3.550 DEBUG variable, closes #74
97 | * check-markit
98 | * Updated Production Standards 3.550, closes #72
99 | * Added test cases, closes #73
100 | * Correct display-usage
101 | * Upgraded Production standards, closes #79
102 |
103 | ### Issues
104 | * close #68 Testing with branching
105 | * close #69 Testing changes to markit add branch to line 1
106 | * close #71 Review: https://github.com/commitizen/cz-cli
107 | * close #72 Updated Production Standards 3.550
108 | * clone #73 Added test cases
109 | * close #74 Production standards: 5.3.550 Copyright, 0.3.550 --help, 4.3.550 Documentation Language, 1.3.550 DEBUG variable
110 | * close #75 Automate adding file name(s) to beginning of message
111 | * close #76 Updated Production standards 5.3.559 Copyright, 2.3.578 Log format, 9.3.562 Parse CLI options and arguments
112 | * close #78 Feature Request - SECURITY.md - create repository SECURITY.md
113 | * close #79 Upgraded Production standards
114 | * close #82 Added repository and branch to display_help
115 |
116 | # Version 3.213.519
117 | #### Release Name 3.213
118 | #### Release Date 2019-06-07T20:00:24.218494-05:00 (CDT)
119 | * Bug fix
120 |
121 | ### Features Added
122 | * markit
123 | * Remove quotes from [ERROR] about requiring a git pull first, closes #67
124 |
125 | ### Issues
126 | * close #67 Remove quotes from [ERROR] about requiring a git pull first
127 |
128 | # Version 3.212.517
129 | #### Release Name 3.212
130 | #### Release Date 2019-05-27T17:06:49.252530-05:00 (CDT)
131 | * check-markit - changed output to include date vers version
132 |
133 | ### Features Added
134 | * Updated README.md
135 | * check-markit
136 | * Changed output to include date vers version, closs #66
137 |
138 | ### Issues
139 | * close #66 Changed output to include date vers version
140 |
141 | # Version 3.210.512
142 | #### Release Name 3.210.512
143 | #### Release Date 2019-05-21T13:32:34.729227-05:00 (CDT)
144 | * Added file types for terraform
145 |
146 | ### Features Added
147 | * Updated README.md
148 | * markit
149 | * Added file types for terraform, closes #64
150 | * Test git push using markit to github, gitlab, and bitbucket, closes #63
151 | * From bitbucket includes github URL not Bitbucket URL on line 2, closes #62
152 | * Modified .git/config to push to github, gitlab, and bitbucket
153 | * Push-two-repository-test
154 | * Incident - retesting markit only works repositories that have been clone from a remote repository. something to do with master origin, closes #28
155 | * find-code.sh
156 | * failed to find any when in ~/kubernets, closes #45
157 |
158 | ### Issues
159 | * close #28 Incident - retesting markit only works repositories that have been clone from a remote repository. something to do with master origin
160 | * close #45 find-code.sh - failed to find any when in ~/kubernets
161 | * close #62 From bitbucket includes github URL not Bitbucket URL on line 2
162 | * close #63 Test git push using markit to github, gitlab, and bitbucket
163 | * close #64 Added file types for terraform
164 |
165 | # Version 3.197.368
166 | #### Release Name 3.197
167 | #### Release Date 2019-02-08T20:33:53.600661-06:00 (CST)
168 | * Markit adds two comment lines with information about file changes to all
169 | modified tracked file(s) in your local Git repository. Then pushes those
170 | modified file(s) to either a GitHub repository or Bitbucket repository or
171 | GitLab project. If environment variable MARKITLOCAL is set to 1, markit
172 | adds two comment lines, commits modified tracked file(s) in your local
173 | Git repository, but does not push to remote Git repository. I find this
174 | helpful when working without network access to a remote Git repository.
175 | * Added support for additional file types
176 | * Moved find-code.sh from user-work-files to markit
177 |
178 | ### Features Added
179 | * Updated LICENSE file
180 | * Updated README.md, closes #60
181 | * markit
182 | * Updated display_help
183 | * Added Environment Variables MARKITLOCAL to support markit on local system, closes #61
184 | * Updated user help message during failed git push
185 | * Updated user help message for untracked files
186 | * Tested with Makefile c ruby scala go
187 | * Added support for tcsh csh ksh etc, closes #59
188 | * Added presentation notes and slides
189 | * Updated production standard 5 include Copyright notice
190 | * Adapted to work with Bitbucket, closes #38
191 | * Updated production standard 4 update display_help LANGUAGE, closes #58
192 | * Added nano seconds to the 6 most significant digits
193 | * Order of precedence: add support for environment variable (export DEBUG=1), default code, closes #50
194 | * Changed log format and order, closes #49
195 | * shellcheck to clean up future minor incidents, closes #51
196 | * check-markit
197 | * Added section for bitbucket check-markit include Bitbucket repository, closes #37
198 | * shellcheck to clean up future minor incidents, closes #52
199 | * Changed log format and order, closes #54
200 | * Order of precedence: add support for environment variable (export DEBUG=1), default code, closes #53
201 | * find-code.sh
202 | * shellcheck to clean up future minor incidents, closes #57
203 | * Changed log format and order, closes #56
204 | * Order of precedence: add support for environment variable (export DEBUG=1), default code, closes #55
205 | * Support environment variables, closes #44
206 | * Completed display_help, closes #43
207 |
208 | ### Issues
209 | * close #37 Added section for bitbucket check-markit include Bitbucket repository
210 | * close #38 Adapted to work with Bitbucket
211 | * close #43 Completed display_help
212 | * close #44 Support environment variables
213 | * close #49 Changed log format and order
214 | * close #50 Order of precedence: add support for environment variable (export DEBUG=1), default code
215 | * close #51 shellcheck to clean up future minor incidents
216 | * close #52 shellcheck to clean up future minor incidents
217 | * close #53 Order of precedence: add support for environment variable (export DEBUG=1), default code
218 | * close #54 Changed log format and order
219 | * close #55 Order of precedence: add support for environment variable (export DEBUG=1), default code
220 | * close #56 Changed log format and order
221 | * close #57 shellcheck to clean up future minor incidents
222 | * close #58 Updated production standard 4 update display_help LANGUAGE
223 | * close #59 Added support for tcsh csh ksh etc
224 | * close #60 Added gitlog to README.md
225 | * close #61 Added Environment Variables MARKITLOCAL to support markit on local system
226 |
227 | # Version 3.120.273
228 | #### Release Name 3.120
229 | #### Release Date 2018-10-18T14:36:15-05:00 (CDT)
230 | * Changed to get_date_stamp() function
231 | * Added directory name to file_name so users can go directly to a file on GitHub or GitLab
232 |
233 | ### Features Added
234 | * Update README.md
235 | * markit
236 | * Added directory with file name on line one item 2, closes #39
237 | * Updated sample.sh
238 | * Changed echo or print DEBUG INFO WARNING ERROR, closes #40
239 | * find-code.sh
240 | * Changed echo or print DEBUG INFO WARNING ERROR, closes #42
241 | * Updated for display_help, closes #43
242 | * check-markit
243 | * Changed echo or print DEBUG INFO WARNING ERROR, closes #41
244 | * Added ISO 8601 for date, closes #46
245 |
246 | ### Issues
247 | * close #39 Added directory with file name on line one item 2
248 | * close #40 Changed echo or print DEBUG INFO WARNING ERROR
249 | * close #41 Changed echo or print DEBUG INFO WARNING ERROR
250 | * close #42 Changed echo or print DEBUG INFO WARNING ERROR
251 | * close #43 Updated for display_help
252 | * close #46 check-markit Added ISO 8601 for date
253 | * close #47 README.md Added ISO 8601 for date
254 | * close #48 duplicate incident
255 |
256 | # Version 3.81.231
257 | #### Release Name 3.81
258 | #### Release Date 2018-09-27_06:07:59_CDT
259 | * Correct incident with check-markit
260 |
261 | ### Features Added
262 | * Added code to check if /usr/share/bash-completion/completions/git, closes #36
263 | * No incident after testing, closes #33
264 | * Updated README.md
265 |
266 | ### Issues
267 | * close #33 No incident after testing
268 | * close #36 Added code to check if /usr/share/bash-completion/completions/git
269 |
270 | # Version 3.76.225
271 | #### Release Name 3.76
272 | #### Release Date 2018-09-10_13:56:21_CDT
273 | * Includes the addition of check-markit, and find-code.sh commands to markit
274 |
275 | ### Features Added
276 | * Updated sync to standard script design changes
277 | * Moved find-code.sh from user-work-files to markit
278 | * Changed grep && &&
505 | # EXAMPLE: Latest Release --> Version X.X.????
506 | #### Release Name {unreleased rc-# alpha-# beta prerelease latest}
507 | #### Release Date ????
508 | * Brief description
509 | * sub-repository
510 | * Brief description
511 |
512 | ### Features Added
513 | * Updated feature||file
514 | * Added the following test cases
515 | * hooks/bin/EXAMPLES/FVT-exit-code-error-0-001
516 | * sub-repository
517 | * directory/command git commit message
518 | * directory/command git commit message closes #XX
519 |
520 | ### Features Changes
521 | ### Features Deprecations
522 | ### Issues
523 | * close #X directory/command git commit message
524 | * sub-repository
525 | * close #XX directory/command git commit message
526 |
527 | ### Misc
528 | * backlog
529 |
--------------------------------------------------------------------------------
/TEST/find-code.sh/FVT-setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # TEST/find-code.sh/FVT-setup.sh 4.1.121.1047 2020-11-18T21:59:53.624751-06:00 (CST) https://github.com/BradleyA/markit master uadmin five-rpi3b.cptx86.com 4.1.120-4-g35f3e4d
3 | # TEST/find-code.sh/FVT-setup.sh --> testing
4 | # TEST/find-code.sh/FVT-setup.sh 4.1.109.1031 2020-11-12T13:39:23.653205-06:00 (CST) https://github.com/BradleyA/markit master uadmin five-rpi3b.cptx86.com 4.1.108
5 | # TEST/find-code.sh/FVT-setup.sh --> added FVT-option-invalid-00?
6 | # TEST/find-code.sh/FVT-setup.sh 4.1.89.1003 2020-10-27T11:36:44.695882-05:00 (CDT) https://github.com/BradleyA/markit master uadmin five-rpi3b.cptx86.com 4.1.88-16-gb5e2758
7 | # TEST/find-code.sh/FVT-setup.sh --> --> Created copy of FVT-setup.sh for find-code.sh test cases
8 | # hooks/EXAMPLES/FVT-setup.sh 3.1.108.1769 2020-10-25T11:11:55.508285-05:00 (CDT) https://github.com/BradleyA/git-TEST-commit-automation.git master uadmin five-rpi3b.cptx86.com 3.1.107-9-g7d67e50
9 | # hooks/EXAMPLES/FVT-setup.sh hooks/EXAMPLES/TEST/FVT-option-systems-002/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-systems-003/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-systems-004/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-systems-005/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-systems-006/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-systems-007/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-systems-008/SA-shellcheck-001.expected --> updated FVT-setup.sh
10 | # hooks/EXAMPLES/FVT-setup.sh 3.1.107.1759 2020-10-24T22:32:14.709918-05:00 (CDT) https://github.com/BradleyA/git-TEST-commit-automation.git master uadmin five-rpi3b.cptx86.com 3.1.106-1-g34370be
11 | # hooks/EXAMPLES/FVT-setup.sh --> adding options systems test cases
12 | # hooks/EXAMPLES/FVT-setup.sh 3.1.106.1757 2020-10-24T15:13:17.244716-05:00 (CDT) https://github.com/BradleyA/git-TEST-commit-automation.git master uadmin five-rpi3b.cptx86.com 3.1.105-1-g755b078
13 | # hooks/EXAMPLES/FVT-setup.sh --> added link for FVT-option-datadir-00?.expected
14 | # hooks/EXAMPLES/FVT-setup.sh 3.1.105.1755 2020-10-24T14:47:06.123988-05:00 (CDT) https://github.com/BradleyA/git-TEST-commit-automation.git master uadmin five-rpi3b.cptx86.com 3.1.104-9-g93a5b73
15 | # hooks/EXAMPLES/FVT-setup.sh hooks/EXAMPLES/TEST/FVT-option-datadir-001/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-datadir-002/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-datadir-003/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-datadir-004/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-datadir-005/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-datadir-006/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-datadir-007/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-datadir-008/SA-shellcheck-001.expected --> testing datadir
16 | # hooks/EXAMPLES/FVT-setup.sh 3.1.100.1741 2020-10-23T22:33:52.995488-05:00 (CDT) https://github.com/BradleyA/git-TEST-commit-automation.git master uadmin five-rpi3b.cptx86.com 3.1.99-9-ge5bd164
17 | # hooks/EXAMPLES/FVT-setup.sh hooks/EXAMPLES/TEST/FVT-option-cluster-001/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-cluster-002/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-cluster-003/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-cluster-004/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-cluster-005/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-cluster-006/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-cluster-007/SA-shellcheck-001.expected hooks/EXAMPLES/TEST/FVT-option-cluster-008/SA-shellcheck-001.expected --> added cluster
18 | # hooks/EXAMPLES/FVT-setup.sh 3.1.32.1578 2020-05-22T05:59:06.586723-05:00 (CDT) https://github.com/BradleyA/git-TEST-commit-automation.git master uadmin five-rpi3b.cptx86.com 3.1.31
19 | # hooks/EXAMPLES/FVT-setup.sh --> upgrade Production standards #49
20 | # hooks/EXAMPLES/FVT-setup.sh 2.460.1364 2020-01-31T19:15:09.843806-06:00 (CST) https://github.com/BradleyA/git-TEST-commit-automation.git master uadmin five-rpi3b.cptx86.com 2.459
21 | # hooks/EXAMPLES/FVT-setup.sh added This script does not support -* or help or usage or version
22 | # hooks/EXAMPLES/FVT-setup.sh 2.276.1076 2020-01-21T19:14:19.604461-06:00 (CST) https://github.com/BradleyA/git-TEST-commit-automation.git dev uadmin five-rpi3b.cptx86.com 2.275
23 | # FVT-* Production standard 5.3.559 Copyright
24 | # hooks/EXAMPLES/FVT-setup.sh 2.268.1065 2020-01-20T09:38:47.880404-06:00 (CST) https://github.com/BradleyA/git-TEST-commit-automation.git dev uadmin five-rpi3b.cptx86.com 2.267-1-gb19da99
25 | # hooks/EXAMPLES/FVT-setup.sh added test cases from TEST/git-TEST-cases.sh to EXAMPLES for FVT
26 | # hooks/EXAMPLES/FVT-setup.sh 2.258.1047 2020-01-19T09:50:49.987834-06:00 (CST) https://github.com/BradleyA/git-TEST-commit-automation.git dev uadmin five-rpi3b.cptx86.com 2.257
27 | # hooks/EXAMPLES/FVT-setup.sh Production standard 5.3.555 Copyright, Production standard 1.3.550 DEBUG variable, ### Production standard 2.3.529 log format:w
28 | # hooks/EXAMPLES/FVT-setup.sh 2.138.787 2019-09-27T12:33:27.430817-05:00 (CDT) https://github.com/BradleyA/git-TEST-commit-automation.git uadmin five-rpi3b.cptx86.com 2.137
29 | # close #34 EXAMPLES/SA-* FVT-* added NO -x ${1} exit ERROR 126
30 | #86# hooks/EXAMPLES/FVT-setup.sh - This test script is optional. It is for
31 | # 'Production standard 10.0 TESTing' test cases. Copy it to TEST//.
32 | # If FVT-setup.sh is found in TEST// post-commit executes it.
33 | # Functional Verification Testing (FVT) - verify that the program logic conforms
34 | # to design specification.
35 | ###
36 | ### Production standard 3.0 shellcheck
37 | ### Production standard 5.3.559 Copyright # 3.559
38 | # Copyright (c) 2020 Bradley Allen # 3.555
39 | # MIT License is online in the repository as a file named LICENSE" # 3.559
40 | ### Production standard 1.3.550 DEBUG variable # 3.550
41 | # Order of precedence: environment variable, default code
42 | if [[ "${DEBUG}" == "" ]] ; then DEBUG="0" ; fi # 0 = debug off, 1 = debug on, 'export DEBUG=1', 'unset DEBUG' to unset environment variable (bash)
43 | if [[ "${DEBUG}" == "2" ]] ; then set -x ; fi # Print trace of simple commands before they are executed
44 | if [[ "${DEBUG}" == "3" ]] ; then set -v ; fi # Print shell input lines as they are read
45 | if [[ "${DEBUG}" == "4" ]] ; then set -e ; fi # Exit immediately if non-zero exit status
46 | if [[ "${DEBUG}" == "5" ]] ; then set -e -o pipefail ; fi # Exit immediately if non-zero exit status and exit if any command in a pipeline errors
47 | #
48 | BOLD=$(tput -Txterm bold)
49 | UNDERLINE=$(tput -Txterm sgr 0 1) # 0.3.583
50 | NORMAL=$(tput -Txterm sgr0)
51 | RED=$(tput setaf 1)
52 | YELLOW=$(tput setaf 3)
53 | BLUE=$(tput setaf 4)
54 | PURPLE=$(tput setaf 5)
55 | WHITE=$(tput setaf 7)
56 |
57 | # Date and time function ISO 8601
58 | get_date_stamp() {
59 | DATE_STAMP=$(date +%Y-%m-%dT%H:%M:%S.%6N%:z)
60 | TEMP=$(date +%Z)
61 | DATE_STAMP="${DATE_STAMP} (${TEMP})"
62 | }
63 |
64 | # Fully qualified domain name FQDN hostname
65 | LOCALHOST=$(hostname -f)
66 |
67 | # Version
68 | # Assumptions for the next two lines of code: The second line in this script includes the script path & name as the second item and
69 | # the script version as the third item separated with space(s). The tool I use is called 'markit'. See example line below:
70 | # template/template.sh 3.517.783 2019-09-13T18:20:42.144356-05:00 (CDT) https://github.com/BradleyA/user-files.git uadmin one-rpi3b.cptx86.com 3.516
71 | SCRIPT_NAME=$(head -2 "${0}" | awk '{printf $2}') # Different from ${COMMAND_NAME}=$(echo "${0}" | sed 's/^.*\///'), SCRIPT_NAME = includes Git repository directory and can be used any where in script (for dev, test teams)
72 | SCRIPT_VERSION=$(head -2 "${0}" | awk '{printf $3}')
73 | if [[ "${SCRIPT_NAME}" == "" ]] ; then SCRIPT_NAME="${0}" ; fi
74 | if [[ "${SCRIPT_VERSION}" == "" ]] ; then SCRIPT_VERSION="v?.?" ; fi
75 |
76 | # GID
77 | GROUP_ID=$(id -g)
78 |
79 | ### Production standard 2.3.578 Log format (WHEN WHERE WHAT Version Line WHO UID:GID [TYPE] Message)
80 | new_message() { # $1="${LINENO}" $2="DEBUG INFO ERROR WARN" $3="message"
81 | get_date_stamp
82 | echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${SCRIPT_NAME}[$$] ${BOLD}${BLUE}${SCRIPT_VERSION} ${PURPLE}${1}${NORMAL} ${USER} ${UID}:${GROUP_ID} ${BOLD}[${2}]${NORMAL} ${3}"
83 | }
84 |
85 | # INFO
86 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}INFO${WHITE}" " Started..." 1>&2 ; fi
87 |
88 | # This script does not support -* or help or usage or version
89 | if [[ "${1}" == -* ]] || [[ "${1}" == "help" ]] || [[ "${1}" == "usage" ]] || [[ "${1}" == "version" ]] ; then
90 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " Option, ${YELLOW}${1}${WHITE}, is not supported with ${SCRIPT_NAME}." 1>&2
91 | # User Hint
92 | echo -e " For more information:\n${BOLD}${YELLOW} ${UNDERLINE}https://github.com/BradleyA/git-TEST-commit-automation/tree/master/hooks#git-test-commit-automation------${NORMAL}"
93 | exit 1
94 | fi
95 |
96 | ### Production standard 10.0 TESTing
97 |
98 | if [[ ! -z "${1}" ]] ; then # post-commit must pass REPOSITORY_DIR because post-commit is executed in .git/hooks/ which is not in the repository
99 | REPOSITORY_DIR=${1}
100 | else
101 | REPOSITORY_DIR=$(git rev-parse --show-toplevel) # not called by post-commit
102 | if [[ "${0}" != $(basename "${0}") ]] ; then # script must execute in TEST// directory
103 | cd "$(dirname "${0}")"
104 | fi
105 | fi
106 |
107 | # Uncomment shared TEST cases for TESTing
108 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-0-001" FVT-exit-code-error-0-001
109 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-1-001" FVT-exit-code-error-1-001
110 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-124-001" FVT-exit-code-error-124-001
111 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-124-002" FVT-exit-code-error-124-002
112 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-126-001" FVT-exit-code-error-126-001
113 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-127-001" FVT-exit-code-error-127-001
114 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-128-001" FVT-exit-code-error-128-001
115 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-130-001" FVT-exit-code-error-130-001
116 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-exit-code-error-2-001" FVT-exit-code-error-2-001
117 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-add-001" FVT-option-add-001
118 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-001" FVT-option-all-001
119 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-002" FVT-option-all-002
120 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-001" FVT-option-all-hooks-001
121 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-001.expected" FVT-option-all-hooks-001.expected
122 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-002" FVT-option-all-hooks-002
123 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-all-hooks-002.expected" FVT-option-all-hooks-002.expected
124 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-001" FVT-option-clean-001
125 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-002" FVT-option-clean-002
126 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-001" FVT-option-clean-hooks-001
127 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-002" FVT-option-clean-hooks-002
128 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-003" FVT-option-clean-hooks-003
129 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-clean-hooks-004" FVT-option-clean-hooks-004
130 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-001" FVT-option-cluster-001
131 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-001.expected" FVT-option-cluster-001.expected
132 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-002" FVT-option-cluster-002
133 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-002.expected" FVT-option-cluster-002.expected
134 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-003" FVT-option-cluster-003
135 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-003.expected" FVT-option-cluster-003.expected
136 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-004" FVT-option-cluster-004
137 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-004.expected" FVT-option-cluster-004.expected
138 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-005" FVT-option-cluster-005
139 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-005.expected" FVT-option-cluster-005.expected
140 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-006" FVT-option-cluster-006
141 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-006.expected" FVT-option-cluster-006.expected
142 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-007" FVT-option-cluster-007
143 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-007.expected" FVT-option-cluster-007.expected
144 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-008" FVT-option-cluster-008
145 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-cluster-008.expected" FVT-option-cluster-008.expected
146 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-001" FVT-option-datadir-001
147 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-001.expected" FVT-option-datadir-001.expected
148 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-002" FVT-option-datadir-002
149 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-002.expected" FVT-option-datadir-002.expected
150 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-003" FVT-option-datadir-003
151 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-003.expected" FVT-option-datadir-003.expected
152 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-004" FVT-option-datadir-004
153 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-004.expected" FVT-option-datadir-004.expected
154 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-005" FVT-option-datadir-005
155 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-005.expected" FVT-option-datadir-005.expected
156 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-006" FVT-option-datadir-006
157 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-006.expected" FVT-option-datadir-006.expected
158 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-007" FVT-option-datadir-007
159 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-007.expected" FVT-option-datadir-007.expected
160 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-008" FVT-option-datadir-008
161 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-datadir-008.expected" FVT-option-datadir-008.expected
162 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-001" FVT-option-systems-001
163 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-001.expected" FVT-option-systems-001.expected
164 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-002" FVT-option-systems-002
165 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-002.expected" FVT-option-systems-002.expected
166 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-003" FVT-option-systems-003
167 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-003.expected" FVT-option-systems-003.expected
168 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-004" FVT-option-systems-004
169 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-004.expected" FVT-option-systems-004.expected
170 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-005" FVT-option-systems-005
171 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-005.expected" FVT-option-systems-005.expected
172 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-006" FVT-option-systems-006
173 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-006.expected" FVT-option-systems-006.expected
174 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-007" FVT-option-systems-007
175 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-007.expected" FVT-option-systems-007.expected
176 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-008" FVT-option-systems-008
177 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-systems-008.expected" FVT-option-systems-008.expected
178 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-001" FVT-option-filename-001
179 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-001.expected" FVT-option-filename-001.expected
180 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-002" FVT-option-filename-002
181 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-002.expected" FVT-option-filename-002.expected
182 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-003" FVT-option-filename-003
183 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-003.expected" FVT-option-filename-003.expected
184 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-004" FVT-option-filename-004
185 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-004.expected" FVT-option-filename-004.expected
186 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-005" FVT-option-filename-005
187 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-005.expected" FVT-option-filename-005.expected
188 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-006" FVT-option-filename-006
189 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-006.expected" FVT-option-filename-006.expected
190 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-007" FVT-option-filename-007
191 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-007.expected" FVT-option-filename-007.expected
192 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-008" FVT-option-filename-008
193 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-008.expected" FVT-option-filename-008.expected
194 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-001" FVT-option-filename-hooks-001
195 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-001.expected" FVT-option-filename-hooks-001.expected
196 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-002" FVT-option-filename-hooks-002
197 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-002.expected" FVT-option-filename-hooks-002.expected
198 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-003" FVT-option-filename-hooks-003
199 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-003.expected" FVT-option-filename-hooks-003.expected
200 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-004" FVT-option-filename-hooks-004
201 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-004.expected" FVT-option-filename-hooks-004.expected
202 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-005" FVT-option-filename-hooks-005
203 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-005.expected" FVT-option-filename-hooks-005.expected
204 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-006" FVT-option-filename-hooks-006
205 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-006.expected" FVT-option-filename-hooks-006.expected
206 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-007" FVT-option-filename-hooks-007
207 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-007.expected" FVT-option-filename-hooks-007.expected
208 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-008" FVT-option-filename-hooks-008
209 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-008.expected" FVT-option-filename-hooks-008.expected
210 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-009" FVT-option-filename-hooks-009
211 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-009.expected" FVT-option-filename-hooks-009.expected
212 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-010" FVT-option-filename-hooks-010
213 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-010.expected" FVT-option-filename-hooks-010.expected
214 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-011" FVT-option-filename-hooks-011
215 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-011.expected" FVT-option-filename-hooks-011.expected
216 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-012" FVT-option-filename-hooks-012
217 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-filename-hooks-012.expected" FVT-option-filename-hooks-012.expected
218 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-001" FVT-option-help-001
219 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-002" FVT-option-help-002
220 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-003" FVT-option-help-003
221 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-004" FVT-option-help-004
222 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-005" FVT-option-help-005
223 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-help-006" FVT-option-help-006
224 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-001" FVT-option-invalid-001
225 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-001.expected" FVT-option-invalid-001.expected
226 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-002" FVT-option-invalid-002
227 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-invalid-002.expected" FVT-option-invalid-002.expected
228 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-001" FVT-option-none-001
229 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-002" FVT-option-none-002
230 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-001" FVT-option-none-hooks-001
231 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-001.expected" FVT-option-none-hooks-001.expected
232 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-002" FVT-option-none-hooks-002
233 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-002.expected" FVT-option-none-hooks-002.expected
234 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-003" FVT-option-none-hooks-003
235 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-003.expected" FVT-option-none-hooks-003.expected
236 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-004" FVT-option-none-hooks-004
237 | # ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-none-hooks-004.expected" FVT-option-none-hooks-004.expected
238 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-001" FVT-option-usage-001
239 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-002" FVT-option-usage-002
240 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-003" FVT-option-usage-003
241 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-usage-004" FVT-option-usage-004
242 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-001" FVT-option-version-001
243 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-002" FVT-option-version-002
244 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-003" FVT-option-version-003
245 | ln -fs "${REPOSITORY_DIR}/hooks/EXAMPLES/FVT-option-version-004" FVT-option-version-004
246 |
247 | #
248 |
249 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "DEBUG" " Operation finished..." 1>&2 ; fi
250 | ###
251 |
--------------------------------------------------------------------------------
/markit:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # markit 4.2.9.1149 2021-06-04T11:10:33.646600-05:00 (CDT) https://github.com/BradleyA/markit.git master uthree three.cptx86.com 4.2.8-1-g675dc09
3 | # markit --> correct Test case SA-shellcheck-001 markit
4 | # markit 4.2.7.1146 2021-06-04T10:51:14.392781-05:00 (CDT) https://github.com/BradleyA/markit.git master uthree three.cptx86.com 4.2.6-5-g803e81d
5 | # markit --> updated display_help and examples
6 | # markit 4.2.1.1114 2020-12-22T21:02:03.686774-06:00 (CST) https://github.com/BradleyA/markit.git master uadmin three-rpi3b.cptx86.com 4.1.146-24-g68844ef
7 | # check-markit find-code.sh markit --> release ready for production
8 | #86# markit
9 | # I created this script because Git fails me when it comes to including a
10 | # version number and a change description in each file being checked-in.
11 | #
12 | # I want to know what version a piece of code is on any system running
13 | # it. The system may or may not be connected to any network. The system
14 | # may or may not have Git installed. The system may or may not have a
15 | # GitHub repository or Bitbucket repository or GitLab project installed
16 | # on it. I want the same solution for several types of code (.sh, .go,
17 | # .yml, .xml, .mk, dockerfile, .txt, etc). I want any person without
18 | # knowledge of Git or GitHub or Bitbucket or GitLab to be able to answer
19 | # one question over the phone;
20 | # What version are you running?
21 | #
22 | # Released files need a version number in text when checked in!
23 | # This is not for your kernal, just files. Bite me! and Merge that!
24 | ###
25 | ### Production standard 5.3.559 Copyright # 3.559
26 | # Copyright (c) 2020 Bradley Allen # 3.555
27 | # MIT License is online in the repository as a file named LICENSE" # 3.559
28 | ### Production standard 3.0 shellcheck
29 | ### Production standard 1.3.614 DEBUG variable
30 | # Order of precedence: environment variable, default code
31 | if [[ "${DEBUG}" == "" ]] ; then DEBUG="0" ; fi # 0 = debug off, 1 = debug on, 'export DEBUG=1', 'unset DEBUG' to unset environment variable (bash)
32 | if [[ "${DEBUG}" == "2" ]] ; then set -x ; fi # Print trace of simple commands before they are executed
33 | if [[ "${DEBUG}" == "3" ]] ; then set -v ; fi # Print shell input lines as they are read
34 | if [[ "${DEBUG}" == "4" ]] ; then set -e ; fi # Exit immediately if non-zero exit status
35 | if [[ "${DEBUG}" == "5" ]] ; then set -e -o pipefail ; fi # Exit immediately if non-zero exit status and exit if any command in a pipeline errors
36 | #
37 | BOLD=$(tput -Txterm bold)
38 | UNDERLINE=$(tput -Txterm sgr 0 1) # 0.3.583
39 | NORMAL=$(tput -Txterm sgr0)
40 | RED=$(tput setaf 1)
41 | YELLOW=$(tput setaf 3)
42 | BLUE=$(tput setaf 4)
43 | PURPLE=$(tput setaf 5)
44 | CYAN=$(tput setaf 6)
45 | WHITE=$(tput setaf 7)
46 |
47 | ### Production standard 7.0 Default variable value
48 | BRANCH=""
49 |
50 | ### Production standard 8.3.541 --usage
51 | COMMAND_NAME=$(echo "${0}" | sed 's/^.*\///') # 3.541
52 | display_usage() {
53 | echo -e "\n${NORMAL}${COMMAND_NAME}\n add Git verion control information, push to GitHub or Bitbucket or GitLab"
54 | echo -e "\n${BOLD}USAGE${NORMAL}"
55 | echo -e " ${COMMAND_NAME} [no | normal | all]\n"
56 | echo " ${COMMAND_NAME} [--help | -help | help | -h | h | -?]"
57 | echo " ${COMMAND_NAME} [--usage | -usage | -u]"
58 | echo " ${COMMAND_NAME} [--version | -version | -v]"
59 | }
60 |
61 | ### Production standard 0.3.615 --help
62 | display_help() {
63 | display_usage
64 | # Displaying help DESCRIPTION in English en_US.UTF-8, en.UTF-8, C.UTF-8 # 3.550
65 | echo -e "\n${BOLD}DESCRIPTION${NORMAL}"
66 | echo "Markit is a simple bash script that adds Git verion control information to"
67 | echo "files while being pushed to GitHub, Bitbucket, or GitLab (Supported files:"
68 | echo "Shell(sh|bash|csh|tcsh|ksh), Go, Dockerfile, YAML, Makefile, Scala,"
69 | echo "Terraform, Python, Java, PHP, C, C++, JavaScript, Perl, Ruby, PowerShell,"
70 | echo "Ri, C header, C++ header, HTML, Kotlin, Pascal, R, Rust, Text, XML . . ."
71 | echo -e "\nMarkit supports Semantic Versioning (MAJOR.MINOR.PATCH) and alphanumeric"
72 | echo "versioning (1.2.5-beta.1). Markit will display the current version before"
73 | echo "prompting you to enter the next version. Markit includes the number of"
74 | echo "commits with the version in the file(s). I find this helpful when"
75 | echo "commiting several different changes while working on the same PATCH."
76 | echo -e "\nMarkit adds two comment lines with information about file changes to all"
77 | echo "modified tracked file(s) in your local Git repository. Then pushes those"
78 | echo "modified file(s) to either a GitHub repository or Bitbucket repository or"
79 | echo "GitLab project. If environment variable MARKITLOCAL is set to 1, markit"
80 | echo "adds two comment lines, commits modified tracked file(s) in your local"
81 | echo "Git repository, but does not push to remote Git repository. I find this"
82 | echo "helpful when working without network access to a remote Git repository."
83 | echo -e "\nThe first comment line includes file name, version.commit, date, time,"
84 | echo "time zone, repository URL, Git branch, user, hostname, and previous"
85 | echo "version. The second comment line includes updated file name(s) and a"
86 | echo "brief description about changes made to the file(s)."
87 | echo -e "\nThere will be a prompt to add comment character(s) for unknown file names"
88 | echo "when needed and a prompt to add a description about the changes."
89 | echo -e "\nMarkit only modifies Git tracked file(s) by default. To change a Git"
90 | echo "untracked file to a Git tracked file enter, 'git add '. To"
91 | echo "include all tracked and untracked file(s) enter, 'markit all'. To"
92 | echo "prevent an untracked file from being tracked, add file(s) to .gitignore"
93 | echo "file."
94 | echo -e "\nThere are several different methods to 'git push' to more than one repository"
95 | echo "while using markit. One method is to edit /.git/config and add a"
96 | echo "pushurl line for each additional repository in the [remote \"origin\"] section."
97 | echo " [remote \"origin\"]"
98 | echo " url = https://github.com/BradleyA/markit.git"
99 | echo " pushurl = https://github.com/BradleyA/markit.git"
100 | echo " pushurl = https://axebbq@bitbucket.org/axebbq/markit.git"
101 | echo " pushurl = https://BradleyAxe@gitlab.com/BradleyAxe/markit.git"
102 | echo " fetch = +refs/heads/*:refs/remotes/origin/*"
103 |
104 | ### Production standard 4.3.587 Documentation Language # 3.550
105 | # Displaying help DESCRIPTION in French fr_CA.UTF-8, fr_FR.UTF-8, fr_CH.UTF-8
106 | if [[ "${LANG}" == "fr_CA.UTF-8" ]] || [[ "${LANG}" == "fr_FR.UTF-8" ]] || [[ "${LANG}" == "fr_CH.UTF-8" ]] ; then
107 | echo -e "\n--> ${LANG}"
108 | echo "" # Your help goes here
109 | echo "Souhaitez-vous traduire la section description?" # Would you like to translate the description section?
110 | elif ! [[ "${LANG}" == "en_US.UTF-8" || "${LANG}" == "en.UTF-8" || "${LANG}" == "C.UTF-8" ]] ; then # 3.550
111 | new_message "${LINENO}" "${YELLOW}INFO${WHITE}" " Your language, ${LANG}, is not supported. Would you like to translate the description section?" 1>&2
112 | fi
113 |
114 | echo -e "\n${BOLD}ENVIRONMENT VARIABLES${NORMAL}"
115 | echo "If using the bash shell, enter; 'export DEBUG=1' on the command line to set"
116 | echo "the environment variable DEBUG to '1' (0 = debug off, 1 = debug on). Use the"
117 | echo "command, 'unset DEBUG' to remove the exported information from the environment"
118 | echo "variable DEBUG. You are on your own defining environment variables if"
119 | echo "you are using other shells."
120 |
121 | ### Production standard 1.3.614 DEBUG variable
122 | echo " DEBUG (default off '0') The DEBUG environment variable can be set" # 3.550
123 | echo " to 0, 1, 2, 3, 4 or 5. The setting '' or 0 will turn off" # 3.550
124 | echo " all DEBUG messages during execution of this script. The" # 3.550
125 | echo " setting 1 will print all DEBUG messages during execution." # 3.550
126 | echo " Setting 2 (set -x) will print a trace of simple commands" # 3.550
127 | echo " before they are executed. Setting 3 (set -v) will print" # 3.550
128 | echo " shell input lines as they are read. Setting 4 (set -e) will" # 3.550
129 | echo " exit immediately if non-zero exit status is recieved with" # 3.550
130 | echo " some exceptions. Setting 5 (set -e -o pipefail) will do" # 3.550
131 | echo " setting 4 and exit if any command in a pipeline errors. For" # 3.550
132 | echo " more information about the set options, see man bash." # 3.550
133 |
134 | echo " MARKITLOCAL push to remote Git repository (default '0')"
135 | echo " export MARKITLOCAL=1 only commit to local Git repository, do not"
136 | echo " push to remote Git repository"
137 |
138 | echo -e "\n${BOLD}OPTIONS${NORMAL}"
139 | echo -e "Order of precedence: CLI options, environment variable, default value.\n" # 0.3.595
140 | echo " --help, -help, help, -h, h, -?" # 0.3.595
141 | echo -e "\tOn-line brief reference manual\n" # 0.3.595
142 | echo " --usage, -usage, -u" # 0.3.595
143 | echo -e "\tOn-line command usage\n" # 0.3.595
144 | echo " --version, -version, -v" # 0.3.595
145 | echo -e "\tOn-line command version\n" # 0.3.595
146 |
147 | echo -e " UNTRACKED_FILES - used to specify the handling of untracked files"
148 | echo " no no untracked files (default)"
149 | echo " normal untracked files and directories"
150 | echo " all Also individual files in untracked directories"
151 |
152 | echo -e "\n${BOLD}DOCUMENTATION${NORMAL}"
153 | echo " ${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md#markit${NORMAL}" # 0.3.583"
154 |
155 | echo -e "\n${BOLD}EXAMPLES${NORMAL}"
156 | echo -e " Mark tracked file(s) and push to remote Git repository\n\t${BOLD}${COMMAND_NAME}${NORMAL}\n" # 3.550
157 | echo -e " Mark tracked and untracked files, directories, and files in untracked\n directories\n\t${BOLD}${COMMAND_NAME} all${NORMAL}\n" # 3.550
158 | echo -e " Mark tracked file(s) but don't push to remote Git repository, only update\n local repository\n\t${BOLD}export MARKITLOCAL=1 ; ${COMMAND_NAME} ; unset MARKITLOCAL${NORMAL}\n" # 3.550
159 |
160 | echo -e "\n${BOLD}SEE ALSO${NORMAL}" # 0.3.615
161 | echo " ${BOLD}check-markit${NORMAL} Check the release version of a file" # 0.3.615
162 | echo -e "\twith the remote Git repository release version" # 0.3.615
163 | echo -e "\t(${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md${NORMAL})\n" # 0.3.615
164 | echo " ${BOLD}find-code.sh${NORMAL} Search each system found in" # 0.3.615
165 | echo -e "\t/ file for .git repositories in ~/.. directories" # 0.3.615
166 | echo -e "\t(${UNDERLINE}https://github.com/BradleyA/markit/blob/master/README.md#usage-find-codesh${NORMAL})" # 0.3.615
167 |
168 | echo -e "\n${BOLD}AUTHOR${NORMAL}" # 3.550
169 | echo " ${COMMAND_NAME} was written by Bradley Allen " # 3.550
170 |
171 | echo -e "\n${BOLD}REPORTING BUGS${NORMAL}" # 3.550
172 | echo " Report ${COMMAND_NAME} bugs ${UNDERLINE}https://github.com/BradleyA/markit/issues/new/choose${NORMAL}" # 0.3.579
173 |
174 | ### Production standard 5.3.559 Copyright # 3.559
175 | echo -e "\n${BOLD}COPYRIGHT${NORMAL}" # 3.550
176 | echo " Copyright (c) 2020 Bradley Allen" # 3.550
177 | echo " MIT License is online in the repository as a file named LICENSE" # 3.559
178 | }
179 |
180 | # Date and time function ISO 8601
181 | get_date_stamp() {
182 | DATE_STAMP=$(date +%Y-%m-%dT%H:%M:%S.%6N%:z)
183 | TEMP=$(date +%Z)
184 | DATE_STAMP="${DATE_STAMP} (${TEMP})"
185 | }
186 |
187 | # Fully qualified domain name FQDN hostname
188 | LOCALHOST=$(hostname -f)
189 |
190 | # Version
191 | # Assumptions for the next two lines of code: The second line in this script includes the script path & name as the second item and
192 | # the script version as the third item separated with space(s). The tool I use is called 'markit'. See example line below:
193 | # template/template.sh 3.517.783 2019-09-13T18:20:42.144356-05:00 (CDT) https://github.com/BradleyA/user-files.git uadmin one-rpi3b.cptx86.com 3.516
194 | SCRIPT_NAME=$(head -2 "${0}" | awk '{printf $2}') # Different from ${COMMAND_NAME}=$(echo "${0}" | sed 's/^.*\///'), SCRIPT_NAME = includes Git repository directory and can be used any where in script (for dev, test teams)
195 | SCRIPT_VERSION=$(head -2 "${0}" | awk '{printf $3}')
196 | if [[ "${SCRIPT_NAME}" == "" ]] ; then SCRIPT_NAME="${0}" ; fi
197 | if [[ "${SCRIPT_VERSION}" == "" ]] ; then SCRIPT_VERSION="v?.?" ; fi
198 |
199 | # GID
200 | GROUP_ID=$(id -g)
201 |
202 | ### Production standard 2.3.614 Log format (WHEN WHERE WHAT Version Line WHO UID:GID [TYPE] Message)
203 | new_message() { # $1="${LINENO}" $2="DEBUG INFO ERROR WARN" $3="message"
204 | get_date_stamp
205 | echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${BOLD}${CYAN}${SCRIPT_NAME}${NORMAL}[$$] ${BOLD}${BLUE}${SCRIPT_VERSION} ${PURPLE}${1}${NORMAL} ${USER} ${UID}:${GROUP_ID} ${BOLD}[${2}]${NORMAL} ${3}" # 2.3.614
206 | }
207 |
208 | # INFO
209 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}INFO${WHITE}" "${BOLD}${CYAN} Started...${NORMAL}" 1>&2 ; fi # 1.3.614
210 |
211 | # DEBUG # 1.3.614
212 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " Name_of_command >${YELLOW}${SCRIPT_NAME}${WHITE}< Name_of_arg1 >${YELLOW}${1}${WHITE}< Name_of_arg2 >${YELLOW}${2}${WHITE}< Name_of_arg3 >${YELLOW}${3}${WHITE}< Version of bash ${YELLOW}${BASH_VERSION}${WHITE}" 1>&2 ; fi # 1.3.614
213 |
214 | ### Production standard 9.3.606 Parse CLI options and arguments
215 | while [[ "${#}" -gt 0 ]] ; do
216 | case "${1}" in
217 | --help|-help|help|-h|h|-\?) display_help | more ; exit 0 ;;
218 | --usage|-usage|usage|-u) display_usage ; exit 0 ;;
219 | --version|-version|version|-v) echo "${SCRIPT_NAME} ${SCRIPT_VERSION}" ; exit 0 ;;
220 | *) echo -e "\n${BOLD} Invalid option, ${YELLOW}${1}${WHITE}, try ${YELLOW}--usage${NORMAL}\n" ; exit 1 ; ;; # 9.3.606
221 | esac
222 | done
223 |
224 | ###
225 |
226 | # Check if bash-completion/completions/git file on system
227 | if [[ -e /usr/share/bash-completion/completions/git ]] ; then
228 | # This is to support __gitdir in the following section
229 | source /usr/share/bash-completion/completions/git
230 | else
231 | new_message "${LINENO}" "${YELLOW}INFO${WHITE}" " /usr/share/bash-completion/completions/git NOT found" 1>&2
232 | fi
233 |
234 | # Check if in Git repository
235 | if ! $( __gitdir > /dev/null 2>&1 ) ; then
236 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " Check if you are in a Git repository and you have Git permission. Current directory $(pwd)" 1>&2
237 | exit 1
238 | fi
239 |
240 | # Check if environment variable, default 0
241 | if [[ "${MARKITLOCAL}" == "" ]] ; then MARKITLOCAL="0" ; fi
242 |
243 | # Check if remote Git repository has been setup #28
244 | git rev-list HEAD 1> /dev/null || { new_message "${LINENO}" "${RED}ERROR${WHITE}" " Remote Git repository has not been setup or git clone was not used to pull remote Git repository before using markit. ${BOLD}${YELLOW}A remote Git repository is required before markit will work with local or remote repositories.${NORMAL}" 1>&2 ; exit 1; }
245 |
246 | #
247 | UNTRACKED_FILES=${1:-no}
248 | BEGIN_COMMENT_CHAR=""
249 | END_COMMENT_CHAR=""
250 | REMOTE_REPOSITORY=$(git ls-remote --get-url)
251 | TEMP_FILE="TEMP_MARKIT_FILE"
252 | # The FILE_MESSAGE is a one line breif description about the changes.
253 | FILE_MESSAGE=""
254 | FILE_RELEASE=""
255 |
256 | # Check if no tag for file ; first time Git repository is being tagged
257 | if ! [[ "$(git tag)" == "" ]] ; then
258 | # latest tagged commit across all branches
259 | CURRENT_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1))
260 | else
261 | CURRENT_RELEASE="0.1.1"
262 | fi
263 |
264 | # Check arguement 1 for --untracked-files
265 | if [[ "$1" != "no" ]] && [[ "$1" != "normal" ]] && [[ "$1" != "all" ]] && [[ "$1" != "" ]] ; then
266 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " First arguement, ${1}, is NOT no, normal, all." 1>&2
267 | exit 1
268 | fi
269 |
270 | # Change to top level git directory to include it with ${FILE_NAME} on line one item 2 #39
271 | # By changing ${FILE_NAME} to include the directory, all the information
272 | # is available to find ${FILE_NAME}'s location in GitHub or Bitbucket repository or GitLab repository
273 | cd $(git rev-parse --show-toplevel)
274 |
275 | # Create FILE_LIST, remove deleted files from FILE_LIST
276 | FILE_LIST=$(git status -s --untracked-files="${UNTRACKED_FILES}" | grep -v '^D ' | awk '{print $2}')
277 |
278 | # Check if ${FILE_LIST} is zero length
279 | if [[ -z "${FILE_LIST}" ]] ; then
280 | echo -e "No tracked file(s) found to mark and push." 1>&2
281 | # Display untracked file(s)
282 | if [[ $(git status --untracked-file=all -s | wc -l) ]] ; then
283 | echo -e "${NORMAL}\nList of untracked file(s).${BOLD}${CYAN}\n"
284 | git status --untracked-file=all -s | grep '?? ' | sed 's/^??//'
285 | echo -e "${NORMAL}\nEnter ${BOLD}${YELLOW}git add ${NORMAL} to change from an untracked file to a tracked file."
286 | echo -e "\nOr include all untracked files and directories, enter ${BOLD}${YELLOW}markit all${NORMAL}\n"
287 | fi
288 | exit 1
289 | fi
290 |
291 | # Check if user has write permission
292 | if ! $(touch "${TEMP_FILE}" > /dev/null 2>&1 ) ; then
293 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " ${USER} does NOT have write permission in local Git repository directory $(pwd)" 1>&2
294 | exit 1
295 | fi
296 | rm -f "${TEMP_FILE}"
297 |
298 | # Check if remote or local Git repository then notify user
299 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " MARKITLOCAL >${BOLD}${CYAN}${MARKITLOCAL}${NORMAL}<" 1>&2 ; fi # 1.3.614
300 | if [[ "${MARKITLOCAL}" == "0" ]] ; then
301 | echo -e "${NORMAL}Files to be marked and pushed to ${BOLD}${YELLOW}remote${NORMAL} Git repository:"
302 | elif [[ "${MARKITLOCAL}" == "1" ]] ; then
303 | echo -e "${NORMAL}Files to be marked for ${BOLD}${YELLOW}local${NORMAL} Git repository and NOT pushed to remote Git repository:"
304 | else
305 | new_message "${LINENO}" "${RED}ERROR${WHITE}" " Environment Variables MARKITLOCAL is not set to 0 or 1. Current setting for MARKITLOCAL >${BOLD}${CYAN}${MARKITLOCAL}${NORMAL}<" 1>&2
306 | exit 1
307 | fi
308 |
309 | # Prompt for release number
310 | echo -e "\n${BOLD}${CYAN}${FILE_LIST}${NORMAL}"
311 | echo -e "\nCurrent Git repository release number: ${BOLD}${YELLOW}${CURRENT_RELEASE}${NORMAL}"
312 | echo -e "Enter ${BOLD}${YELLOW}release number${NORMAL} to commit files (examples: 3.217 3.1.231 2.3.5-alpha.4 2.1.64-rc.1) or ctrl-c to stop.\n"
313 | read -p "${BOLD}${CYAN} " FILE_RELEASE
314 | echo "${NORMAL}"
315 | if [[ -z "${FILE_RELEASE}" ]] ; then
316 | FILE_RELEASE="${CURRENT_RELEASE}"
317 | fi
318 |
319 | # Warn user if release number is not great than ${CURRENT_RELEASE}
320 | # Use case requires a WARNING not an ERROR ; see issue #14 for more information
321 | if [[ "${CURRENT_RELEASE}" == "${FILE_RELEASE}" ]] || [[ "${CURRENT_RELEASE}" > "${FILE_RELEASE}" ]] ; then
322 | echo -e "${BOLD}${YELLOW}Release number may not be greater than current release number.${NORMAL}" 1>&2
323 | fi
324 | echo -e "${NORMAL}Using release number: ${BOLD}${YELLOW}${FILE_RELEASE}${NORMAL}" 1>&2
325 |
326 | # Prompt for single line change description
327 | echo -e "\n${NORMAL}Enter a ${BOLD}${YELLOW}one line description${NORMAL} about the changes or ctrl-c to stop."
328 | echo -e "\t(example: Added logic for --help; closes #12, resolves #14):\n"
329 | read -p "${BOLD}${CYAN} " FILE_MESSAGE
330 | echo "${NORMAL}"
331 | if [[ -z "${FILE_MESSAGE}" ]] ; then
332 | echo -e "${NORMAL}Single-line description is ${BOLD}${YELLOW}required${NORMAL}.\nTo display your changes between commits, ${BOLD}${YELLOW}git diff ${NORMAL}." 1>&2
333 | exit 1
334 | fi
335 |
336 | # Current git branch
337 | BRANCH=$(git rev-parse --abbrev-ref HEAD)
338 |
339 | # Mark each file
340 | for FILE_NAME in ${FILE_LIST} ; do
341 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " FILE_NAME >${BOLD}${CYAN}${FILE_NAME}${NORMAL}<" 1>&2 ; fi # 1.3.614
342 | #
343 | # >>> #15 In the future, Use markit solution for source code and create a wrapper during compile/build time ?
344 | # >>> This will change the extension case statement objective: move from comments to variables in compiled code
345 | # >>> move from comments in source code to variables in compiled code
346 | # >>> very different vision / goal
347 | # >>> Use markit in the source code & insert; var BUILD_VERSION="${FILE_RELEASE}.`git rev-list HEAD | wc -l`"
348 | # >>> Or use markit; to create CHAR variable found in compiled code ?
349 | # >>> opening comment x.c 'var VERSION="' and ending comment '"'
350 | # >>> opening comment x.c 'char VERSION[] = "$Version: ' ${FILE_NAME} ${FILE_RELEASE}.`git rev-list HEAD | wc -l` ${DATE_STAMP} ${USER} ${LOCALHOST} `git describe` and ending comment '$";'
351 | # >>> x.o $Version: XXXX XXXX XXXX XXXX '$'
352 | # >>> opening comment x.c 'char VERSION_MESSAGE[] = "$Version_message: ' ${FILE_MESSAGE} ` and ending comment '$";'
353 | # >>> x.o $Version_message: XXXX '$'
354 | #
355 | # >>> #21 Create a case statement if other non-extension files like Dockerfile or Makefile need support
356 | if [[ "${FILE_NAME##*/}" == "Dockerfile" ]] || [[ "${FILE_NAME##*/}" == "Makefile" ]] ; then
357 | BEGIN_COMMENT_CHAR="# "
358 | END_COMMENT_CHAR=""
359 | else
360 | # >>> #?? This does not work if the last character is '.' but it does work if more than one "."
361 | FILE_EXTENSION=${FILE_NAME##*\.}
362 | echo -e "\t${BOLD}${PURPLE}${FILE_NAME} ${FILE_EXTENSION}${NORMAL}"
363 | # Single-line comment character(s) matching file extension
364 | # ONLY SUPPORT single-line comments NOT multiple line block comment
365 | case "${FILE_EXTENSION}" in
366 | sh|bash|csh|tcsh|ksh|pl|PL|psh|py|rb|ps1|msh|php|php3|php4|ph3|ph4|R|yml|yaml|mk|MK|txt|tf|tfstate)
367 | # shell(sh|bash|csh|tcsh|ksh) perl(pl|PL|psh) Python(py) ruby(rb) PowerShell(ps1|msh) PHP(php|php3|php4|ph3|ph4) R(R) YAML(yml|yaml) Makefile(mk|MK) text(txt) Terraform(tf|tfstate)
368 | BEGIN_COMMENT_CHAR="# "
369 | END_COMMENT_CHAR=""
370 | ;;
371 | c|h|H|hpp|hxx|Hxx|HXX)
372 | # c(c) C header(h|H|hpp) C++ header(hxx|Hxx|HXX)
373 | BEGIN_COMMENT_CHAR="/* "
374 | END_COMMENT_CHAR=" */"
375 | ;;
376 | cc|cpp|c++|cxx|go|java|class|jar|js|kt|kts|p|pp|pas|rs|rlib|scala|sc)
377 | # C++(cc|cpp|c++|cxx) Go(go) Java(java|class|jar) JavaScript(js) Kotlin(kt|kts) Pascal(p|pp|paa) Rust(rs|rlib) Scala(scala|sc)
378 | BEGIN_COMMENT_CHAR="// "
379 | END_COMMENT_CHAR=""
380 | ;;
381 | xml|html|htm)
382 | # XML(xml) HTML (html|htm)
383 | BEGIN_COMMENT_CHAR=""
385 | ;;
386 | *)
387 | # Prompt for single-line beginning comment character(s)
388 | echo -e "\nEnter single-line ${BOLD}${YELLOW}BEGINNING${NORMAL}${YELLOW} comment character(s) for ${BOLD}${FILE_NAME}${NORMAL}\n\t(example: # // -- ! C !* -- // % ;; || /* ---> -} */ --]] %} *) #> )"
395 | read END_COMMENT_CHAR
396 | ;;
397 | esac
398 | fi
399 | get_date_stamp
400 | head -1 "${FILE_NAME}" >> "${TEMP_FILE}"
401 |
402 | # ${FILE_NAME} ${FILE_RELEASE}.(# of commits) ${DATE_STAMP} ${REMOTE_REPOSITORY} ${BRANCH} ${USER} ${LOCALHOST} (git describe)
403 | if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "${YELLOW}DEBUG${WHITE}" " FILE_NAME >${BOLD}${CYAN}${FILE_NAME}${NORMAL}< FILE_RELEASE >${BOLD}${CYAN}${FILE_RELEASE}${NORMAL}< REMOTE_REPOSITORY >${BOLD}${CYAN}${REMOTE_REPOSITORY}${NORMAL}< BRANCH >${BOLD}${CYAN}${BRANCH}${NORMAL}<" 1>&2 ; fi # 1.3.614
404 | # Check if no tag for file / first time in Git repository is being tagged
405 | if ! [[ "$(git tag)" == "" ]] ; then
406 | echo "${BEGIN_COMMENT_CHAR} ${FILE_NAME} ${FILE_RELEASE}.$(git rev-list HEAD | wc -l) ${DATE_STAMP} ${REMOTE_REPOSITORY} ${BRANCH} ${USER} ${LOCALHOST} $(git describe) ${END_COMMENT_CHAR}" >> "${TEMP_FILE}"
407 | else
408 | echo "${BEGIN_COMMENT_CHAR} ${FILE_NAME} ${FILE_RELEASE}.$(git rev-list HEAD | wc -l) ${DATE_STAMP} ${REMOTE_REPOSITORY} ${BRANCH} ${USER} ${LOCALHOST} 'No-parent-git-tag-found-in-repository' ${END_COMMENT_CHAR}" >> "${TEMP_FILE}"
409 | fi
410 |
411 | # ${FILE_LIST} --> ${FILE_MESSAGE}
412 | echo "${BEGIN_COMMENT_CHAR} ${FILE_LIST//$'\n'/ } --> ${FILE_MESSAGE} ${END_COMMENT_CHAR}" >> "${TEMP_FILE}"
413 | tail -n $(wc -l "${FILE_NAME}" | awk '{print $1 - 1}') "${FILE_NAME}" >> "${TEMP_FILE}"
414 | cp "${TEMP_FILE}" "${FILE_NAME}"
415 | rm "${TEMP_FILE}"
416 | # Add file contents to the index
417 | git add "${FILE_NAME}"
418 | done
419 | echo "${NORMAL}"
420 |
421 | # Commit file(s)
422 | git commit -m "${FILE_LIST} --> ${FILE_MESSAGE}"
423 |
424 | # If new release number, Tag file(s)
425 | if ! [[ "${FILE_RELEASE}" == "${CURRENT_RELEASE}" ]] ; then
426 | git tag -a "${FILE_RELEASE}" -m "${FILE_LIST} --> ${FILE_MESSAGE}"
427 | fi
428 |
429 | # If MARKITLOCAL not set, git push to remote Git repository
430 | if [[ "${MARKITLOCAL}" == "0" ]] ; then
431 | # Push changes to GitHub repository or Bitbucket repository or GitLab project
432 | git push --follow-tags || { new_message "${LINENO}" "${RED}ERROR${WHITE}" " If invalid username or password message then enter the following\n\tcommand to complete pushing marked files with the correcet password;\n\t\t${BOLD}git push --follow-tags${NORMAL}\n\n\tIf markit failed to push because the repository contains other work\n\tthat is not in your local Git repository. Then enter the following\n\tcommands to pull the other changes then push your marked files;\n\t\t${BOLD}git pull\n\t\tgit push --follow-tags${NORMAL}" ; exit 1; }
433 | # Notify user how to view remote Git repository
434 | echo -e "\n${YELLOW}Files marked and stored in ${BOLD}remote${NORMAL}${YELLOW} Git repository."
435 | echo "View commits example: ${BOLD}git log --graph --decorate --oneline --color --stat${NORMAL}"
436 |
437 | # If MARKITLOCAL, notify user how to view local commits
438 | elif [[ "${MARKITLOCAL}" == "1" ]] ; then
439 | echo -e "\n${YELLOW}Files marked and stored in ${BOLD}local${NORMAL}${YELLOW} Git repository."
440 | echo "View local commits example: ${BOLD}git log --graph --decorate --oneline --color --stat origin..HEAD${NORMAL}"
441 | fi
442 |
443 | #
444 | new_message "${LINENO}" "${YELLOW}INFO${WHITE}" "${BOLD}${CYAN} Operation finished...${NORMAL}" 1>&2 # 1.3.614
445 | ###
446 |
--------------------------------------------------------------------------------