From a7cbe7c9dcab218e626332d2ca34da228524220d Mon Sep 17 00:00:00 2001 From: Timothy Lebo <timrdf@gmail.com> Date: Tue, 17 Jan 2012 20:30:19 -0500 Subject: [PATCH] cleaned up linker --- utils/link-components.sh | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/utils/link-components.sh b/utils/link-components.sh index ba594c9f..c75026a6 100755 --- a/utils/link-components.sh +++ b/utils/link-components.sh @@ -1,43 +1,43 @@ #!/bin/bash # -# Script to borrow essential bits from another lodspeakr. +# Script to borrow essential bits ;rom another lodspeakr instance on local machine. # Desired when lodspeakr essentials are maintained in a project-specfic repository. # Contributed by Tim Lebo when trying to apply lodspeakr for DataFAQs. +# +# Usage: +# bash-3.2$ pwd +# /Applications/XAMPP/htdocs/hello/lodspeakr +# +# bash-3.2$ sudo rm -rf .htaccess settings.inc.php models views +# +# bash-3.2$ sudo /Users/lebo/projects/lodspeakr/github/lodspeakr/utils/link-components.sh /Users/lebo/projects/DataFAQs/github/DataFAQs/ui/configure-epoch/lodspeakr +# ln -s /Users/lebo/projects/DataFAQs/github/DataFAQs/ui/configure-epoch/lodspeakr/settings.inc.php settings.inc.php +# ln -s /Users/lebo/projects/DataFAQs/github/DataFAQs/ui/configure-epoch/lodspeakr/.htaccess .htaccess +# ln -s /Users/lebo/projects/DataFAQs/github/DataFAQs/ui/configure-epoch/lodspeakr/models models +# ln -s /Users/lebo/projects/DataFAQs/github/DataFAQs/ui/configure-epoch/lodspeakr/views views +# +# bash-3.2$ sudo /Users/lebo/projects/lodspeakr/github/lodspeakr/utils/link-components.sh /Users/lebo/projects/DataFAQs/github/DataFAQs/ui/configure-epoch/lodspeakr +# WARNING: not linking settings.inc.php because it exists. +# WARNING: not linking .htaccess because it exists. +# WARNING: not linking models because it exists. +# WARNING: not linking views because it exists. if [ $# -lt 1 ]; then echo "usage: `basename $0` other-lodspeakr-directory" exit 1 fi -if [ ! -d $otherDir ]; then +otherDir="$1" +if [[ ! -d $otherDir && "$otherDir" != "/" ]]; then echo "$otherDir does not exist." exit 1 fi -if [[ ! -e settings.inc.php && -e $otherDir/settings.inc.php ]]; then - echo ln -s $otherDir/settings.inc.phpl settings.inc.php - ln -s $otherDir/settings.inc.phpl settings.inc.php -else - echo "WARNING: not linking settings.inc.phpl because it exists." -fi - -if [[ ! -e .htaccess && -e $otherDir/.htaccess ]]; then - echo ln -s $otherDir/models models - ln -s $otherDir/models models -else - echo "WARNING: not linking models/ because it exists." -fi - -if [[ ! -e models && -e $otherDir/models ]]; then - echo ln -s $otherDir/models models - ln -s $otherDir/models models -else - echo "WARNING: not linking models/ because it exists." -fi - -if [[ ! -e views && -e $otherDir/views ]]; then - echo ln -s $otherDir/views views - ln -s $otherDir/views views -else - echo "WARNING: not linking views/ because it exists." -fi +for essential in settings.inc.php .htaccess models views; do + if [[ ! -e $essential && -e $otherDir/$essential ]]; then + echo ln -s $otherDir/$essential $essential + ln -s $otherDir/$essential + else + echo "WARNING: not linking $essential because it exists." + fi +done -- GitLab