Created
August 5, 2010 04:07
-
-
Save ryross/509213 to your computer and use it in GitHub Desktop.
kreate.sh
This file contains hidden or 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 | |
dir=$(pwd) | |
project='' | |
# Check for Git | |
type -P git || { echo 'Git is not installed. Exiting.'; exit 1; } | |
while [ "$1" != '' ] | |
do | |
case $1 in | |
-d | --dir ) | |
shift | |
dir=$1 | |
;; | |
-n | --name ) | |
shift | |
project=$1 | |
;; | |
-h | --help ) | |
echo 'usage: kreate [-d|–-dir] [-n|--name] [-h|--help]' | |
exit 0 | |
;; | |
esac | |
shift | |
done | |
# Project name is required | |
if [ "$project" = '' ] | |
then | |
# Get a project name | |
while [ -z "$project" ] | |
do | |
echo -n 'Please enter your project name> ' | |
read project | |
done | |
fi | |
# Move over into the directory | |
cd "$dir" | |
# Check for the project already | |
if [ -d $project ] | |
then | |
echo "$project already exists. Exiting." | |
exit 1 | |
else | |
mkdir "$project" && cd "$project" | |
# Initialize Git Repository | |
git init | |
# Make directories | |
mkdir -p public_html/{css,images,js} | |
mkdir -p application/classes/{controller,model} | |
mkdir -p application/{config,views} | |
mkdir -p application/views/{template,errors,main} | |
mkdir -m 0777 -p application/{cache,logs} | |
mkdir -m 0777 -p public_html/media | |
# Add ignore rule for .DS_Store files (only necessary on OS X) | |
echo ".DS_Store" > .gitignore | |
# Make ignore files for the cache and logs directories | |
echo '[^.]*' > application/{logs,cache}/.gitignore | |
# Add in Kohana modules | |
# Add git repos that you use across all projects below - | |
# This is just the core and database. | |
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/kohana/orm.git modules/orm | |
git submodule add git://github.com/ryross/minify.git modules/minify | |
git submodule init | |
git submodule update | |
# Add in the index.php, .htaccess and bootstrap.php files | |
curl -o public_html/index.php https://gist.github.com/raw/509256/2420931423a98b882cd2316886389c5435660d17/gistfile1.txt | |
curl -o public_html/.htaccess http://github.com/kohana/kohana/raw/master/example.htaccess | |
curl -o public_html/css/base.css https://gist.github.com/raw/509224/7bd93237d4e1b90f71914509b0bf911cefee4895/base.css | |
curl -o public_html/js/jquery-1.4.2.min.js http://code.jquery.com/jquery-1.4.2.min.js | |
touch public_html/css/master.css | |
curl -o application/bootstrap.php https://gist.github.com/raw/509268/03b052bd23a393c785b1535c1cb96a7b934a1a6b/bootstrap.php | |
curl -o application/views/template/template.php https://gist.github.com/raw/509218/0e1a51cb2253829cc8f60ca2376e3fd41aa07970/gistfile1.txt | |
curl -o application/views/template/header.php https://gist.github.com/raw/509281/5473d24c4cb8040da351ad3e69820957d9eb6e3a/header.php | |
curl -o application/views/template/footer.php https://gist.github.com/raw/509285/a92e3333e60a4fc88eda75d343d883ca5ffa2736/footer.php | |
curl -o application/views/main/index.php https://gist.github.com/raw/509260/7dfc4fba90aa69195d6c387e221e9fa3adb89763/index.php | |
curl -o application/views/errors/404.php https://gist.github.com/raw/509272/efa4cfa5adb7442e2dd7b2230f34063c2219ae07/404.php | |
curl -o application/views/errors/500.php https://gist.github.com/raw/509275/eefa8f4aaa46760838594dc51034eff86e3d7926/500.php | |
curl -o application/classes/controller/errors.php https://gist.github.com/raw/509271/f0830ab14c5e528cefc259450129878567db9bbb/errors.php | |
curl -o application/classes/controller/base.php https://gist.github.com/raw/509221/8b99d3608e6c6e019d14ffbb6c71e9a7439dc194/base.php | |
curl -o application/classes/controller/main.php https://gist.github.com/raw/509264/28af6126b5834762a68e3d6b5f16a571719e7061/main.php | |
git add . | |
git commit -m 'Initial Commit.' | |
# Send success message | |
echo "------------" | |
echo "$project created successfully!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment