Class: DBShell::Client::Postgres
- Inherits:
-
Object
- Object
- DBShell::Client::Postgres
- Defined in:
- lib/dbshell/client/postgres.rb
Constant Summary collapse
- EXECUTABLE_NAME =
'psql'
Class Method Summary collapse
Class Method Details
.build_command(db_info) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dbshell/client/postgres.rb', line 11 def self.build_command(db_info) args = [EXECUTABLE_NAME] host = db_info['host'] port = db_info['port'] db_name = db_info['database'] user = db_info['username'] password = db_info['password'] args.push('-U', user) if user args.push('-h', host) if host args.push('-p', port.to_s) if port args.push(db_name) end |
.runshell(db_info) ⇒ Object
6 7 8 9 |
# File 'lib/dbshell/client/postgres.rb', line 6 def self.runshell(db_info) args = self.build_command(db_info) exec(*args) end |