From 9d58ce55721aa68de307fd0c7749aa6d2b8c3a50 Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Fri, 26 Oct 2012 17:55:57 +0400 Subject: [PATCH] Bootstrap: Apache and PHP configuration. Some refactoring. --- setup/Readme.md | 14 +++++--------- setup/bootstrap.sh | 3 +-- setup/npm.sh | 10 ---------- setup/{brew.sh => stuff.sh} | 23 +++++++++++++++++++++-- 4 files changed, 27 insertions(+), 23 deletions(-) delete mode 100644 setup/npm.sh rename setup/{brew.sh => stuff.sh} (51%) diff --git a/setup/Readme.md b/setup/Readme.md index 896dc9b..9465a3b 100644 --- a/setup/Readme.md +++ b/setup/Readme.md @@ -12,25 +12,21 @@ Run `./bootstrap.sh` (or separate scripts in this folder) and make you some coff ## Scripts -### brew +### stuff -Installs Homebrew with some formulaes (Git, MySQL, Node.js, etc.). - -### npm - -Installs some NPM modules (JSHint, Grunt, etc.). Depends on `brew`. +Installs Homebrew, Git, [git-extras](https://github.com/visionmedia/git-extras), [git-friendly](https://github.com/jamiew/git-friendly), Node.js, JSHint, Grunt, configures Apache, PHP, MySQL, etc. ### bash -Installs Bash 4 and registers it as a default shell. Depends on `brew`. +Installs Bash 4 and registers it as a default shell. Needs Homebrew. ### consolas -Installs Consolas font. Depends on `brew`. +Installs Consolas font. Needs Homebrew. ### imgo -Installs [imgo](https://github.com/imgo/imgo) CLI image optimizer. Depends on `brew`. +Installs [imgo](https://github.com/imgo/imgo) CLI image optimizer. Needs Homebrew. ### osx diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 24a508a..35506b3 100755 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -2,8 +2,7 @@ # New Mac bootstrap -. brew.sh -. npm.sh +. stuff.sh . bash.sh . consolas.sh . imgo.sh diff --git a/setup/npm.sh b/setup/npm.sh deleted file mode 100644 index 2c47025..0000000 --- a/setup/npm.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Installs Node.js and some NPM packages - - -brew install node - -npm install -g grunt -npm install -g jshint -npm install -g bower diff --git a/setup/brew.sh b/setup/stuff.sh similarity index 51% rename from setup/brew.sh rename to setup/stuff.sh index bbe6bfa..595efac 100755 --- a/setup/brew.sh +++ b/setup/stuff.sh @@ -1,9 +1,9 @@ #!/bin/bash -# Installs Homebrew with some formulaes +# Installs Homebrew, Git, git-extras, git-friendly, Node.js, configures Apache, PHP, MySQL, etc. -# Setup Homebrew +# Install Homebrew command -v brew >/dev/null 2>&1 || ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" # Make sure we’re using the latest Homebrew @@ -32,9 +32,28 @@ unset TMPDIR mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp /usr/local/opt/mysql/bin/mysqladmin -u root password 'root' +# Apache: enable PHP, .htaccess files, virtual hosts and set it to run as current user +cd /etc/apache2 +sudo cp httpd.conf httpd.conf.bak +sudo cp extra/httpd-vhosts.conf extra/httpd-vhosts.conf.bak +sudo sed -i '' "s^#\(LoadModule php5_module\)^\1^" httpd.conf +sudo sed -i '' "s^#\(Include /private/etc/apache2/extra/httpd-vhosts.conf\)^\1^" httpd.conf +sudo sed -i '' "s^^^" httpd.conf +sudo sed -i '' "s^User _www^User `whoami`^" httpd.conf +sudo sed -i '' "s^Group _www^Group staff^" httpd.conf +echo -e "NameVirtualHost *:80\n\n\n AllowOverride All\n Allow from all\n\n" | sudo tee extra/httpd-vhosts.conf +cd - + # Everything else brew install unrar brew install node # Remove outdated versions from the cellar brew cleanup + +# Node.js +brew install node + +npm install -g grunt +npm install -g jshint +npm install -g bower