-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start refactoring the shell commands, automatically push the new version
- Loading branch information
Showing
9 changed files
with
161 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Travis reported branch $TRAVIS_BRANCH" | ||
|
||
#go to home and setup git | ||
cd $HOME | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Travis" | ||
|
||
git clone --quiet --branch=2.x https://${GH_TOKEN}@github.com/MetadataRegistry/registry.git registry > /dev/null | ||
|
||
cd registry | ||
|
||
sed "s/ENV MC_VERSION.*/ENV MC_VERSION $TRAVIS_TAG/" Dockerfile > TemporaryDockerfile | ||
rm Dockerfile | ||
mv TemporaryDockerfile Dockerfile | ||
|
||
git add -A . | ||
git commit -m "Travis MetadataRegistry/ModelCataloguePlugin build $TRAVIS_BUILD_NUMBER pushed MetadataRegistry/registry" | ||
git tag "$TRAVIS_TAG" | ||
git push -fq origin 2.x > /dev/null | ||
git push -fq origin "$TRAVIS_TAG" > /dev/null | ||
|
||
echo "Metadata Registry notified of successful build" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
|
||
### | ||
# prints single command with it's description using the first line of the text file named same as the command | ||
# but having .txt extension. | ||
### | ||
function print_command() { | ||
local PADDING=' ' | ||
local FOLDER=$1 | ||
local COMMAND=$2 | ||
local DESC="(no description provided)" | ||
|
||
if [ -f "$FOLDER/$COMMAND.txt" ] ; then | ||
DESC=$(head -n 1 "$FOLDER/$COMMAND.txt") | ||
fi | ||
|
||
printf "%s %s %s\n" "$COMMAND" "${PADDING:${#COMMAND}}" "$DESC" | ||
} | ||
|
||
### | ||
# prints usage for folder listing all *.sh files and directories (except lib directory) | ||
# @param FOLDER folder to be listed | ||
### | ||
function print_usage_for_folder(){ | ||
local ORIGINAL_DIRECTORY=$(pwd) | ||
cd "$1" | ||
echo "Usage:" | ||
for f in * ; do | ||
if [ "$f" == "lib" ] ; then | ||
continue | ||
elif [ -d "$f" ]; then | ||
print_command $(pwd) "$f" | ||
elif [ "$f" == *.sh ]; then | ||
local COMMAND_NAME="${f/.sh/}" | ||
print_command $(pwd) "$COMMAND_NAME" | ||
fi | ||
done | ||
cd "$ORIGINAL_DIRECTORY" | ||
} | ||
|
||
### | ||
# delegates to scripts inside folder | ||
# @param FOLDER folder to be delegated to | ||
# @param COMMAND name of the script to be delegated to | ||
### | ||
function delegate_to_folder() { | ||
local FOLDER="$1" | ||
local SCRIPT="$2" | ||
local COMMAND="$FOLDER""/""$SCRIPT" | ||
|
||
shift 2 | ||
|
||
|
||
if [ -d "$COMMAND" ]; then | ||
delegate_to_folder "$COMMAND" "$@" | ||
elif [ -f "$COMMAND.sh" ]; then | ||
"$COMMAND.sh" "$@" | ||
else | ||
COMMAND=${COMMAND//bin\///} | ||
COMMAND=${COMMAND//\// } | ||
echo | ||
echo "Unknown command:$COMMAND" | ||
echo | ||
print_usage_for_folder "$FOLDER" | ||
echo | ||
exit 2 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests the command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "nested" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests the command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
source bin/lib/delegate.sh | ||
|
||
delegate_to_folder "bin" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters