Bundle install in parallel

Gave a shot to the new Bundler 1.4.0RC1 during the weekend and found out it now supports gem installation in parallel. To invoke you need to pass --jobs parameter with number of threads you want it to run – for me the best performance was achieved by specifying the number physical CPU cores.

I've tested on the AppFab app. In my case (CPU with 2-core i7 with HT) the speedup was 50%. I've also tried with a number greater than the number of physical cores but the performance was 15%-20% worse.

Bundler 1.3...

Find out branches containing a commit

If you have a commit and you want to see in what branches is is included, you have to write this:

git branch -r --contains [COMMIT-SHA]

-r is for remote

Killing wkhtmltopdf during cucumber

wkhtmltopdf hangs on mac during cucumber unless we click on it. The main reason is with the version we use which is 0.11.0_rc1 and in out app/bin we have another version and it is a known issue with these versions. The fix is to go to 0.9.9, to downgrade the version we installed earlier using brew:

* brew uninstall wkhtmltopdf
* brew update
* brew versions wkhtmltopdf
* if you see output like 
*         `0.9.9    git checkout 6e2d550 /usr/local/Library/Formula/wkhtmltopdf.rb`
           then `cd /usr/local`
* g...

Cleaner Rspec

When simply checking equality or truthiness then
Instead of:
it "should have role set to admin" do
@user.role.should eql('admin')
end

it "should be valid" do
  @user.valid?.should be_true
end

Do:
it { @user.role.should eql('admin') }
it { @user.valid?.should be_true}

Try to stick to one expectation per test block, diverge in exceptional circumstrances, so instead of:
describe "#some_method" do
before(:each) do
@object = Class.new
end

   it "should have attributes set" do

...

Creating a gem in lib folder

Go to lib folder and use bundler to generate main files for a gem:

$ bundle gem test_gem

      create  test_gem/Gemfile
      create  test_gem/Rakefile
      create  test_gem/LICENSE
      create  test_gem/README.md
      create  test_gem/.gitignore
      create  test_gem/test_gem.gemspec
      create  test_gem/lib/test_gem.rb
      create  test_gem/lib/test_gem/version.rb
Initializating git repo in /path/to/webapp/HouseTrip-Web-App/lib/test_gem

cd in to created directory

$ cd test_gem/

Bundle...

Rebase your feature branches

Regularly, but at least before merging your feature branches, rebase them to get rid of "fix typo" and "wip" commits.

Getting rid of unnecessary commits

Let's say you do a git rebase -i HEAD~~~~ and have this commit history:

pick 1d1e1f My Feature
pick 2d2e2f My Feature - wip
pick 3d3e3f My Feature - fix typo
pick 4d4e4f My Other feature

Change it to use fixup for those commits that should be merged into the one before ...

Git Branch naming

This is how we name branches :

  • <team>/<story>-<id> (features)
  • fix/<team>/<story>-<id> (bugs)

story is an dash-delimited version of the story name, and id the Pivotal story number.

Examples :

  • supply/belvilla-naming-1234567
  • fix/tripadvisor/property-syncing-3256674
  • integration/geo/boroughs