Last active
August 29, 2015 14:24
-
-
Save silviopaganini/c084f5764e200a185b71 to your computer and use it in GitHub Desktop.
rapid prototype bash_script
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
| function rapid | |
| { | |
| if [ -z "$1" ] | |
| then | |
| echo 'need to specify the folder name' | |
| else | |
| # creates a folder | |
| mkdir $1 | |
| cd $1 | |
| # checks out repository with the rapid prototype structure | |
| git clone git@github.com:silviopaganini/rapid-prototype.git . | |
| # renames package.json | |
| USR="$(git config --global user.name)" | |
| (echo "import json, sys";echo "with open('package.json', 'r+') as f:";echo " data = json.load(f)";echo " data['name'] = '$1'";echo " data['author'] = '$USR'";echo " data['version'] = '0.0.1'";echo " f.seek(0)";echo " json.dump(data, f, indent=4)") | python | |
| # generate README file | |
| rm README.md | |
| touch README.md | |
| printf "# $1 \n\n Description of your prototype \n Usage: \n\n \`npm start\`" >> README.md | |
| # remove rapid prototype git references | |
| rm -rf .git | |
| # install dependencies | |
| npm install | |
| # open Sublime | |
| open -a "Sublime Text" . | |
| # opens browser | |
| /usr/bin/open -a "/Applications/Google Chrome.app" 'http://localhost:9966' | |
| # starts server | |
| npm start | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment