Sha256: 59239dba66a8b81cd65df57748986e92e11d4327685cd79df3f300bbb368f49e
Contents?: true
Size: 1.62 KB
Versions: 17
Compression:
Stored size: 1.62 KB
Contents
require "bundler/gem_tasks" require "rspec/core/rake_task" require "yaml" RSpec::Core::RakeTask.new(:spec) task :default => :spec task :load_path do %w(lib spec).each do |path| $LOAD_PATH.unshift(File.expand_path("../#{path}", __FILE__)) end end namespace :db do desc "Create the database" task :create => :load_path do require "database" driver = Mobility::Test::Database.driver config = Mobility::Test::Database.config[driver] exit if config["database"] == ":memory:" commands = { "mysql" => "mysql -u #{config['username']} -e 'create database #{config["database"]};' >/dev/null", "postgres" => "psql -c 'create database #{config['database']};' -U #{config['username']} >/dev/null" } %x{#{commands[driver] || true}} end desc "Drop the database" task :drop => :load_path do require "database" driver = Mobility::Test::Database.driver config = Mobility::Test::Database.config[driver] exit if config["database"] == ":memory:" commands = { "mysql" => "mysql -u #{config['username']} -e 'drop database #{config["database"]};' >/dev/null", "postgres" => "psql -c 'drop database #{config['database']};' -U #{config['username']} >/dev/null" } %x{#{commands[driver] || true}} end desc "Set up the database schema" task :up => :load_path do require "database" driver = Mobility::Test::Database.driver config = Mobility::Test::Database.config[driver] exit if config["database"] == ":memory:" require "spec_helper" Mobility::Test::Schema.up end desc "Drop and recreate the database schema" task :reset => [:drop, :create] end
Version data entries
17 entries across 17 versions & 1 rubygems