From 9fa407b12ddc5b015b41328f8eebeb4fc9d13513 Mon Sep 17 00:00:00 2001 From: Ben Mabey Date: Wed, 25 Jul 2012 17:27:34 -0600 Subject: [PATCH] WIP - adds DB config and rake tasks so test DBs can be created easily I had to bump ActiveRecord to get the "standalone_migrations" rake tasks to work. The task "rake db:create:all" works but the AR upgrade is causing errors in some of the other parts of the spec suite. I'll need to get these errors resolved before moving forward. #127 --- Gemfile | 30 +++------ Gemfile.lock | 149 +++++++++++++++++++++++++++++-------------- Rakefile | 13 +--- db/sample.config.yml | 13 ++++ 4 files changed, 127 insertions(+), 78 deletions(-) create mode 100644 db/sample.config.yml diff --git a/Gemfile b/Gemfile index e782b2a..e2e9477 100755 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,5 @@ source "http://rubygems.org" -# group :development do -# # gem "mysql" -# # gem "json_pure", "1.4.3" -# -# -# # gem "datamapper", "1.0.0" -# # gem "dm-migrations", "1.0.0" -# # gem "dm-sqlite-adapter", "1.0.0" -# -# # mongo requirements -# # gem "mongo", "1.0.1" -# # gem "mongo_ext", "0.19.3" -# # gem "bson_ext", "1.0.1" -# end +# TODO: move these to the gemspec... group :development do gem "rake" @@ -24,19 +11,22 @@ group :development do gem "json_pure" #ORM's - gem "activerecord", "2.3.8" + gem "activerecord" gem "datamapper", "1.0.0" gem "dm-migrations", "1.0.0" gem "dm-sqlite-adapter", "1.0.0" - gem "mongoid", "1.9.1" - gem "tzinfo", "0.3.22" - gem "mongo_mapper", "0.8.2" - gem "couch_potato", "0.3.0" + gem "mongoid" + gem "tzinfo" + gem "mongo_ext" + gem "bson_ext" + gem "mongo_mapper" + gem "couch_potato" gem "sequel", "~>3.21.0" #gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed gem 'mysql' - gem 'mysql2', '~> 0.2.0' + gem 'mysql2' gem 'pg' + gem "standalone_migrations" # https://github.com/thuss/standalone-migrations end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index fb6248b..15ea800 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,20 +2,42 @@ GEM remote: http://rubygems.org/ specs: ZenTest (4.8.1) - activerecord (2.3.8) - activesupport (= 2.3.8) - activesupport (2.3.8) + actionpack (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.1.3) + activemodel (3.2.6) + activesupport (= 3.2.6) + builder (~> 3.0.0) + activerecord (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activesupport (3.2.6) + i18n (~> 0.6) + multi_json (~> 1.0) addressable (2.2.8) - bson (1.0.9) + arel (3.0.2) + bson (1.6.4) + bson_ext (1.6.4) + bson (~> 1.6.4) builder (3.0.0) columnize (0.3.6) - couch_potato (0.3.0) - couchrest (>= 0.24) + couch_potato (0.5.7) + activemodel + couchrest (>= 1.0.1) json - couchrest (1.1.2) - mime-types (~> 1.15) - multi_json (~> 1.0.0) - rest-client (~> 1.6.1) + couchrest (1.0.1) + json (>= 1.4.6) + mime-types (>= 1.15) + rest-client (>= 1.5.1) cucumber (1.2.1) builder (>= 2.1.2) diff-lcs (>= 1.1.3) @@ -69,42 +91,59 @@ GEM dm-core (~> 1.0.0) do_sqlite3 (0.10.8) data_objects (= 0.10.8) - durran-validatable (2.0.1) + erubis (2.7.0) extlib (0.9.15) fastercsv (1.5.5) gherkin (2.11.1) json (>= 1.4.6) git (1.2.5) + hike (1.2.1) + i18n (0.6.0) jeweler (1.8.4) bundler (~> 1.0) git (>= 1.2.5) rake rdoc - jnunemaker-validatable (1.8.4) - activesupport (>= 2.3.4) + journey (1.0.4) json (1.7.3) json_pure (1.4.6) linecache (0.46) rbx-require-relative (> 0.0.4) mime-types (1.19) - mongo (1.0.9) - bson (>= 1.0.5) - mongo_mapper (0.8.2) - activesupport (>= 2.3.4) - jnunemaker-validatable (~> 1.8.4) - plucky (~> 0.3.1) - mongoid (1.9.1) - activesupport (<= 3.0.0) - bson (~> 1.0.1) - durran-validatable (>= 2.0.1) - mongo (~> 1.0.1) - will_paginate (< 2.9) - multi_json (1.0.4) + mongo (1.6.4) + bson (~> 1.6.4) + mongo_ext (0.19.3) + mongo_mapper (0.11.1) + activemodel (~> 3.0) + activesupport (~> 3.0) + plucky (~> 0.4.0) + mongoid (3.0.1) + activemodel (~> 3.1) + moped (~> 1.1.1) + origin (~> 1.0.3) + tzinfo (~> 0.3.22) + moped (1.1.2) + multi_json (1.3.6) mysql (2.8.1) - mysql2 (0.2.18) + mysql2 (0.3.11) + origin (1.0.4) pg (0.14.0) - plucky (0.3.5) - mongo (~> 1.0.8) + plucky (0.4.4) + mongo (~> 1.5) + rack (1.4.1) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + railties (3.2.6) + actionpack (= 3.2.6) + activesupport (= 3.2.6) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) rake (0.9.2.2) rbx-require-relative (0.0.9) rcov (1.0.0) @@ -113,48 +152,61 @@ GEM rest-client (1.6.7) mime-types (>= 1.16) rspactor (0.6.4) - rspec (2.1.0) - rspec-core (~> 2.1.0) - rspec-expectations (~> 2.1.0) - rspec-mocks (~> 2.1.0) - rspec-core (2.1.0) - rspec-expectations (2.1.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.1.0) - rspec-rails (2.1.0) - rspec (~> 2.1.0) + rspec (2.11.0) + rspec-core (~> 2.11.0) + rspec-expectations (~> 2.11.0) + rspec-mocks (~> 2.11.0) + rspec-core (2.11.1) + rspec-expectations (2.11.1) + diff-lcs (~> 1.1.3) + rspec-mocks (2.11.1) + rspec-rails (2.11.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec (~> 2.11.0) ruby-debug (0.10.4) columnize (>= 0.1) ruby-debug-base (~> 0.10.4.0) ruby-debug-base (0.10.4) linecache (>= 0.3) sequel (3.21.0) + sprockets (2.1.3) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.6) sqlite3-ruby (1.3.3) sqlite3 (>= 1.3.3) + standalone_migrations (1.0.10) + activerecord (>= 3) + rake stringex (1.1.0) - tzinfo (0.3.22) - uuidtools (2.1.2) - will_paginate (2.3.16) + thor (0.15.4) + tilt (1.3.3) + tzinfo (0.3.33) + uuidtools (2.1.3) PLATFORMS ruby DEPENDENCIES ZenTest - activerecord (= 2.3.8) + activerecord + bson_ext bundler - couch_potato (= 0.3.0) + couch_potato cucumber datamapper (= 1.0.0) dm-migrations (= 1.0.0) dm-sqlite-adapter (= 1.0.0) jeweler json_pure - mongo_mapper (= 0.8.2) - mongoid (= 1.9.1) + mongo_ext + mongo_mapper + mongoid mysql - mysql2 (~> 0.2.0) + mysql2 pg rake rcov @@ -163,4 +215,5 @@ DEPENDENCIES ruby-debug sequel (~> 3.21.0) sqlite3-ruby - tzinfo (= 0.3.22) + standalone_migrations + tzinfo diff --git a/Rakefile b/Rakefile index be8cbb8..8feea16 100644 --- a/Rakefile +++ b/Rakefile @@ -19,16 +19,6 @@ rescue LoadError puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" end -require 'rake/rdoctask' -Rake::RDocTask.new do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'database_cleaner' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README*') - rdoc.rdoc_files.include('lib/**/*.rb') -end - - require 'rspec/core' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| @@ -44,6 +34,9 @@ RSpec::Core::RakeTask.new(:rcov) do |spec| spec.rcov = true end + +require 'tasks/standalone_migrations' + begin require 'cucumber/rake/task' Cucumber::Rake::Task.new(:features) diff --git a/db/sample.config.yml b/db/sample.config.yml new file mode 100644 index 0000000..e0f9c8d --- /dev/null +++ b/db/sample.config.yml @@ -0,0 +1,13 @@ +mysql_test: + adapter: mysql2 + database: database_cleaner_test + username: root + password: + host: 127.0.0.1 + port: 3306 + +postgres_test: + adapter: postgresql + database: database_cleaner_test + username: root + password: