Skip to content

Instantly share code, notes, and snippets.

@agustinhaller
Created June 11, 2014 19:23
Show Gist options
  • Select an option

  • Save agustinhaller/a12c984574834ac8200d to your computer and use it in GitHub Desktop.

Select an option

Save agustinhaller/a12c984574834ac8200d to your computer and use it in GitHub Desktop.
falcon site creator
#!/bin/bash
BASE_REPOS_PATH=/Users/agustinhaller/repos
DEVELOPMENT_PREFIX=dev
HOSTS_PATH=/etc/hosts
APACHE_CONF_PATH=/private/etc/apache2/other
echo "creating local domain development ... $DEVELOPMENT_PREFIX.$1"
#CREATE DIRECTORY AND GIVE PERMISSIONS
sudo mkdir $BASE_REPOS_PATH/$1
sudo chmod 777 $BASE_REPOS_PATH/$1
echo "Folder created!"
#ADD LINES TO /ETC/HOSTS
sudo echo '' >> $HOSTS_PATH
sudo echo '' >> $HOSTS_PATH
sudo echo 127.0.0.1' '$DEVELOPMENT_PREFIX.$1 >> $HOSTS_PATH
echo "Host files modified!"
#CREATE APACHE CONFIG FILE
sudo echo AccessFileName .htaccess.dev .htaccess > $APACHE_CONF_PATH/$1.conf
sudo echo \<virtualhost $DEVELOPMENT_PREFIX.$1:80\> >> $APACHE_CONF_PATH/$1.conf
sudo echo ServerName $DEVELOPMENT_PREFIX.$1 >> $APACHE_CONF_PATH/$1.conf
sudo echo SetEnv DEV_ENV true >> $APACHE_CONF_PATH/$1.conf
sudo echo ServerAlias $DEVELOPMENT_PREFIX.$1 >> $APACHE_CONF_PATH/$1.conf
sudo echo DocumentRoot \"$BASE_REPOS_PATH/$1/\" >> $APACHE_CONF_PATH/$1.conf
sudo echo \<Directory \"$BASE_REPOS_PATH/$1/\"\> >> $APACHE_CONF_PATH/$1.conf
sudo echo Options Indexes FollowSymLinks >> $APACHE_CONF_PATH/$1.conf
sudo echo AllowOverride All >> $APACHE_CONF_PATH/$1.conf
sudo echo Order allow,deny >> $APACHE_CONF_PATH/$1.conf
sudo echo Allow from all >> $APACHE_CONF_PATH/$1.conf
sudo echo \</Directory\> >> $APACHE_CONF_PATH/$1.conf
sudo echo \</virtualhost\> >> $APACHE_CONF_PATH/$1.conf
echo "apache config file created!"
#CLONE FalconPHP
cd $BASE_REPOS_PATH/$1
# The dot at the end of the command if for clonning just the content without the folder itself
git clone https://agustinhaller@bitbucket.org/agustinhaller/falconphp.git .
curl -sS https://getcomposer.org/installer | php
php composer.phar install
echo "FalconPHP cloned"
#RESTART APACHE
echo "restarting apache..."
sudo apachectl restart
echo "opening new site in the browser..."
/usr/bin/open -a "/Applications/Google Chrome.app" http://$DEVELOPMENT_PREFIX.$1/
echo "all done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment