aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dbshell
AgeCommit message (Collapse)Author
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-29Update `require` paths in database client filesTeddy Wing
Change the paths in the code to conform to the new file layout introduced in b700c1bef89a67a64f1040fb6bb03c0320eefe91.
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.
2017-04-29dbshell.rake: Remove unnecessary commentTeddy Wing
No longer have a use for this information as I've already leveraged in the database client class implementations.
2017-04-29DBShell::PostgresClient: Add `.runshell()`Teddy Wing
Add a method to execute the `psql` command.
2017-04-29dbshell.rake: Use `DBShell::DatabaseClient`Teddy Wing
Instead of calling `DBShell::Sqlite3Client` directly, call the wrapper class that will delegate to `Sqlite3Client`, `PostgresClient`, etc. depending on the value of `adapter` in the database connection params passed in. This allows us to have a single interface that we can call from the Rake task that can handle any of the database adapters that we support.
2017-04-29Add `DBShell::DatabaseClient`Teddy Wing
A more generic interface to specific database adapter clients. This class will act as a frontend to the others. Calling its `.runshell()` will call the appropriate `.runshell()` for the adapter provided in `connection_params`. This way, we have a single entry point to start a database shell from the Rake `dbshell` task.
2017-04-29dbshell.rake: Use correct RAILS_ENVTeddy Wing
Remove our hard-coded "development" environment and instead get the current environment dynamically via the `RAILS_ENV` environment variable. Assume that the current environment is "development" if the env variable is unset.
2017-04-29Get `rake dbshell` working for SQLite3Teddy Wing
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.
2017-04-29Add `DBShell::Sqlite3Client`Teddy Wing
Much simpler `.build_command` than the Postgres version. Only building arguments now. Want to try out executing the subprocess command. Inspired of course by: https://github.com/django/django/blob/66150f7cf61bc09547fa98586790df596eff6d77/django/db/backends/sqlite3/client.py
2017-04-29PostgresClient: Basic implementation of #build_commandTeddy Wing
Correctly builds the required arguments. Doesn't handle passwords at all.
2017-04-29Add `DBShell::PostgresClient` stubTeddy Wing
Make an empty container to pass the basic tests.
2017-04-29dbshell.rake: Figure out how to get database connection info from RailsTeddy Wing
2017-04-29Add a test Rake taskTeddy Wing
Create a stub for our Rake task to see something working. Inspired by https://github.com/paulelliott/fabrication/blob/b470cd817e1973c14e3253cd76606cf934942ca1/lib/fabrication.rb
2017-04-29Change `Dbshell` to `DBShell`Teddy Wing
Use proper capitalisation for our module name.
2017-04-29Generate Ruby Gem contents with BundlerTeddy Wing
Created from: $ bundle gem dbshell-rails