4 # if run as script, load the file as library while starting irb
7 irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
8 ENV['ADAPTER'] = ARGV[0]
9 exec "#{irb} -f -r #{$0} --simple-prompt"
13 # check if the given adapter is supported (default: mysql)
15 adapters = %w[mysql sqlite oracle oracle_enhanced postgresql ibm_db]
16 adapter = ENV['ADAPTER'] || 'mysql'
17 unless adapters.include? adapter
18 puts "Usage: #{__FILE__} <adapter>"
21 puts adapters.map{ |adapter| " #{adapter}" }.join("\n")
26 # load all necessary libraries
29 require 'local/database_connections'
31 $LOAD_PATH.unshift 'lib'
35 $LOAD_PATH.unshift "#{ENV['EDGE_RAILS_DIR']}/activerecord/lib" if ENV['EDGE_RAILS_DIR']
36 $LOAD_PATH.unshift "#{ENV['EDGE_RAILS_DIR']}/activesupport/lib" if ENV['EDGE_RAILS_DIR']
40 require 'active_support'
41 require 'active_record'
43 require "test/connections/native_#{adapter}/connection"
44 require 'composite_primary_keys'
46 PROJECT_ROOT = File.join(File.dirname(__FILE__), '..')
47 Dir[File.join(PROJECT_ROOT,'test/fixtures/*.rb')].each { |model| require model }