Skip to content

Instantly share code, notes, and snippets.

@dkobia
Created January 25, 2012 14:31
Show Gist options
  • Save dkobia/1676525 to your computer and use it in GitHub Desktop.
Save dkobia/1676525 to your computer and use it in GitHub Desktop.
Swift setup on local
#!/bin/sh
############################################################
############################################################
#
# - In terminal make the script executable by typing:
#
# chmod a+x (yourscriptname)
#
# - Then in finder right-click your file and select
# "Open with" and then "Other...".
#
# - Here you select the application you want the file to execute into, in this case
# it would be Terminal. To be able to select terminal you need to switch from
# "Recommended Applications" to "All Applications".
#
# - NOTE that unless you don't want to associate all files with this extension to be
# run in terminal you should not have "Always Open With" checked. After clicking OK
# you should be able to execute you script by simply double-clicking it.
#
############################################################
############################################################
# SETTINGS
############################################################
# Location of your repo
REPO="/Users/david/repos/Swiftriver"
# Location of your Web/Localhost directory
WEB="/Users/david/LOCALHOST/Swiftriver"
# Database
DATABASE="swiftriver"
# Database username
USERNAME="root"
# Database password
PASSWORD="password"
# Preconfigured database.php file location
CONFIG="/Users/david/LOCALHOST/swiftriver_database.php"
############################################################
############################################################
# Syncs REPO with SwiftRiver on LOCALHOST
# !!!! Comment these two lines out if your git and localhost/web are the same !!!!
rm -rf $WEB/*
rsync -a --exclude ".git/" --exclude ".gitignore" --exclude ".DS_Store" $REPO/ $WEB/
mkdir $WEB/application/cache/
mkdir $WEB/application/logs/
chmod 0777 $WEB/application/cache/
chmod 0777 $WEB/application/logs/
# Wipe the Database
mysql5 -u$USERNAME -p$PASSWORD<<EOFMYSQL
DROP DATABASE IF EXISTS $DATABASE;
CREATE DATABASE IF NOT EXISTS $DATABASE;
EOFMYSQL
# Import Dump
mysql5 $DATABASE -u$USERNAME -p$PASSWORD < $WEB/install/sql/swiftriver.sql
# Copy over an updated database.php file
cp -f $CONFIG $WEB/application/config/database.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment