aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-04-29 21:46:08 +0200
committerTeddy Wing2017-04-29 21:46:08 +0200
commit9671489fcf3fbb47be047a86f1de9e95af6c8e81 (patch)
tree1e4d6414925d03962ba783708a182eb85a3dd7c3
parentf1c4164aef7ef88735a254e1301c3e4bf5978714 (diff)
downloaddbshell-rails-9671489fcf3fbb47be047a86f1de9e95af6c8e81.tar.bz2
DBShell::PostgresClient: Add `.runshell()`
Add a method to execute the `psql` command.
-rw-r--r--lib/dbshell/postgres_client.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/dbshell/postgres_client.rb b/lib/dbshell/postgres_client.rb
index b77e681..1c1c663 100644
--- a/lib/dbshell/postgres_client.rb
+++ b/lib/dbshell/postgres_client.rb
@@ -1,6 +1,11 @@
class DBShell::PostgresClient
EXECUTABLE_NAME = 'psql'
+ def self.runshell(db_info)
+ args = self.build_command(db_info)
+ exec(*args)
+ end
+
def self.build_command(db_info)
args = [EXECUTABLE_NAME]