Created
February 1, 2014 20:08
-
-
Save pwaldhauer/8757990 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export PROJECT_DIRECTORY="/Users/pwaldhauer/Dropbox/dev/Tests/" | |
function spawn_project { | |
if [ -z $2 ] | |
then | |
echo "You need a project name!" | |
return | |
fi | |
if [ $1 = "node" ] | |
then | |
spawn_project_node $2 | |
else | |
echo "Invalid environment, please use one of those: node" | |
fi | |
} | |
function spawn_project_node { | |
PROJECT_NAME=$1; | |
echo "Creating project $PROJECT_NAME in $PROJECT_DIRECTORY" | |
cd $PROJECT_DIRECTORY | |
mkdir $PROJECT_NAME | |
cd $PROJECT_NAME | |
cat << WOWSUCHTEXTVERYPLAIN > package.json | |
{ | |
"name": "$PROJECT_NAME", | |
"version": "0.0.0", | |
"description": "", | |
"main": "app.js", | |
"dependencies": { | |
"underscore": "x.x", | |
"async": "x.x" | |
}, | |
"author": "Philipp Waldhauer", | |
"license": "MIT" | |
} | |
WOWSUCHTEXTVERYPLAIN | |
cat << WOWSUCHTEXTVERYPLAIN > README.md | |
# $PROJECT_NAME | |
Please write a meaningful readme. | |
WOWSUCHTEXTVERYPLAIN | |
cat << WOWSUCHTEXTVERYPLAIN > app.js | |
var _ = require('underscore'); | |
var async = require('async'); | |
WOWSUCHTEXTVERYPLAIN | |
cat << WOWSUCHTEXTVERYPLAIN > .gitignore | |
node_modules | |
.DS_Store | |
._.DS_Store | |
WOWSUCHTEXTVERYPLAIN | |
npm install | |
git init | |
git add . | |
git commit -am "Initial commit" | |
subl . | |
} | |
alias spn=spawn_project_node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment