aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dbshell/client/postgres.rb
AgeCommit message (Collapse)Author
2017-04-30Try to add support for shell aliases through Ruby's `Kernel.exec`add-support-for-shell-aliased-database-commandsTeddy Wing
Work in progress. Ruby's `system` and `exec` don't load shell aliases, so the executables defined in `EXECUTABLE_NAME` will always be the ones used to launch database shells. The trouble is, users might have installed the command with a different name (as in "mysql5"), or they might not have the command on their path (as in my case when using Postgres.app). Apparently you can use an interactive or login shell to get aliases (using the `-l` or `-i` flags, which do slightly different things, sourcing .profile and .bashrc separately). Here's what I was following: http://stackoverflow.com/questions/12060863/python-subprocess-call-a-bash-alias/25099813#25099813 Unfortunately I haven't been able to get it to work. Dropping this for now.
2017-04-29DBShell::Client::Postgres: Convert port to stringTeddy Wing
Turns out the port actually did need to be a string, contrary to what I had assumed in e89275bc787ae17bc698ac8cdb8cdaf5ebeb7852. I ended up with this error when passing a specific port in a real test: $ bake dbshell rake aborted! TypeError: no implicit conversion of Fixnum into String .../lib/dbshell/client/postgres.rb:8:in `exec' .../lib/dbshell/client/postgres.rb:8:in `runshell' .../lib/dbshell/client/database.rb:24:in `runshell' .../lib/dbshell/rails/tasks/dbshell.rake:6:in `block in <top (required)>' .../versions/2.3.3/bin/bundle:22:in `load' .../versions/2.3.3/bin/bundle:22:in `<main>' Tasks: TOP => dbshell
2017-04-29Rename database client classesTeddy Wing
Update our class names to reflect the new file structure introduced in b700c1bef89a67a64f1040fb6bb03c0320eefe91. Use the module DBShell module Client end end syntax intead of `DBShell::Client` so that we don't have to define the `Client` module in a separate file and require it. Otherwise we'd get an error: lib/dbshell/client/sqlite3.rb:1:in `<top (required)>': uninitialized constant DBShell::Client (NameError)
2017-04-29Rename database client files to put them in a `Client` moduleTeddy Wing
Will be modifying the class names in the next commit. Here we change the file names & locations of the database client files. The format changes thusly: <adapter>_client.rb -> client/<adapter>.rb This organisation feels cleaner to me. Wasn't liking the previous structure.