From ac89097db3b2531a1cbe4212417d38a774df3123 Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Tue, 30 May 2017 09:57:39 +0200 Subject: [PATCH] Update automation scripts --- cordova | 2 +- scripts/add-lesspass-pure.sh | 44 ++++++++++++++----------------------- scripts/build-lesspass-pure.sh | 8 +++++-- scripts/check-status.sh | 34 ++++++++++++++++++++++++++++ scripts/release-webextensions.sh | 7 ++++-- scripts/zip-src-for-webextension.sh | 4 +++- webextension | 2 +- 7 files changed, 67 insertions(+), 34 deletions(-) create mode 100755 scripts/check-status.sh diff --git a/cordova b/cordova index f0477e9..8469e3a 160000 --- a/cordova +++ b/cordova @@ -1 +1 @@ -Subproject commit f0477e9c0d79099e3e8a5a4c444a140fa3c3264e +Subproject commit 8469e3ae4b22fe908386662775e6a21007954a12 diff --git a/scripts/add-lesspass-pure.sh b/scripts/add-lesspass-pure.sh index b4081a2..6dab034 100755 --- a/scripts/add-lesspass-pure.sh +++ b/scripts/add-lesspass-pure.sh @@ -1,45 +1,35 @@ #!/usr/bin/env bash -function no_uncommitted_changes { - if [ -n "$(git status --porcelain)" ]; then - echo "There is changes not staged here, skipping this repo..."; - return 1 - else - return 0 - fi -} +# context verification +if [ ! -f readme.md ]; then + echo "You seems to be in the wrong directory" + echo "Execute this script from the root of LessPass with ./scripts/${0##*/}" + exit 1 +fi +bash ./scripts/check-status.sh +if [ "$?" == "1" ];then exit 1;fi +# verification completed + function commit-with-message { git add . git commit -m 'Adding the lastest version of lesspass-pure' - git status git push --tags origin master } function cmd { - echo - echo "------------------------------------------------" - pwd - echo "------------------------------------------------" - if no_uncommitted_changes; then - npm install --save lesspass-pure - npm run build - commit-with-message - fi + cd $1 + npm install --save lesspass-pure + npm run build + commit-with-message + cd .. } -if [ ! -f readme.md ]; then - echo "You seems to be in the wrong directory" - echo "Execute this script from the root of lesspass with ./scripts/add-lesspass-pure.sh" - exit 1 -fi - submodules="cordova cozy desktop frontend webextension" for submodule in ${submodules} do - cd $submodule - cmd - cd .. + cmd $submodule & done +wait commit-with-message \ No newline at end of file diff --git a/scripts/build-lesspass-pure.sh b/scripts/build-lesspass-pure.sh index 2e163bc..24c9ced 100755 --- a/scripts/build-lesspass-pure.sh +++ b/scripts/build-lesspass-pure.sh @@ -1,17 +1,21 @@ #!/usr/bin/env bash +# context verification if [ ! -f readme.md ]; then echo "You seems to be in the wrong directory" - echo "Execute this script from the root of lesspass with ./scripts/build-lesspass-pure.sh" + echo "Execute this script from the root of LessPass with ./scripts/${0##*/}" exit 1 fi - if [ -z $1 ]; then echo "Oops, you need to set a version in major.minor.patch" echo "Example:" echo "$0 patch" exit 1 fi +bash ./scripts/check-status.sh +if [ "$?" == "1" ];then exit 1;fi +# verification completed + cd pure npm version $1 diff --git a/scripts/check-status.sh b/scripts/check-status.sh new file mode 100755 index 0000000..ad2fe0f --- /dev/null +++ b/scripts/check-status.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +RED='\033[0;31m' +NOCOLOR='\033[0m' + +function check { + cd $1 + git fetch origin + if [[ `git rev-parse master` != `git rev-parse origin/master` ]]; then + echo -e "${RED}$1 git repository is not clean${NOCOLOR}" + exit 1 + fi + cd .. +} + +echo "Check LessPass Repositories Statuses" + +submodules="backend cli cordova core cozy desktop frontend move nginx pure snap webextension" +for submodule in ${submodules} +do + check $submodule & +done + +FAIL=0 +for job in `jobs -p` +do + wait $job || let "FAIL+=1" +done + +if [ "$FAIL" != "0" ]; +then + echo "One or more repositories are not clean, exiting..." + exit 1 +fi \ No newline at end of file diff --git a/scripts/release-webextensions.sh b/scripts/release-webextensions.sh index a48f283..be84c76 100755 --- a/scripts/release-webextensions.sh +++ b/scripts/release-webextensions.sh @@ -1,17 +1,20 @@ #!/usr/bin/env bash +# context verification if [ ! -f readme.md ]; then echo "You seems to be in the wrong directory" - echo "Execute this script from the root of lesspass with ./scripts/release-webextensions.sh" + echo "Execute this script from the root of LessPass with ./scripts/${0##*/}" exit 1 fi - if [ -z $1 ]; then echo "Oops, you need to set a version in major.minor.patch" echo "Example:" echo "$0 patch" exit 1 fi +bash ./scripts/check-status.sh +if [ "$?" == "1" ];then exit 1;fi +# verification completed cd webextension npm version $1 diff --git a/scripts/zip-src-for-webextension.sh b/scripts/zip-src-for-webextension.sh index 6dbb0ee..6b99733 100755 --- a/scripts/zip-src-for-webextension.sh +++ b/scripts/zip-src-for-webextension.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash +# context verification if [ ! -f readme.md ]; then echo "You seems to be in the wrong directory" - echo "Execute this script from the root of lesspass with ./scripts/zip-src-for-webextension.sh" + echo "Execute this script from the root of LessPass with ./scripts/${0##*/}" exit 1 fi +# verification completed CWD="$(pwd)" cd webextension diff --git a/webextension b/webextension index c55cbfa..a0af1d3 160000 --- a/webextension +++ b/webextension @@ -1 +1 @@ -Subproject commit c55cbfaa302bc87cff8858f78faa3b89659b825a +Subproject commit a0af1d3856967fe8e720cbd3be252cd553e70924