Skip to content

Commit

Permalink
Initialize files before update process. Fixed some problems in instal…
Browse files Browse the repository at this point in the history
…l script
  • Loading branch information
Angel M de Miguel committed Oct 6, 2015
1 parent 3a8e88c commit d47c619
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# Script to install pm in your system! Only execute and see the magic ;)
#

FROM_UPDATE=false
FROM_UPDATE="no"

echo "Hello! I'm here to help you to install PM"

if [ -d ~/.pm ]; then
# Is installed!
Expand All @@ -13,7 +15,7 @@ if [ -d ~/.pm ]; then

if [ "$update" == "yes" ]; then
echo "Updating PM..."
FROM_UPDATE=true
FROM_UPDATE="yes"
else
exit 0
fi
Expand All @@ -26,14 +28,14 @@ case "$console" in
'zsh' )
# Create folder and download file
cd ~
if [[ ! FROM_UPDATE ]]; then
if [[ "$FROM_UPDATE" == "no" ]]; then
mkdir .pm
fi
wget --quiet https://raw.githubusercontent.com/Angelmmiguel/pm/master/zsh/pm.zsh
mv pm.zsh .pm

# Add the function to the console
if [[ ! FROM_UPDATE ]]; then
if [[ "$FROM_UPDATE" == "no" ]]; then
echo "" >> .zshrc
echo "# PM functions" >> .zshrc
echo "source ~/.pm/pm.zsh" >> .zshrc
Expand All @@ -46,7 +48,11 @@ case "$console" in
fi

# Done
echo "PM is updated! Please, restart your session."
if [[ "$FROM_UPDATE" == "yes" ]]; then
echo "PM is updated! Please, restart your session."
else
echo "PM is installed! Please, restart your session."
fi
;;

*)
Expand Down
4 changes: 2 additions & 2 deletions zsh/pm.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ pm () {
echo "$branch"
}

# Update process of project! :D
pm_update_process
# Initialize folders and file if isn't exists
pm_initialize
# Update process of project! :D
pm_update_process

# Check commands. Available commands are add|remove|go (go by default)
if [ $# -lt 1 ]; then
Expand Down

0 comments on commit d47c619

Please sign in to comment.