Skip to content

Instantly share code, notes, and snippets.

@okonomi
Created May 16, 2009 08:29
Show Gist options
  • Save okonomi/112624 to your computer and use it in GitHub Desktop.
Save okonomi/112624 to your computer and use it in GitHub Desktop.
#!/bin/sh
# create project
mkdir $1
ethna add-project -b $1 site
# move directory
mv $1/site $1/project
mv $1/project/www/* $1/
rm -r $1/project/www
# access protect
cat > $1/project/.htaccess <<EOF
order deny,allow
deny from all
EOF
# modify entry point
sed -e "s/require_once.*/require_once dirname(__FILE__).'\/project\/app\/Site_Controller.php';/" $1/index.php > $1/index.php.tmp
mv $1/index.php.tmp $1/index.php
sed -e "s/require_once.*/require_once dirname(__FILE__).'\/project\/app\/Site_Controller.php';/" $1/info.php > $1/info.php.tmp
mv $1/info.php.tmp $1/info.php
sed -e "s/require_once.*/require_once dirname(__FILE__).'\/project\/app\/Site_Controller.php';/" $1/unittest.php > $1/unittest.php.tmp
mv $1/unittest.php.tmp $1/unittest.php
sed -e "s/require_once.*/require_once dirname(__FILE__).'\/project\/app\/Site_Controller.php';/" $1/xmlrpc.php > $1/xmlrpc.php.tmp
mv $1/xmlrpc.php.tmp $1/xmlrpc.php
cd $1/project
# modify pear-local configuration
ethna pear-local version
ethna pear-local config-set bin_dir bin
ethna pear-local config-set doc_dir lib/.pear/doc
ethna pear-local config-set ext_dir lib/.pear/ext
ethna pear-local config-set php_dir lib
ethna pear-local config-set cache_dir tmp/.pear/cache
ethna pear-local config-set data_dir lib/.pear/data
ethna pear-local config-set download_dir tmp/.pear/download
ethna pear-local config-set temp_dir tmp/.pear/temp
ethna pear-local config-set test_dir lib/.pear/test
# add install required pear library
ethna pear-local channel-update pear.php.net
ethna pear-local channel-discover pear.ethna.jp
ethna pear-local install -a pear
ethna pear-local install -a ethna/ethna
# modify application require path
sed -e "s/ \. PATH_SEPARATOR \. ini_get('include_path')//" app/Site_Controller.php > app/Site_Controller.php.tmp
mv app/Site_Controller.php.tmp app/Site_Controller.php
# display result
bin/ethna --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment