Module: BinInstall::Postgres

Defined in:
lib/bin_install/postgres.rb

Class Method Summary collapse

Class Method Details

.create_superuser(username = 'postgres') ⇒ Object



13
14
15
16
# File 'lib/bin_install/postgres.rb', line 13

def self.create_superuser(username = 'postgres')
  puts 'Creating superuser postgres for postgresqlSQL...'.whtie
  system("createuser --superuser #{username}")
end

.create_superuser!(username = 'postgres') ⇒ Object



18
19
20
21
# File 'lib/bin_install/postgres.rb', line 18

def self.create_superuser!(username = 'postgres')
  puts 'Creating superuser postgres for PostgreSQL...'.white
  BinInstall.system!("createuser --superuser #{username}")
end

.create_user(username = 'postgres') ⇒ Object



23
24
25
26
# File 'lib/bin_install/postgres.rb', line 23

def self.create_user(username = 'postgres')
  puts "Creating user #{username} for PostgreSQL".white
  system("createuser #{username}")
end

.create_user!(username = 'postgres') ⇒ Object



28
29
30
31
# File 'lib/bin_install/postgres.rb', line 28

def self.create_user!(username = 'postgres')
  puts "Creating user #{username} for PostgreSQL".white
  BinInstall.system!("createuser #{username}")
end

.installObject



3
4
5
6
# File 'lib/bin_install/postgres.rb', line 3

def self.install
  puts 'Installing PostgreSQL...'.white
  Brew::Package.install_or_upgrade('postgresql')
end

.install!Object



8
9
10
11
# File 'lib/bin_install/postgres.rb', line 8

def self.install!
  puts 'Installing PostgreSQL...'.white
  Brew::Package.install_or_upgrade!('postgresql')
end

.installed?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/bin_install/postgres.rb', line 33

def self.installed?
  Shell.executable_exists?('psql')
end