From 376896126c3c35ca4d01193138e8040d3718a931 Mon Sep 17 00:00:00 2001 From: Adam Simpson Date: Thu, 19 Dec 2013 07:57:55 -0500 Subject: [PATCH] feat: add function to checkout new git branch remove old project-init function --- bash/functions | 66 +++----------------------------------------------- 1 file changed, 3 insertions(+), 63 deletions(-) diff --git a/bash/functions b/bash/functions index 4142838..1f3e26d 100755 --- a/bash/functions +++ b/bash/functions @@ -85,67 +85,7 @@ function hg { history | grep --color=auto $1 } -# function parse_git_branch { -# git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/' -# } - -# function proml { -# local BLUE="\[\033[0;34m\]" -# local DEFAULT="\[\033[0m\]" -# local CYAN="\e[36m" -# local RED="\e[31m" -# local BLACK="\e[30m" -# local GREEN="\e[32m" -# local YELLOW="\e[33m" -# local BLUE="\e[34m" -# local MAGENTA="\e[35m" -# local WHITE="\e[37m" - -# PS1="$DEFAULT\u: $DEFAULT\w $YELLOW\$(parse_git_branch) \n⚡ $DEFAULT" -# } -# proml - -# #⇒ ➥ ⇾ ⇀ ➤ ❖ ★ ➔ 🔅💩🚀⚡ - -function sb_init { - local RED="\033[0;31m" - local NC="\033[0m" - - if [ ! $# = 1 ]; then - echo -e "${RED}Please specify a project name, or action (update, revert).${NC}" - echo -e "Usage: init project-name / action\n" - fi - if [ "$1" = "--update" ]; then - local name=$(node -e "console.log(require('./package.json').name)"); - mv package.json package.bak.json; - mv node_modules node_modules_bak; - curl -sSOL http://raw.github.com/sparkbox/project-init/master/package.json; - sed -i.tmp "s/Project-Name/$name/g" package.json; - rm package.json.tmp; - npm install; - fi - if [ "$1" = "--revert" ]; then - if [ -e node_modules_bak -a -e package.bak.json ]; then - rm -r node_modules; - rm package.json; - mv node_modules_bak node_modules; - mv package.bak.json package.json; - fi - else - echo -e "${RED}Downloading project-init${NC} 🚀\n" - curl -s -S -O -L http://github.com/sparkbox/project-init/archive/master.zip; - echo -e "${RED}Download finished.${NC}\n" - echo -e "${RED}Setting up project config files.${NC}\n" - unzip -qq master.zip; - rm master.zip; - mv project-init-master $1 - sed -i.bak "s/Project-Name/$1/g" $1/package.json; - rm $1/package.json.bak; - sed -i.bak "s/Project-Name/$1/g" $1/.rvmrc; - rm $1/.rvmrc.bak; - cd $1 - npm install; - bundle; - echo -e "${RED}Your project is all ready to go. Enjoy${NC}\n" - fi +function nb() { + name=$1; + git checkout -b ${name} origin/${name}; }