Skip to content

Instantly share code, notes, and snippets.

# inspiration
# http://github.com/jnstq/rails-nginx-passenger-ubuntu
# sudo this sudo that bollocks
sudo -i
# system-related stuff
apt-get install htop strace sysstat
dpkg-reconfigure sysstat
apt-get install ntp
@chaffeqa
chaffeqa / bash_commands.sh
Created June 10, 2011 17:15
Installing Rails 3.1 Using RVM
# Make sure RVM is up-to-date
rvm get head
rvm reload
# Install ruby-1.9.2
rvm install 1.9.2
# Create a new Gemset
# (Optional, I like it though since makes dependency issues more transparent. EX: rake 0.8.7 vs 0.9.2)
rvm gemset create rails-head
@chaffeqa
chaffeqa / factories.rb
Created August 1, 2011 23:12
terminal stack-trace (Pre: refactoring) (FactoryGirl ruby-1.9.3-preview1 bug)
# Administrator Factories
Factory.define :administrator do |f|
f.sequence(:email) {|n| "admin#{n}@test.com" }
f.password "admintester"
end
# Site Factories
Factory.define :site do |f|
@chaffeqa
chaffeqa / factories.rb
Created August 1, 2011 23:21
terminal stack-trace (Post: refactoring) (FactoryGirl ruby-1.9.3-preview1 bug)
FactoryGirl.define do
# Administrator Factories
factory :administrator do |f|
f.sequence(:email) {|n| "admin#{n}@test.com" }
f.password "admintester"
end
# Site Factories
@chaffeqa
chaffeqa / gist:1201448
Created September 7, 2011 19:18
Shoulda-matchers first step
Projects/Gems/shoulda-matchers[master]% ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.0.0]
Projects/Gems/shoulda-matchers[master]% gem list
*** LOCAL GEMS ***
rake (0.8.7)
Projects/Gems/shoulda-matchers[master]% gem install bundler
Fetching: bundler-1.0.18.gem (100%)
Successfully installed bundler-1.0.18
@chaffeqa
chaffeqa / gist:1201461
Created September 7, 2011 19:23
Shoulda-matchers second step
Projects/Gems/shoulda-matchers[master]% bundle exec rake
(in /Users/chaffeqa/Projects/Gems/shoulda-matchers)
>> bundle install --gemfile=/Users/chaffeqa/Projects/Gems/shoulda-matchers/gemfiles/3.0.3.gemfile
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Installing abstract (1.0.0)
Installing activesupport (3.0.3)
Installing builder (2.1.2)
Using i18n (0.6.0)
Installing activemodel (3.0.3)
@chaffeqa
chaffeqa / gist:1201466
Created September 7, 2011 19:24
Shoulda-matchers third step
Projects/Gems/shoulda-matchers[master]% bundle exec rake cucumber
(in /Users/chaffeqa/Projects/Gems/shoulda-matchers)
$ cd /Users/chaffeqa/Projects/Gems/shoulda-matchers/tmp/aruba
$ rails new testapp
/Users/chaffeqa/.rvm/gems/ruby-1.8.7-p352@shoulda-matchers/gems/bundler-1.0.18/lib/bundler/definition.rb:14:in `build': /Users/chaffeqa/Projects/Gems/shoulda-matchers/Users/chaffeqa/Projects/Gems/shoulda-matchers/Gemfile not found (Bundler::GemfileNotFound)
@chaffeqa
chaffeqa / Gemfile
Created September 28, 2011 02:31
Bundler Issue - env
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@chaffeqa
chaffeqa / application.rb
Created September 28, 2011 02:39
Bundler Issue - commands
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@chaffeqa
chaffeqa / benchmark_bundle.rb
Created May 10, 2012 21:03 — forked from bdurand/benchmark_bundle.rb
Benchmark Your Bundle
#!/usr/bin/env ruby
require 'bundler'
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,