lib/pgcli/rails/tasks.rake in pgcli-rails-0.7.1 vs lib/pgcli/rails/tasks.rake in pgcli-rails-0.8.0
- old
+ new
@@ -1,16 +1,22 @@
desc "Start pgcli using connection info from database.yml"
task :pgcli do
- require "pgcli/rails/dbconsole"
+ begin
+ require "rails/commands/dbconsole"
+ rescue LoadError
+ require "rails/commands/dbconsole/dbconsole_command"
+ end
# APP_PATH constant must be set for DBConsole to work
APP_PATH = Rails.root.join("config", "application") unless defined?(APP_PATH)
- opt = if Rails.version >= "5.1"
+ opt = if Rails.gem_version >= Gem::Version.new("5.1.0")
{ "--include-password" => true }
else
["--include-password"]
end
- console = Pgcli::Rails::DBConsole.new(opt)
+ require "pgcli/rails/monkey_patch"
+ Pgcli::Rails::MonkeyPatch.apply!
+ Rails::DBConsole.new(opt).start
console.start
end