Last active
August 14, 2018 10:44
-
-
Save markhatchell/1e6c1acd75b6150058fb to your computer and use it in GitHub Desktop.
CakePHP 3 & Bootstrap 3 install and setup 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
#!/bin/bash | |
# | |
# run this to download the new-cake installer script: | |
# curl -L "https://gist.githubusercontent.com/markhatchell/1e6c1acd75b6150058fb/raw/f295074747f2fd2f218b5df9a92b22a1cf96a518/new-cake" -onew-cake; chmod +x new-cake; | |
# | |
# useage: new-cake [project_name] | |
# | |
# | |
echo "updating composer" && \ | |
curl -sS https://getcomposer.org/installer | php | |
echo "creating CakePHP project"; | |
php composer.phar create-project cakephp/app $1; | |
cd $1; | |
chmod +x bin/cake; | |
echo "Adding general plugins in composer"; | |
../composer.phar require friendsofcake/crud 4.0; | |
../composer.phar require elboletaire/twbs-cake-plugin ~3.0; | |
../composer.phar require twbs/bootstrap ~3.0 | |
echo "Adding genreal plugins to bootstrap"; | |
echo "Plugin::load('Bootstrap');" >> config/bootstrap.php; | |
echo "Plugin::load('Less');" >> config/bootstrap.php; | |
echo "Plugin::load('BootstrapUI');" >> config/bootstrap.php; | |
echo "Adding plugin helpers to AppController"; | |
php -r '$d = file_get_contents("src/Controller/AppController.php"); $d=str_replace("class AppController extends Controller\n{","class AppController extends Controller\n{\n\n public \$helpers = [\n \"BootstrapUI.Form\",\n \"BootstrapUI.Html\",\n \"BootstrapUI.Flash\",\n \"BootstrapUI.Paginator\"\n ];",$d); file_put_contents("src/Controller/AppController.php",$d);'; | |
echo "setting up bootstrap"; | |
cd webroot/css; | |
ln -s ../../vendor/twbs/bootstrap/dist/css/ ./bootstrap; | |
ln -s ../../vendor/twbs/bootstrap/dist/fonts/ ./fonts; | |
curl "https://raw.githubusercontent.com/twbs/bootstrap/master/docs/assets/css/src/docs.css" -omain.css; | |
curl "https://raw.githubusercontent.com/twbs/bootstrap/master/docs/examples/theme/theme.css" -otheme.css; | |
rm cake.css; | |
rm base.css; | |
cd ../../; | |
cd webroot/js; | |
ln -s ../../vendor/twbs/bootstrap/dist/js/ ./bootstrap; | |
cd ../../; | |
cd src/Template/Pages/; | |
rm home.ctp; | |
curl "https://gist.githubusercontent.com/markhatchell/c13389dd90fa73613371/raw/932054eec35d83fd0f2766f93a67ccd98f37e15f/home.ctp" -ohome.ctp; | |
cd ../../../; | |
cd src/Template/Layout/; | |
rm default.ctp; | |
curl "https://gist.githubusercontent.com/markhatchell/c13389dd90fa73613371/raw/8257e2de466ea8553fb2838ab2e9e305449d572e/default.ctp" -odefault.ctp; | |
cd ../../../; | |
bin/cake server -H 127.0.0.1 -p 8080; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment