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
| #!/usr/bin/env bash | |
| # Author: Wayne E. Seguin (wayneeseguin@gmail.com) | |
| # | |
| # I like the sound of 'work_on', however you can name this | |
| # function anything that makes it easier for you to think. | |
| # | |
| work_on () | |
| { | |
| # We are expecting project name to be the first parameter |
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
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/' | |
| } | |
| PS1="\u@\h \w \$(parse_git_branch)$ " | |
| if [[ -f ~/.bashrc ]] ; then source ~/.bashrc ; fi |
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
| #rvm_trust_rvmrcs=1 # <= This goes in ~/.rvmrc | |
| create_file ".rvmrc", "rvm --create 1.9.2@#{appname}" | |
| # Note I removed --pre since Bundler is 1.0.0 now. | |
| # Also note that by default `` and system() runs via 'sh' not bash, hence the | |
| # bash -l -c... | |
| run "/bin/bash -l -c 'cd path/to/new/app; gem install bundler ; bundle install'" |
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
| #!/bin/bash | |
| project_root="${project_root:-"/srv/cms/current/"}" | |
| home_dir="${home_dir:-"/home/capdeploy"}" | |
| rvm_path="${rvm_path:-"$home_dir/.rvm"}" | |
| port="${1:-8000}" | |
| environment="${2:-production}" | |
| pids_path="${project_root}/tmp/pids/" | |
| command="${3:-start}" |
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
| This is an example of using RVM's Project .rvmrc file | |
| to have it automatically bootstrap your environment, including bundler. | |
| This could be further expanded to do anything you require :) | |
| The important thing to remember is that the purpose of these files is | |
| to allow you to very easily have your 'project context' (aka 'environment') | |
| loaded automatically for you when you enter the project in the shell (cd). | |
| You can generate the .rvmrc file below by running: |
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
| rvm --create use default@myproject | |
| [[ -s myproject.gems ]] && rvm gemset import myproject.gems | |
| command -v bundle && bundle install |
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
| chromesize () { | |
| ps auxww | GREP_COLOR="1;37;41" LANG=C grep --color=auto [C]hrome | awk '{sum += $6} END{print (sum / 1024) "MB"}' | |
| } |
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
| apillet@russell:~$ cat foo.rb | |
| FOO = 123 | |
| apillet@russell:~$ irb | |
| ruby-1.9.2-preview1 > $:.unshift(Dir.pwd) | |
| ruby-1.9.2-preview1 > require 'foo' |
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
| # ~/.bashrc: executed by bash(1) for non-login shells. | |
| # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
| # for examples | |
| # If not running interactively, don't do anything | |
| if [ -n "$PS1" ] ; then | |
| # don't put duplicate lines in the history. See bash(1) for more options | |
| # ... or force ignoredups and ignorespace | |
| HISTCONTROL=ignoredups:ignorespace |
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
| # ~/.bashrc: executed by bash(1) for non-login shells. | |
| if [[ ! -z "$PS1" ]] ; then | |
| export PS1='\u@\h:\w$ ' | |
| umask 022 | |
| # Bash Completion | |
| if [[ -f ~/.bash_completion ]] ; then . ~/.bash_completion; fi | |
| # Prompt Settings | |
| if [[ -f ~/.bash_styles ]] ; then . ~/.bash_styles old; fi |