Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
a bit lighter
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Mar 18, 2009
1 parent 5c6d1c7 commit c9abdcc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 49 deletions.
15 changes: 0 additions & 15 deletions generators/rspec/templates/rspec.rake
@@ -1,19 +1,4 @@
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
rspec_gem_dir = nil
Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
end
rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')

if rspec_gem_dir && (test ?d, rspec_plugin_dir)
raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
end

if rspec_gem_dir
$LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
elsif File.exist?(rspec_plugin_dir)
$LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
end

# Don't load rspec if running "rake gems:*"
unless ARGV.any? {|a| a =~ /^gems/}
Expand Down
19 changes: 2 additions & 17 deletions generators/rspec/templates/script/spec
@@ -1,23 +1,8 @@
#!/usr/bin/env ruby
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
rails_root = File.expand_path(File.dirname(__FILE__) + "/..")
rspec_gem_dir = nil
Dir["#{rails_root}/vendor/gems/*"].each do |subdir|
rspec_gem_dir = subdir if subdir.gsub("#{rails_root}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
end
rspec_plugin_dir = File.expand_path("#{rails_root}/vendor/plugins/rspec")

if rspec_gem_dir && (test ?d, rspec_plugin_dir)
raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
end

if rspec_gem_dir
$LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
elsif File.exist?(rspec_plugin_dir)
$LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
else
require 'rubygems' unless ENV['NO_RUBYGEMS']
end
ENV['RAILS_ENV'] ||= 'test'
require File.join(File.dirname(__FILE__), "/../config/environment")

require 'spec/autorun'
exit ::Spec::Runner::CommandLine.run
19 changes: 2 additions & 17 deletions generators/rspec/templates/script/spec_server
@@ -1,23 +1,8 @@
#!/usr/bin/env ruby
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
rails_root = File.expand_path(File.dirname(__FILE__) + "/..")
rspec_rails_gem_dir = nil
Dir["#{rails_root}/vendor/gems/*"].each do |subdir|
rspec_rails_gem_dir = subdir if subdir.gsub("#{rails_root}/vendor/gems/","") =~ /^(\w+-)?rspec-rails-(\d+)/
end
rspec_rails_plugin_dir = File.expand_path("#{rails_root}/vendor/plugins/rspec-rails")

if rspec_rails_gem_dir && (test ?d, rspec_rails_plugin_dir)
raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
end

if rspec_rails_gem_dir
$LOAD_PATH.unshift("#{rspec_rails_gem_dir}/lib")
elsif File.exist?(rspec_rails_plugin_dir)
$LOAD_PATH.unshift("#{rspec_rails_plugin_dir}/lib")
else
require 'rubygems' unless ENV['NO_RUBYGEMS']
end
ENV['RAILS_ENV'] ||= 'test'
require File.join(File.dirname(__FILE__), "/../config/environment")

require 'optparse'
require 'spec/rails/spec_server'
Expand Down

0 comments on commit c9abdcc

Please sign in to comment.