Skip to content

Instantly share code, notes, and snippets.

@acdesouza
Created March 21, 2012 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acdesouza/2148474 to your computer and use it in GitHub Desktop.
Save acdesouza/2148474 to your computer and use it in GitHub Desktop.
Environment setup script for my Ruby 1.9.3 / Rails projects. This script MUST be in script directory. And MUST be executed from project root: source script/bootstrap
#!/bin/bash
clear
echo "------------------------------------------------------------------------------------------------------"
echo "Fresh install development enviroment"
echo "Check if you need export http_proxy, before running ;)"
echo "------------------------------------------------------------------------------------------------------"
#############################################################################################################
# Install rvm
#############################################################################################################
if ! type rvm >/dev/null 2>&1; then
echo "RVM not found. Installing rvm..."
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_profile
rvm reload
fi
#------------------------------------------------------------------------------------------------------------
# Install Ruby 1.9.3
RUBY_VERSION='1.9.3'
GEMSET_NAME=$(basename `pwd`)
echo "Installing ruby $RUBY_VERSION"
rvm install $RUBY_VERSION
rvm use $RUBY_VERSION
echo "Creating gemset $GEMSET_NAME"
rvm gemset create $GEMSET_NAME
rvm use $RUBY_VERSION@$GEMSET_NAME
echo "rvm use $RUBY_VERSION@$GEMSET_NAME" > .rvmrc
#------------------------------------------------------------------------------------------------------------
# Reference: https://raw.github.com/gist/1333785, http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Checking *fix* for ruby-debug with ruby-1.9.3-p0 ..."
gem spec linecache19 -v 0.5.13 > /dev/null
ruby_193_debug_fix_linecache_installed=$?
if [ $ruby_193_debug_fix_linecache_installed -eq 1 ];then
echo "Installing *fix* for linecache19..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
gem install linecache19-0.5.13.gem
rm linecache19-0.5.13.gem
fi
gem spec ruby-debug-base19 -v 0.11.26 > /dev/null
ruby_193_debug_fix_rubydebugbase_installed=$?
if [ $ruby_193_debug_fix_rubydebugbase_installed -eq 1 ];then
echo "Installing *fix* for ruby-debug-base19..."
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
RUBY_RVM_VERSION=$(rvm current | sed 's/@...*//g' 2>&1)
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=\$rvm_path/src/$RUBY_RVM_VERSION/
rm ruby-debug-base19-0.11.26.gem
fi
#############################################################################################################
############################################################################################################## Bundle install
#############################################################################################################gem install bundler
bundle install --binstubs --without=production
#############################################################################################################
#############################################################################################################
# Database fresh install
#############################################################################################################
rake db:create
rake db:migrate
#############################################################################################################
echo "------------------------------------------------------------------------------------------------------"
echo "Done."
echo "------------------------------------------------------------------------------------------------------"
@tinogomes
Copy link

Now, have a new gem "debugger", forked from ruby-debug19

@acdesouza
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment