Commit ffb609f6 authored by Stan Hu's avatar Stan Hu

Merge branch '498-gracefully-handle-postgresql-minor-updates-in-procfile' into 'master'

Resolve "Gracefully handle PostgreSQL minor updates in Procfile"

Closes #498

See merge request !703
parents ad6ed7e2 8294caf7
#!/usr/bin/env ruby
require 'pathname'
require_relative '../lib/shellout.rb'
brew_cellar_pg96 = Shellout.new(%w[brew --cellar postgresql@9.6]).try_run
POSTGRESQL_VERSION = '9.6'.freeze
POSTGRESQL_DAEMON_BINARY = "/usr/local/opt/postgresql@#{POSTGRESQL_VERSION}/bin/postgres".freeze
def original_pg_bin_dir_discover
brew_cellar_pg = Shellout.new(%W[brew --cellar postgresql@#{POSTGRESQL_VERSION}]).try_run
unless brew_cellar_pg96.empty?
brew_cellar_pg96_bin = Dir.glob(File.join(brew_cellar_pg96, '/*/bin'))
unless brew_cellar_pg.empty?
brew_cellar_pg_bin = Dir.glob(File.join(brew_cellar_pg, '/*/bin'))
if brew_cellar_pg96_bin.any?
puts brew_cellar_pg96_bin.last
exit
if brew_cellar_pg_bin.any?
return brew_cellar_pg_bin.last
end
end
Shellout.new(%w[pg_config --bindir]).run
end
def robust_pg_bin_dir_discover
postgresql_daemon_binary = Pathname.new(POSTGRESQL_DAEMON_BINARY)
return nil unless postgresql_daemon_binary.exist?
postgresql_daemon_binary.dirname
end
puts Shellout.new(%w[pg_config --bindir]).run
puts (robust_pg_bin_dir_discover || original_pg_bin_dir_discover)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment