Created
January 30, 2012 04:33
-
-
Save smgladkovskiy/1702555 to your computer and use it in GitHub Desktop.
Kohana 3.2 project creation script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run this in your command line to make the process begin: | |
$ curl -o ko3_structure.sh https://raw.github.com/gist/1702555/ko3_structure.sh && ./ko3_structure.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Kohana v3.2 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.2/master/index.php | |
curl -o $FILEPATH/install.php https://raw.github.com/kohana/kohana/3.2/master/install.php | |
curl -o $FILEPATH/.htaccess https://raw.github.com/kohana/kohana/3.2/master/example.htaccess | |
curl -o application/bootstrap.php https://raw.github.com/kohana/kohana/3.2/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/classes/kohana/exception.php https://raw.github.com/gist/831575/kohana_exception.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_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