Permalink
Browse files

Allow specs to run when the code is not checked out through git.

The presence of `git` commands in my gemspec prevents bundler from being usable for `gem test vcr`.  This fixes the issue.
  • Loading branch information...
1 parent 26294b9 commit beb9ea0eaade9b21a9af8052111f67425e08dcc6 @myronmarston committed Feb 28, 2011
Showing with 15 additions and 6 deletions.
  1. +9 −4 Rakefile
  2. +6 −2 spec/spec_helper.rb
View
@@ -1,13 +1,18 @@
-require 'bundler'
-require 'bundler/setup'
-Bundler::GemHelper.install_tasks
+using_git = File.exist?(File.expand_path('../.git/', __FILE__))
+
+if using_git
+ require 'bundler'
+ require 'bundler/setup'
+ Bundler::GemHelper.install_tasks
+end
require 'rake'
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec) do |t|
t.verbose = false
- t.rspec_opts = %w[--format progress] if ENV['FULL_BUILD']
+ t.skip_bundler = true unless using_git
+ t.rspec_opts = %w[--format progress] if (ENV['FULL_BUILD'] || !using_git)
end
desc "Run all examples using rcov"
View
@@ -1,6 +1,10 @@
require 'rubygems'
-require 'bundler'
-Bundler.setup
+
+using_git = File.exist?(File.expand_path('../../.git/', __FILE__))
+if using_git
+ require 'bundler'
+ Bundler.setup
+end
require 'rspec'

0 comments on commit beb9ea0

Please sign in to comment.