Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

upgrading rails to 3.0.10 which includes fix to postgresql schema_exi…

…sts?

added in mysql config and rake task for building db
  • Loading branch information...
commit 1582d610daaf5f5f3019ace063c46280707b440c 1 parent dbdc3fc
@bradrobertson bradrobertson authored
View
5 Gemfile
@@ -1,8 +1,3 @@
source "http://rubygems.org"
-# Uses patched version of postgresql adapter to enable apartment usage.
-# Current postgresql adapter in rails doesn't properly support the use of postgresql schemas
-# Pull request sent => https://github.com/rails/rails/pull/1604
-gem 'rails', '3.0.8', :git => 'git://github.com/bradrobertson/rails', :branch => '3-0-stable'
-
gemspec
View
41 Rakefile
@@ -33,19 +33,46 @@ namespace :postgres do
desc 'Build the PostgreSQL test databases'
task :build_db do
- %x{ createdb -E UTF8 #{config['database']} } rescue "test db already exists"
- ActiveRecord::Base.establish_connection config
+ %x{ createdb -E UTF8 #{pg_config['database']} } rescue "test db already exists"
+ ActiveRecord::Base.establish_connection pg_config
load 'spec/dummy/db/schema.rb'
end
desc "drop the PostgreSQL test database"
task :drop_db do
- puts "dropping database #{config['database']}"
- %x{ dropdb #{config['database']} }
+ puts "dropping database #{pg_config['database']}"
+ %x{ dropdb #{pg_config['database']} }
end
+
+end
+
+namespace :mysql do
+ require 'active_record'
+ require "#{File.join(File.dirname(__FILE__), 'spec', 'support', 'config')}"
- def config
- Apartment::Test.config['connections']['postgresql']
+ desc 'Build the MySQL test databases'
+ task :build_db do
+ %x{ mysqladmin -u root create #{my_config['database']} } rescue "test db already exists"
+ ActiveRecord::Base.establish_connection my_config
+ load 'spec/dummy/db/schema.rb'
end
-end
+ desc "drop the MySQL test database"
+ task :drop_db do
+ puts "dropping database #{my_config['database']}"
+ %x{ mysqladmin -u root drop #{my_config['database']} }
+ end
+
+end
+
+def config
+ Apartment::Test.config['connections']
+end
+
+def pg_config
+ config['postgresql']
+end
+
+def my_config
+ config['mysql']
+end
View
6 apartment.gemspec
@@ -14,17 +14,19 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {spec}/*`.split("\n")
- s.homepage = %q{http://github.com/ryanbrunner/apartment}
+ s.homepage = %q{http://github.com/bradrobertson/apartment}
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
- s.add_dependency 'rails', '~> 3.0.8'
+ s.add_dependency 'rails', '>= 3.0.10'
+ s.add_development_dependency 'rake', '~> 0.8.7'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'rspec', '~> 2.6.0'
s.add_development_dependency 'rspec-rails', '~> 2.6.1'
s.add_development_dependency 'capybara', '1.0.0'
s.add_development_dependency 'pg', '~> 0.11.0'
+ s.add_development_dependency 'mysql', '~> 2.8.1'
s.add_development_dependency "silent-postgres", "~> 0.0.8"
s.add_development_dependency 'delayed_job', '~> 2.1.4'
end
View
10 spec/config/database.yml
@@ -3,8 +3,10 @@ connections:
adapter: postgresql
database: apartment_postgresql_test
username: root
- password:
-
+ password:
+
mysql:
- adapater: mysql
- database: apartment_mysql_test
+ adapter: mysql
+ database: apartment_mysql_test
+ username: root
+ password:
View
1  spec/dummy/db/schema.rb
@@ -1,3 +1,4 @@
+# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
Please sign in to comment.
Something went wrong with that request. Please try again.