benjamincharity
2/27/2013 - 2:40 PM

Script for AlfredApp to create a new project. Pulls in my boilerplate, curls latest scripts, sets up rvm, sets up git, create initial commit

Script for AlfredApp to create a new project. Pulls in my boilerplate, curls latest scripts, sets up rvm, sets up git, create initial commit, add the remote repo and fix auth issue.

# @Auth Benjamin Charity - ben@benjamincharity.com
#
# Add this script to AlfredApp.
# If you set the trigger word to 'create' then you would
# open alfred and type 'create foobar'. When you hit enter
# this script will run and a new project will be created
# in the location specified.
#
# Then, on Github, create a repo with the exact same name
# that you typed in the initial command. The project will
# already be set up to push to this repo.
#

# Where so you want the project to be created?
cd ~/dropbox/freelance/projects/

# Create a new folder using the name that was typed.
mkdir {query}

# Clone my boilerplate into this new directory.
# https://github.com/benjamincharity/project-boilerplate
git clone https://github.com/benjamincharity/project-boilerplate.git {query}

# Move into the project folder
cd {query}

# Create an rvmrc using the new project name
rvm --rvmrc --create 1.9.3@{query}

# Use the new gemset
rvm gemset use {query}

# Confirm the rvmrc
yes

# Run bundle
bundle

# Update jQuery
curl http://code.jquery.com/jquery.js > source/js/jquery.js

# Update Modernizr
curl http://modernizr.com/downloads/modernizr.js > source/js/modernizr.js

# Update Sugar [note: this link is not dynamic so it will need to be manually updated]
curl https://raw.github.com/andrewplummer/Sugar/master/release/sugar-full.development.js > source/js/sugar.js

# Update reset.scss
# https://github.com/benjamincharity/resets
curl https://raw.github.com/benjamincharity/resets/master/reset.scss > source/css/_reset.scss

# Initialize git
git init

# Remove the boilerplate remote repo
git remote rm origin

# Add the git repo
git remote add origin https://github.com/benjamincharity/{query}.git

# Fix github auth issues
# https://gist.github.com/benjamincharity/3420507
git config remote.origin.url git@github.com:benjamincharity/{query}.git

# Make sure git is tracking all of the new files
git add .

# Make the initial commit
git commit -am "initial commit"

# Open the project with Macvim
# Textmate users should be able to substitute 'mate .'
mvim .