Bash setup script


#1

Just for the hell of it, I wrote a bash script to help automate getting a new app started.
Gist is here

Usage:
$ create_slim_app.sh [my-project-name]

For simplicity,
$ chmod +x create_app.sh

As a personal preference, I’d stick it in my home dir and then from my work/projects/whatever directory, just run
$ ~/create_slim_app.sh [my-project-name]

It will:

  • require unique app name (the directory under pwd)
  • make sure you have php-cli binary
  • handle installing a local composer (for this app) or allow you to use a globally (system-wide) installed composer
  • allow selecting a clean app install (slim/slim) or the skeleton app (slim/slim-skeleton)
  • detect apache and offer to install the basic .htaccess and display a basic vhost config you can use
  • detect nginx and offer to display a basic vhost config you can use
  • offer to det permissions - files to 664, dirs to 755, logs/ to 777
  • offer to git-ify init the project - git init, create .gitignore, add/initial commit

Tested on Ubuntu 17.10, ymmv, but nothing too crazy going on here…