-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Development script * Fix suffix * Fix zsh comment * better handling * better handling * updating documentation * typo fix * workon not working solution * addinbg step 4 * final adjustments * fixing CHANGELOG.md * checking working dir * checking working dir * reverting config changes * checking for init * checking for init * trying to run update from Test * reverting config.yml changes * reverting config.yml changes * reverting config.yml changes Co-authored-by: rsagi <[email protected]>
- Loading branch information
Showing
4 changed files
with
106 additions
and
30 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
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,83 @@ | ||
#!/bin/zsh | ||
|
||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' # No Color | ||
VIRTUALENV_NAME="demisto-sdk-dev" | ||
|
||
# Get current working dir | ||
SDK_WORKDIR=`pwd` | ||
|
||
# Arguments handling | ||
if [[ $1 == "-h" ]]; then | ||
printf "This script creates environment for developing demisto-sdk, The following steps are done: | ||
1. Installing virtualenv-wrapper. | ||
2. Create virtualenv \"${VIRTUALENV_NAME}\". | ||
3. Installing in virtualenv demisto-sdk as editable version. | ||
Notes: | ||
1. This script requires python3 installed. | ||
2. For more information please see the Contribution guide. | ||
\n" | ||
exit 0 | ||
fi | ||
|
||
# Validate mandatoy executables for execution | ||
executables_exists=0 | ||
for executable in pyenv python3 git | ||
do | ||
if ! command -v $executable &> /dev/null | ||
then | ||
printf "${RED}$executable isn't installed, Please install $executable before using this script!${NC}\n" | ||
executables_exists=1 | ||
fi | ||
done | ||
|
||
if [[ executables_exists -eq 1 ]]; then | ||
exit 1 | ||
fi | ||
|
||
# Validate Pyenv configure correctly | ||
if [[ "*/.pyenv/*" = $(which python3) ]]; then | ||
printf "${RED}Python3 executable source isn't managed by pyenv, Please verify global var PATH configuration${NC}\n" | ||
exit 1 | ||
fi | ||
|
||
# Install pyenv-vritualenvwrapper | ||
printf "Installing pyenv-vritualenvwrapper\n" | ||
rm -rf $(pyenv root)/plugins/pyenv-virtualenvwrapper | ||
command git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper | ||
|
||
if [ $? -eq 0 ]; then | ||
printf "pyenv-virtualenvwrapper installed ${GREEN}succefully${NC}\n" | ||
else | ||
printf "${RED}pyenv-virtualenvwrapper can't installed using brew$\nAdditional error details:\n${output}${NC}" | ||
exit 1 | ||
fi | ||
|
||
# Init PATH variables | ||
if [[ $SHELL == *"bin/zsh"* ]]; then | ||
source ~/.zshrc | ||
elif [[ $SHELL == *"bin/bash"* ]]; then | ||
source ~/.bash_profile | ||
else | ||
printf "${RED}Currnltly only bash/zsh is supported as base shell.\n${output}${NC}" | ||
printf "${RED}Run 'export SHELL=/bin/zsh' or 'export SHELL=/bin/bash' and rerun the script.\n${output}${NC}" | ||
exit 1 | ||
fi | ||
|
||
# Initializing pyenv-vritualenvwrapper | ||
printf "Initiallizing pyenv-vritualenvwrapper\n" | ||
pyenv virtualenvwrapper | ||
echo pyenv virtualenvwrapper >> ~/.zshrc | ||
echo pyenv virtualenvwrapper >> ~/.bash_profile | ||
|
||
# Creating development enviorment | ||
rmvirtualenv ${VIRTUALENV_NAME} | ||
mkvirtualenv ${VIRTUALENV_NAME} | ||
|
||
pip3 install -e ${SDK_WORKDIR} | ||
|
||
# Summary log | ||
printf "\n\nDemisto-sdk virtual env setup finished succefully:\n 1. Restart your terminal.\n 2. In order to activate enviorment ${GREEN}workon ${VIRTUALENV_NAME}${NC}\n 3. Inorder to deactivate enviorment ${RED}deactivate${NC}\n" | ||
exit 0 |