Skip to content

Instantly share code, notes, and snippets.

@vaclavbohac
Created May 4, 2010 11:48
Show Gist options
  • Save vaclavbohac/389311 to your computer and use it in GitHub Desktop.
Save vaclavbohac/389311 to your computer and use it in GitHub Desktop.
Nette skeleton
#!/bin/bash
# Vaclav Bohac (c) 2010
SCAFDIR=$HOME/repo/nette-scaffolding
if [ "$1" = "create" ]; then
shift
if [ ! -n "$1" ]; then
echo "You must specify a project name"
echo "Usage:"
echo "nf.sh create project-name [options]"
exit 1
fi
echo "Nette Framework Scaffolding will create a new project."
mkdir "$1"
cd "$1"
shift
skeleton-latest.sh $*
exit
fi
php "$SCAFDIR/scaffolding.php" $*
#!/bin/bash
# Vaclav Bohac (c) 2010
actdir=$(pwd)
nette="$HOME/repo/nette-framework-dev"
dibi="$HOME/repo/dibi-dev"
ormion="$HOME/repo/ormion-dev"
FLAG_DISABLE_GIT=false
FLAG_DISABLE_ORM=false
FLAG_DISABLE_DIBI=false
# @param path to Nette framework source directory
# @param path to project
function copy_nette
{
echo -ne "."
cp -R $1/skeleton/* $2
echo -ne "."
cp -R $1/Nette $2/libs/
chmod o+w $2/app/temp
}
# @param path to Dibi source directory
# @param path to project
function copy_dibi
{
echo -ne "."
cp -R $1/dibi $2/libs/
}
# @param path to Ormion source directory
# @param path to project
function copy_orm
{
echo -ne "."
cp -R $1/libs/Ormion $2/libs/
}
while [ -n "$1" ]; do
case "$1" in
--no-git)
FLAG_DISABLE_GIT=true
;;
--no-orm)
FLAG_DISABLE_ORM=true
;;
--no-dibi)
FLAG_DISABLE_DIBI=true
;;
*)
echo "Unknown parameter $1"
echo "Params:"
echo " --no-git - disable git initialization of git repository"
echo " --no-orm - do not copy an Ormion library"
echo " --no-dibi - do not copy a dibi library"
exit 1
;;
esac
shift
done
if which pull-nette.sh > /dev/null; then
echo "Updating Nette Framework"
pull-nette.sh
else
echo "Could not update nette repository."
fi
if which pull-dibi.sh > /dev/null && [ $FLAG_DISABLE_DIBI = false ]; then
echo "Updating dibi"
pull-dibi.sh
fi
echo -ne "Copying project files"
copy_nette $nette $actdir
if [ $FLAG_DISABLE_DIBI = false ]; then
copy_dibi $dibi $actdir
fi
if [ $FLAG_DISABLE_ORM = false ]; then
copy_orm $ormion $actdir
fi
echo ""
if [ $FLAG_DISABLE_GIT = false ]; then
echo "Creating a git repository"
cd $actdir && git init
fi
echo -e "\e[0;32mProject successfully created.\e[0m Have fun."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment