module BinInstall::Postgres

Public Class Methods

create_superuser(username = 'postgres') click to toggle source
# File lib/bin_install/postgres.rb, line 21
def self.create_superuser(username = 'postgres')
  puts 'Creating superuser postgres for postgresqlSQL...'.white
  system("createuser --superuser #{username}")
end
create_superuser!(username = 'postgres') click to toggle source
# File lib/bin_install/postgres.rb, line 26
def self.create_superuser!(username = 'postgres')
  puts 'Creating superuser postgres for PostgreSQL...'.white
  BinInstall.system!("createuser --superuser #{username}")
end
create_user(username = 'postgres') click to toggle source
# File lib/bin_install/postgres.rb, line 31
def self.create_user(username = 'postgres')
  puts "Creating user #{username} for PostgreSQL".white
  system("createuser #{username}")
end
create_user!(username = 'postgres') click to toggle source
# File lib/bin_install/postgres.rb, line 36
def self.create_user!(username = 'postgres')
  puts "Creating user #{username} for PostgreSQL".white
  BinInstall.system!("createuser #{username}")
end
install(version = nil) click to toggle source
# File lib/bin_install/postgres.rb, line 3
def self.install(version = nil)
  puts 'Installing PostgreSQL...'.white
  if version
    Brew::Package.install_or_upgrade("postgresql@#{version}")
  else
    Brew::Package.install_or_upgrade('postgresql')
  end
end
install!(version = nil) click to toggle source
# File lib/bin_install/postgres.rb, line 12
def self.install!(version = nil)
  puts 'Installing PostgreSQL...'.white
  if version
    Brew::Package.install_or_upgrade!("postgresql@#{version}")
  else
    Brew::Package.install_or_upgrade!('postgresql')
  end
end
installed?() click to toggle source
# File lib/bin_install/postgres.rb, line 41
def self.installed?
  Shell.executable_exists?('psql')
end