Merge pull request #62 from spectator/seamless_database_pool

Seamless database pool adapter
This commit is contained in:
Zach Dennis 2012-08-29 20:41:52 -07:00
commit 75a63d77d1
7 changed files with 31 additions and 19 deletions

View file

@ -14,6 +14,7 @@ group :test do
gem "mysql2", "~> 0.3.0" gem "mysql2", "~> 0.3.0"
gem "pg", "~> 0.9" gem "pg", "~> 0.9"
gem "sqlite3-ruby", "~> 1.3.1" gem "sqlite3-ruby", "~> 1.3.1"
gem "seamless_database_pool", "~> 1.0.11"
end end
platforms :jruby do platforms :jruby do
@ -24,7 +25,7 @@ group :test do
# Support libs # Support libs
gem "factory_girl", "~> 1.3.3" gem "factory_girl", "~> 1.3.3"
gem "delorean", "~> 0.2.0" gem "delorean", "~> 0.2.0"
# Debugging # Debugging
platforms :mri_18 do platforms :mri_18 do
gem "ruby-debug", "= 0.10.4" gem "ruby-debug", "= 0.10.4"
@ -36,7 +37,6 @@ group :test do
end end
platforms :mri_19 do platforms :mri_19 do
# TODO: Remove the conditional when ruby-debug19 supports Ruby >= 1.9.3 gem "debugger"
gem "ruby-debug19" if RUBY_VERSION < "1.9.3"
end end
end end

View file

@ -16,11 +16,17 @@ GEM
activesupport (3.2.7) activesupport (3.2.7)
i18n (~> 0.6) i18n (~> 0.6)
multi_json (~> 1.0) multi_json (~> 1.0)
archive-tar-minitar (0.5.2)
arel (3.0.2) arel (3.0.2)
builder (3.0.0) builder (3.0.0)
chronic (0.7.0) chronic (0.7.0)
columnize (0.3.6) columnize (0.3.6)
debugger (1.2.0)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
debugger-ruby_core_source (~> 1.1.3)
debugger-linecache (1.1.2)
debugger-ruby_core_source (>= 1.1.1)
debugger-ruby_core_source (1.1.3)
delorean (0.2.1) delorean (0.2.1)
chronic chronic
factory_girl (1.3.3) factory_girl (1.3.3)
@ -36,8 +42,6 @@ GEM
json (1.7.4-java) json (1.7.4-java)
linecache (0.46) linecache (0.46)
rbx-require-relative (> 0.0.4) rbx-require-relative (> 0.0.4)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
multi_json (1.3.6) multi_json (1.3.6)
mysql (2.8.1) mysql (2.8.1)
mysql2 (0.3.11) mysql2 (0.3.11)
@ -52,16 +56,8 @@ GEM
ruby-debug-base (0.10.4) ruby-debug-base (0.10.4)
linecache (>= 0.3) linecache (>= 0.3)
ruby-debug-base (0.10.4-java) ruby-debug-base (0.10.4-java)
ruby-debug-base19 (0.11.25) seamless_database_pool (1.0.11)
columnize (>= 0.3.1) activerecord (>= 2.2.2)
linecache19 (>= 0.5.11)
ruby_core_source (>= 0.1.4)
ruby-debug19 (0.11.6)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
sqlite3 (1.3.6) sqlite3 (1.3.6)
sqlite3-ruby (1.3.3) sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3) sqlite3 (>= 1.3.3)
@ -74,6 +70,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
activerecord (~> 3.0) activerecord (~> 3.0)
activerecord-jdbcmysql-adapter activerecord-jdbcmysql-adapter
debugger
delorean (~> 0.2.0) delorean (~> 0.2.0)
factory_girl (~> 1.3.3) factory_girl (~> 1.3.3)
jdbc-mysql jdbc-mysql
@ -84,5 +81,5 @@ DEPENDENCIES
rake rake
ruby-debug (= 0.10.4) ruby-debug (= 0.10.4)
ruby-debug-base (= 0.10.4) ruby-debug-base (= 0.10.4)
ruby-debug19 seamless_database_pool (~> 1.0.11)
sqlite3-ruby (~> 1.3.1) sqlite3-ruby (~> 1.3.1)

View file

@ -36,7 +36,7 @@ namespace :display do
end end
task :default => ["display:notice"] task :default => ["display:notice"]
ADAPTERS = %w(mysql mysql2 jdbcmysql postgresql sqlite3) ADAPTERS = %w(mysql mysql2 jdbcmysql postgresql sqlite3 seamless_database_pool)
ADAPTERS.each do |adapter| ADAPTERS.each do |adapter|
namespace :test do namespace :test do
desc "Runs #{adapter} database tests." desc "Runs #{adapter} database tests."

View file

@ -0,0 +1,7 @@
require "seamless_database_pool"
require "active_record/connection_adapters/seamless_database_pool_adapter"
require "activerecord-import/adapters/mysql_adapter"
class ActiveRecord::ConnectionAdapters::SeamlessDatabasePoolAdapter
include ActiveRecord::Import::MysqlAdapter
end

View file

@ -1 +1 @@
ENV["ARE_DB"] = "mysql2" ENV["ARE_DB"] = "mysql2"

View file

@ -0,0 +1 @@
ENV["ARE_DB"] = "seamless_database_pool"

View file

@ -13,6 +13,13 @@ mysql2:
<<: *common <<: *common
adapter: mysql2 adapter: mysql2
seamless_database_pool:
<<: *common
adapter: seamless_database_pool
pool_adapter: mysql2
master:
host: localhost
postgresql: postgresql:
<<: *common <<: *common
username: postgres username: postgres