2 desc 'Build the sqlite test databases'
3 task :build_databases => :load_connection do
4 file = File.join(SCHEMA_PATH, 'sqlite.sql')
5 dbfile = File.join(PROJECT_ROOT, ENV['cpk_adapter_options_str'])
6 cmd = "mkdir -p #{File.dirname(dbfile)}"
9 cmd = "sqlite3 #{dbfile} < #{file}"
14 desc 'Drop the sqlite test databases'
15 task :drop_databases => :load_connection do
16 dbfile = ENV['cpk_adapter_options_str']
17 sh %{ rm -f #{dbfile} }
20 desc 'Rebuild the sqlite test databases'
21 task :rebuild_databases => [:drop_databases, :build_databases]
23 task :load_connection do
24 require File.join(PROJECT_ROOT, %w[lib adapter_helper sqlite3])
25 spec = AdapterHelper::Sqlite3.load_connection_from_env
26 ENV['cpk_adapter_options_str'] = spec[:dbfile]