- RVM is used
- In the version of ruby that is used, bundler gem is installed [ implied that it is global]
-
Create a project structure using bundler bundle gem game_of_life create game_of_life/Gemfile create game_of_life/Rakefile create game_of_life/.gitignore create game_of_life/game_of_life.gemspec create game_of_life/lib/game_of_life.rb create game_of_life/lib/game_of_life/version.rb
-
Get into the project directory $ cd game_of_life/
-
Create .rvmrc and containing the following line: rvm use ruby-1.9.2-p290@kata
-
Open Gemfile and ensure see that the contents are as below:
source "http://rubygems.org"
#Specify your gem's dependencies in game_of_life.gemspec #gemspec ###Commented this line to get rid of bundler error. gem 'rspec' # Adding RSpec to the existing file content
- Open spec/spec_helper.rb and make its contents as below $LOAD_PATH.unshift File.dirname(FILE) $LOAD_PATH.unshift File.join(File.dirname(FILE),'..','lib') require 'rspec_autotest_template'
RSpec.configure do |c| #... end
- Open Rakefile and make its contents as below so that rake by default runs the Rspec suite require 'rake' require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t| t.rspec_opts = %w(--color --format progress) end
task :default => :spec
-
Adding Guard to Project
Add the following to the Gemfile gem 'rspec'
gem 'guard-rspec' gem 'rb-inotify' gem 'libnotify'
In terminal run the following: $ bundle install $ guard init //will generate empty guard file which might not be of use to us $ guard init rspec //will be useful as it will create a Guardfile with a watch list based on RSpec framework. Ain't that cool?
$ guard [start] $ bundle exec guard [start]