Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemorton committed Apr 12, 2011
1 parent 77557b2 commit 8d7a4d9
Showing 1 changed file with 65 additions and 29 deletions.
94 changes: 65 additions & 29 deletions newapp.sh
@@ -1,14 +1,28 @@
#!/bin/bash #!/bin/bash
# #
# Grab the Vitals # Kohana Application Installer
# --------------- # ----------------------------
#
# This is a small bash script for installing the core files for
# a Kohana application. Will install at the path specified a
# basic application structure, then initialises a git repository
# for your convenience. The core Kohana system files are added
# as a submodule and you are given the option to install
# Kostache because you just should!
# #
# You will need installed: # Requirements:
# #
# * git # * git
# * apache
# * php 5.2+
# #
# Usage:
#
# sh koapp.sh /var/www/my-new-app
# git submodule add https://github.com/kohana/database.git modules/database
# git submodule add https://github.com/kohana/orm.git modules/orm
# git submodule add https://github.com/kohana/userguide.git modules/userguide
# git add .
# git commit -m "Added database, orm and userguide modules"
#


# Default # Default
DEFAULT_APP_PATH="$HOME/koapp" DEFAULT_APP_PATH="$HOME/koapp"
Expand Down Expand Up @@ -46,33 +60,55 @@ cd $APP_NAME


# Create application folders with correct perms # Create application folders with correct perms
echo "Creating application folders..." echo "Creating application folders..."
mkdir {application,modules} mkdir -p {application,modules}
mkdir application/{classes,public,cache,logs} mkdir -p application/{classes,public,cache,logs}
chmod 0777 application/cache application/logs


# Init repo echo "Ensuring 777 permissions on application/log and application/cache..."
echo "Initialising application folder as git repo..." chmod 0777 application/{cache,logs}
git init > /dev/null


# Grab bootstrap and index if [ -d ".git" ];
echo "Getting bootstrap.php and index.php..." then
wget https://github.com/kohana/kohana/raw/3.1/master/application/bootstrap.php --output-file=application/bootstrap.php # Already a git repo
wget https://github.com/kohana/kohana/raw/3.1/master/index.php --output-file=application/public/index.php echo "Application path is already a git repo..."
else
# Init repo
echo "Initialising application folder as git repo..."
git init > /dev/null
fi

if [ ! -f "application/bootstrap.php" ];
then
# Grab bootstrap and index
echo "Getting bootstrap.php..."
wget https://github.com/kohana/kohana/raw/3.1/master/application/bootstrap.php --output-file=application/bootstrap.php
fi


# Get system files if [ ! -f "application/public/index.php" ];
echo "Cloning Kohana Core into system..." then
git submodule add https://github.com/kohana/core.git system > /dev/null 2>&1 echo "Getting index.php..."
wget https://github.com/kohana/kohana/raw/3.1/master/index.php --output-file=application/public/index.php
fi


# Install Kostache? if [ ! -d "system" ];
echo "Would you like to install Kostache (y/n)?" then
read KOSTACHE # Get system files
echo "Cloning Kohana Core into system..."
git submodule add https://github.com/kohana/core.git system > /dev/null 2>&1
fi


if [ "$KOSTACHE" == "y" ]; if [ ! -d "modules/kostache" ];
then then
# Install Kostache # Install Kostache?
echo "Cloning zombor's Kostache into system..." echo "Would you like to install Kostache (y/n)?"
git submodule add https://github.com/zombor/KOstache.git modules/kostache > /dev/null 2>&1 read KOSTACHE
mkdir application/templates
if [ "$KOSTACHE" == "y" ];
then
# Install Kostache
echo "Cloning zombor's Kostache into system..."
git submodule add https://github.com/zombor/KOstache.git modules/kostache > /dev/null 2>&1
mkdir application/templates
fi
fi fi


# Ensure submodules initialised # Ensure submodules initialised
Expand All @@ -82,6 +118,6 @@ git submodule update --init > /dev/null
# Commit changes # Commit changes
echo "Commiting original sin...." echo "Commiting original sin...."
git add . > /dev/null git add . > /dev/null
git commit -m "My base Kohana setup for $APP_NAME" > /dev/null git commit -m "Kohana Application Installer run for $APP_NAME" > /dev/null


echo "Done." echo "Done."

0 comments on commit 8d7a4d9

Please sign in to comment.