From 9f741398657ca47483211ffa6cb0a9dfbe3f88c8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 29 Apr 2017 19:36:30 +0200 Subject: Get `rake dbshell` working for SQLite3 Add `DBShell::Sqlite3.runshell`, which takes database connection information and starts a SQLite3 shell. Currently the Rake task just calls the SQLite3 `.runshell` method directly without any database adapter discrimination and also forces the development environment. It's nice to see it working. Now, we'll need to clean up those parts of the Rakefile. --- lib/dbshell/sqlite3_client.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/dbshell/sqlite3_client.rb') diff --git a/lib/dbshell/sqlite3_client.rb b/lib/dbshell/sqlite3_client.rb index 7e962d7..adc71ef 100644 --- a/lib/dbshell/sqlite3_client.rb +++ b/lib/dbshell/sqlite3_client.rb @@ -1,6 +1,11 @@ class DBShell::Sqlite3Client EXECUTABLE_NAME = 'sqlite3' + def self.runshell(db_info) + args = self.build_command(db_info) + exec(*args) + end + def self.build_command(db_info) args = [ EXECUTABLE_NAME, -- cgit v1.2.3