Repository: climate
Updated Branches:
  refs/heads/master be6a84337 -> 0630c5083


CLIMATE-561 Prompts the user for a destination directory to install the ocw 
virtaulenv this closes #269


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/0630c508
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/0630c508
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/0630c508

Branch: refs/heads/master
Commit: 0630c5083af938b7b0ca2930323d3db94c467b53
Parents: be6a843
Author: Omkar20895 <[email protected]>
Authored: Sat Dec 12 15:00:16 2015 +0530
Committer: Lewis John McGibbney <[email protected]>
Committed: Thu Dec 17 18:04:32 2015 -0800

----------------------------------------------------------------------
 easy-ocw/install-osx.sh | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/0630c508/easy-ocw/install-osx.sh
----------------------------------------------------------------------
diff --git a/easy-ocw/install-osx.sh b/easy-ocw/install-osx.sh
index 9720d04..cace463 100755
--- a/easy-ocw/install-osx.sh
+++ b/easy-ocw/install-osx.sh
@@ -95,17 +95,16 @@ ENDINTRO
 
 if [ $WITH_VIRTUAL_ENV != 1 ]; then
 cat << VIRTUALENV_WARNING
-$(tput setaf 
1)<-----------------------------[WARNING!]-----------------------------------> 
+$(tput setaf 
1)<-----------------------------[WARNING!]----------------------------------->$(tput
 sgr 0)
 It is highly recommended that you allow Easy OCW to install the dependencies
 into a virtualenv environment to ensure that your global Python install is
 not affected. If you're UNSURE, you should pass the -e flag
 to this script. If you aren't concerned, or you want to create your own
-virtualenv environment, then feel free to ignore this message.$(tput setaf 0)
+virtualenv environment, then feel free to ignore this message.
 
 VIRTUALENV_WARNING
-fi
 
-read -p "Press [Yy] to begin installation with the flag -e $(tput setaf 
2)[RECOMMENDED]$(tput setaf 0)
+read -p "Press [Yy] to begin installation with the flag -e $(tput setaf 
2)[RECOMMENDED]$(tput sgr 0)
 [OR] 
 Press [Nn] to continue with the normal installation..." yn
 case $yn in 
@@ -118,6 +117,7 @@ case $yn in
     * ) echo "Please answer yes or no.." ;;
 esac
 fi
+fi
 
 header "Checking for pip ..."
 command -v pip >/dev/null 2>&1 || { 
@@ -144,17 +144,27 @@ if [ $WITH_VIRTUAL_ENV == 1 ]; then
         subtask "done"
     }
 
+    #Read the path for installation from the user.
+    read -e -p "Enter the path where you want to install ocw..." ocw_path
+    #check if the file path exists.
+    while [ ! -d "$ocw_path" ];
+    do 
+        echo "Path not found..."
+        read -e -p "Please enter a valid path..." ocw_path
+    done
+
     header "Checking for previously installed  ocw virtual environment..."
-    if [ -e ~/ocw/bin/python ]; then
-        echo "We found an existing 'ocw' virtualenv on your system in ~/ocw."
+    if [ -e $ocw_path/ocw/bin/python ]; then
+        echo "We found an existing 'ocw' virtualenv on your system in 
$ocw_path/ocw."
         read -n1 -p "Do you want to replace it with a clean install? y/n :" 
replace 
         if [ "$replace" == "y" ]; then
             echo ""
-            echo "WARNING this will delete all file and data in ~/ocw on your 
system."
-            read  -p "To confirm and proceed type YES or ENTER to quit:" 
confirm
-            if [ "$confirm" == "YES" ]; then
-                echo "Deleting contents of ~/ocw" >> install_log
-                rm -rf ~/ocw
+            echo "$(tput setaf 1)[WARNING!] this will delete all file and data 
in $ocw_path/ocw on your system.$(tput sgr 0)"
+            read -n1 -p "To confirm and proceed type y or n to quit:" confirm
+            if [ "$confirm" == "y" ]; then
+                echo ""
+                echo "Deleting contents of $ocw_path/ocw" >> install_log
+                rm -rf $ocw_path/ocw
             else
                 echo ""
                 echo "Stopping Open Climate Workbench Installation"
@@ -168,11 +178,11 @@ if [ $WITH_VIRTUAL_ENV == 1 ]; then
         fi
     fi
 
+    cd $ocw_path
     # Create a new environment for OCW work
     task "Creating a new environment in ~/ocw..."
-    cd ~
     virtualenv ocw >> install_log
-    source ~/ocw/bin/activate >> install_log
+    source $ocw_path/ocw/bin/activate >> install_log
     cd $INIT_PWD
     subtask "done"
 fi
@@ -203,7 +213,7 @@ alias below.
 To make it easier to change into the 'ocw' virtualenv add the
 following alias to your ~/.bash_profile
 
-    alias ocw='source ~/ocw/bin/activate ~/ocw/'
+    alias ocw='source $ocw_path/ocw/bin/activate ~/ocw/'
 
 When you want to use ocw in the future, you just have to type 'ocw'
 in your terminal."

Reply via email to