Sha256: 7173becf83dced0947ffa51d4471dab23638cc5b1d714d1b7588f275598509c9

Contents?: true

Size: 800 Bytes

Versions: 1

Compression:

Stored size: 800 Bytes

Contents

require 'fileutils'

from_d=File.expand_path(File.join(File.dirname(__FILE__),'lib','active_record'))
to_d=File.expand_path(File.join(RAILS_ROOT,'lib','active_record'))

FileUtils.cp_r from_d, to_d

env_file = File.expand_path(File.join(RAILS_ROOT,"config","environment.rb"))
bck_file = File.expand_path(File.join(RAILS_ROOT,"config","~.environment.rb.before_jdbc"))

FileUtils.mv env_file,bck_file

File.open(bck_file,"r") {|inf|
  File.open(env_file,"w") {|out|
    inf.each_line do |ln|
      if ln =~ /^Rails::Initializer\.run/
        out.puts "# Added by ActiveRecord JDBC plugin"
        out.puts "RAILS_CONNECTION_ADAPTERS = %w( jdbc mysql postgresql sqlite firebird sqlserver db2 oracle sybase openbase )"
        out.puts
      end
      out.puts ln
    end
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ActiveRecord-JDBC-0.0.1 install.rb