Skip to content

Instantly share code, notes, and snippets.

@smgladkovskiy
Last active October 4, 2015 13:27
Show Gist options
  • Save smgladkovskiy/2643818 to your computer and use it in GitHub Desktop.
Save smgladkovskiy/2643818 to your computer and use it in GitHub Desktop.
Kohana 3.3 project creation script

Run this in your command line to make the process begin:

$ curl -o ko3.3_structure.sh https://raw.github.com/gist/2643818/ko3.3_structure.sh && ./ko3.3_structure.sh
#!/bin/bash
# Kohana v3.3 project structure creation script
# Initiating git repo if it not exist yet
if [ ! -d "./.git" ]; then
git init
fi
# Structure creation
FILEPATH='htdocs'
read -p "Enter path to your webserver homedir [Enter to default./htdocs]: " USER_FILEPATH
if [ -n "${USER_FILEPATH}" ]; then
FILEPATH=$USER_FILEPATH
fi
echo ' '
echo "Webserver homedir is $FILEPATH"
echo ' '
echo 'ok, lets get it on...'
echo ' '
mkdir -p $FILEPATH/{css,i,js,media}
mkdir -p application/classes/{Controller,Model,Kohana}
mkdir -p application/classes/Controller/Ajax
mkdir -p application/{config,views}
mkdir -m 0777 -p application/{cache,logs}
# Getting all main project files from github (bootstrap, index, install, template)
curl -o $FILEPATH/index.php https://raw.github.com/kohana/kohana/3.3/master/index.php
curl -o $FILEPATH/install.php https://raw.github.com/kohana/kohana/3.3/master/install.php
#curl -o $FILEPATH/.htaccess https://raw.github.com/kohana/kohana/3.3/master/example.htaccess
curl -o application/bootstrap.php https://raw.github.com/kohana/kohana/3.3/master/application/bootstrap.php
# And some bonuses
curl -o application/Classes/Controller/Template.php https://raw.github.com/gist/832462/Controller_Template.php
curl -o application/Classes/Controller/Ajax/Template.php https://raw.github.com/gist/832411/Controller_Ajax_Template.php
curl -o application/config/site.php https://gist.github.com/smgladkovskiy/6205175/raw/site.php
curl -o .gitignore https://raw.github.com/gist/1064361/.gitignore
# Adding and initiating submodules
git submodule add git://github.com/kohana/core.git system
git submodule add git://github.com/kohana/database.git modules/database
git submodule add git://github.com/creatoro/jelly.git modules/jelly
git submodule init
# Preserve empty folders
touch $FILEPATH/{css,i,js,media}/.stub
touch application/{cache,logs,config,views}/.stub
touch application/Classes/Model/.stub
# Adding all stuff to git and deleting not nessesary files
git add .
git rm --cache ./ko3.3_structure.sh
# That's it - we done!
echo "------------"
echo "project structure created successfully!"
echo "git commit required"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment