Bundler reports errors across several different projects when running `bundle install`

When running bundle install, I was getting the following for several projects:

Bundler gave the error "Could not find {gem_name_version} in any of the sources" while processing "{project_path}/Gemfile". Perhaps you forgot to run "bundle install"?
.
.
.

I found someone else was having the same problem too.

In my case, I had uninstalled and reinstalled a version of ruby using rbenv and began seeing this error reported for every project using the same ruby version as the one I had uninstalled and reinstalled. I haven't exactly gotten to the bottom of why this happens, but going around and running bundle install in each of the project directories got rid of the error.

On Mac OSX Lion: "ERROR: Error installing ruby-oci8: ERROR: Failed to build gem native extension"

Running Mac OSX Lion, trying to bundle install a project that included the ruby-oci8 gem, I received the following error:

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-oci8:
	ERROR: Failed to build gem native extension.

The fix:

Fortunately, the 64-bit client for Oracle has now been updated for Lion/Mountain Lion. Download them from Instant Client Downloads for Mac OSX (Intel x86). Downloading "Basic Lite" and the "SDK" under Version 11.2... (64-bit) worked for me.

Unzip the files to ~/instantclient_11_2 so that the sdk directory and libs are directory beneath it:

$ ls ~/instantclient_11_2 
BASIC_LITE_README    genezi               libclntsh.dylib.11.1 libocci.dylib.11.1   libocijdbc11.dylib   ojdbc6.jar           uidrvci
adrci                libclntsh.dylib      libnnz11.dylib       libociicus.dylib     ojdbc5.jar           sdk                  xstreams.jar

Add the following to my .zlogin or .bash_login

export DYLD_LIBRARY_PATH=~/instantclient_11_2

Rerun the login shell (exec $SHELL -l) or restart your shell.

Link the libclntsh.dylib. in ~/instantclient_11_2 to a versionless lib file name:

ln -s libclntsh.dylib.11.1 libclntsh.dylib

Your ruby-oci8 should install now.

What Gets Added When I Require a File in Ruby?

Let's say you want to know what symbols are added when you require something in ruby. For example, I was curious if I could get a list of symbols that were added when I required 'english'.

I simply used Symbol.all_symbols to save off the old symbol array and the new one and then subtracted the two arrays.

before = Symbol.all_symbols
require 'english'
after = Symbol.all_symbols
added_symbols = after - before 
p added_symbols # should be an Array of symbols added.
puts added_symbols.count # I get 35.

Do you have other favorites?

I love treating primitives as objects #ruby

#script to generate a .csv testing results file
puts "Day,User ID,Action,Start Time,End Time"
(1..28).each{ |day|
puts "#{day},system,1. Load Step,hh:mm:ss,hh:mm:ss"
puts "#{day},system,1a. Raw Data Load,hh:mm:ss,hh:mm:ss"
puts "#{day},system,1b. Cube Build,hh:mm:ss,hh:mm:ss"
(1..8).each { |user|
(1..15).each { |report|
puts "#{day},#{user},2. Report #{report},hh:mm:ss,hh:mm:ss"
}
}
(1..5).each { |user|
puts "#{day},#{user},3. Query,hh:mm:ss,hh:mm:ss"
}
}

rush: the ruby shell

rush.

rush is a replacement for the unix shell (bash, zsh, etc) which uses pure Ruby syntax. Grep through files, find and kill processes, copy files - everything you do in the shell, now in Ruby.

Install rush

If you're running windows and have Ruby installed, go to Start->Ruby-{version}->RubyGems->RubyGems Package manager and type in "gem install rush" at the cmd prompt.