From 0377ebff81a530e76386d3cfeec0ce4f58aeee54 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 30 Mar 2021 21:18:49 +0200 Subject: [PATCH] travis2bash.sh configuragble config file - passing an argument to travis2bash.sh allows to use a custom config file instead of the default .travis.yml --- travis2bash.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/travis2bash.sh b/travis2bash.sh index f8f7ab9..258fe15 100755 --- a/travis2bash.sh +++ b/travis2bash.sh @@ -6,6 +6,7 @@ # Based on https://gist.github.com/pkuczynski/8665367 failure=0 +config_file=.travis.yml parse_yaml() { local yaml_file=$1 @@ -56,8 +57,12 @@ create_variables() { eval "$(parse_yaml "$yaml_file" "$prefix")" } -if [ ! -e .travis.yml ]; then - echo "No .travis.yml found, exiting" +if [ -n "$1" ]; then + config_file="$1" +fi + +if [ ! -e "$config_file" ]; then + echo "No $config_file found, exiting" exit 1 fi @@ -150,7 +155,7 @@ function python_run() { fi } -create_variables .travis.yml travis_ +create_variables "$config_file" travis_ rundir=$(pwd)