mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 06:20:08 +01:00
auto update of scripts/bootstrapit_update.sh
This commit is contained in:
parent
924fc77370
commit
78760f6324
1 changed files with 17 additions and 11 deletions
|
|
@ -9,20 +9,23 @@ BOOTSTRAPIT_GIT_PATH=/tmp/bootstrapit;
|
||||||
|
|
||||||
echo "Updating from $BOOTSTRAPIT_GIT_URL";
|
echo "Updating from $BOOTSTRAPIT_GIT_URL";
|
||||||
|
|
||||||
|
OLD_PWD="$PWD";
|
||||||
|
|
||||||
if [[ ! -e "$BOOTSTRAPIT_GIT_PATH" ]]; then
|
if [[ ! -e "$BOOTSTRAPIT_GIT_PATH" ]]; then
|
||||||
git clone "$BOOTSTRAPIT_GIT_URL" "$BOOTSTRAPIT_GIT_PATH";
|
git clone "$BOOTSTRAPIT_GIT_URL" "$BOOTSTRAPIT_GIT_PATH";
|
||||||
else
|
else
|
||||||
OLD_PWD="$PWD";
|
|
||||||
cd "$BOOTSTRAPIT_GIT_PATH";
|
cd "$BOOTSTRAPIT_GIT_PATH";
|
||||||
git pull --quiet;
|
git pull --quiet;
|
||||||
cd "$OLD_PWD";
|
cd "$OLD_PWD";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BOOTSTRAPIT_DEBUG=0
|
cd "$BOOTSTRAPIT_GIT_PATH";
|
||||||
|
git checkout "${BOOTSTRAPIT_DEV_BRANCH-master}";
|
||||||
|
git pull --quiet;
|
||||||
|
cd "$OLD_PWD";
|
||||||
|
|
||||||
if [[ $BOOTSTRAPIT_DEBUG == 0 ]]; then
|
if [[ ${BOOTSTRAPIT_DEBUG-0} == 0 ]]; then
|
||||||
if [[ -f "$PROJECT_DIR/.git/config" ]]; then
|
if [[ -f "$PROJECT_DIR/.git/config" ]]; then
|
||||||
OLD_PWD="$PWD"
|
|
||||||
cd "$PROJECT_DIR";
|
cd "$PROJECT_DIR";
|
||||||
if [[ $( git diff -s --exit-code || echo "$?" ) -gt 0 ]]; then
|
if [[ $( git diff -s --exit-code || echo "$?" ) -gt 0 ]]; then
|
||||||
echo "ABORTING!: Your repo has local changes which are not comitted."
|
echo "ABORTING!: Your repo has local changes which are not comitted."
|
||||||
|
|
@ -32,10 +35,10 @@ if [[ $BOOTSTRAPIT_DEBUG == 0 ]]; then
|
||||||
cd "$OLD_PWD";
|
cd "$OLD_PWD";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
md5sum=$(which md5sum || which md5)
|
md5cmd=$(command -v md5sum || command -v md5)
|
||||||
|
|
||||||
old_md5=$( cat "$PROJECT_DIR/scripts/bootstrapit_update.sh" | $md5sum );
|
old_md5=$( $md5cmd < "$PROJECT_DIR/scripts/bootstrapit_update.sh" );
|
||||||
new_md5=$( cat "$BOOTSTRAPIT_GIT_PATH/scripts/bootstrapit_update.sh" | $md5sum );
|
new_md5=$( $md5cmd < "$BOOTSTRAPIT_GIT_PATH/scripts/bootstrapit_update.sh" );
|
||||||
|
|
||||||
if [[ "$old_md5" != "$new_md5" ]]; then
|
if [[ "$old_md5" != "$new_md5" ]]; then
|
||||||
# Copy the updated file, run it and exit the current execution.
|
# Copy the updated file, run it and exit the current execution.
|
||||||
|
|
@ -95,7 +98,7 @@ done
|
||||||
|
|
||||||
set -- "${POSITIONAL[@]}" # restore positional parameters
|
set -- "${POSITIONAL[@]}" # restore positional parameters
|
||||||
|
|
||||||
if [[ -z $AUTHOR_EMAIL && ! -z $AUTHOR_CONTACT ]]; then
|
if [[ -z $AUTHOR_EMAIL && -n $AUTHOR_CONTACT ]]; then
|
||||||
AUTHOR_EMAIL="${AUTHOR_CONTACT}"
|
AUTHOR_EMAIL="${AUTHOR_CONTACT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -382,6 +385,7 @@ mkdir -p "${PROJECT_DIR}/stubs/";
|
||||||
mkdir -p "${PROJECT_DIR}/src/";
|
mkdir -p "${PROJECT_DIR}/src/";
|
||||||
mkdir -p "${PROJECT_DIR}/requirements/";
|
mkdir -p "${PROJECT_DIR}/requirements/";
|
||||||
mkdir -p "${PROJECT_DIR}/src/${MODULE_NAME}";
|
mkdir -p "${PROJECT_DIR}/src/${MODULE_NAME}";
|
||||||
|
mkdir -p "${PROJECT_DIR}/.github/workflows/";
|
||||||
|
|
||||||
copy_template .gitignore;
|
copy_template .gitignore;
|
||||||
copy_template README.md;
|
copy_template README.md;
|
||||||
|
|
@ -407,6 +411,8 @@ copy_template requirements/integration.txt;
|
||||||
copy_template requirements/vendor.txt;
|
copy_template requirements/vendor.txt;
|
||||||
|
|
||||||
copy_template .gitlab-ci.yml;
|
copy_template .gitlab-ci.yml;
|
||||||
|
copy_template .github/workflows/ci.yml;
|
||||||
|
|
||||||
copy_template scripts/update_conda_env_deps.sh;
|
copy_template scripts/update_conda_env_deps.sh;
|
||||||
copy_template scripts/setup_conda_envs.sh;
|
copy_template scripts/setup_conda_envs.sh;
|
||||||
copy_template scripts/pre-push-hook.sh;
|
copy_template scripts/pre-push-hook.sh;
|
||||||
|
|
@ -434,16 +440,16 @@ for src_file in $src_files; do
|
||||||
fi
|
fi
|
||||||
offset=0
|
offset=0
|
||||||
if grep -z -q -E '^#![/a-z ]+?python' "$src_file"; then
|
if grep -z -q -E '^#![/a-z ]+?python' "$src_file"; then
|
||||||
let offset+=1;
|
(( offset+=1 ));
|
||||||
fi
|
fi
|
||||||
if grep -q -E '^# .+?coding: [a-zA-Z0-9_\-]+' "$src_file"; then
|
if grep -q -E '^# .+?coding: [a-zA-Z0-9_\-]+' "$src_file"; then
|
||||||
let offset+=1;
|
(( offset+=1 ));
|
||||||
fi
|
fi
|
||||||
rm -f "${src_file}.with_header";
|
rm -f "${src_file}.with_header";
|
||||||
if [[ $offset -gt 0 ]]; then
|
if [[ $offset -gt 0 ]]; then
|
||||||
head -n $offset "${src_file}" > "${src_file}.with_header";
|
head -n $offset "${src_file}" > "${src_file}.with_header";
|
||||||
fi
|
fi
|
||||||
let offset+=1;
|
(( offset+=1 ));
|
||||||
cat /tmp/.py_license.header >> "${src_file}.with_header";
|
cat /tmp/.py_license.header >> "${src_file}.with_header";
|
||||||
tail -n +$offset "${src_file}" >> "${src_file}.with_header";
|
tail -n +$offset "${src_file}" >> "${src_file}.with_header";
|
||||||
mv "${src_file}.with_header" "$src_file";
|
mv "${src_file}.with_header" "$src_file";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue