Sha256: 70a80dd0abfca475d3493fc7cd1d6e7974f4a36d98067de5244c985bc45496c2

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

module BinInstall
  module Postgres
    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

    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

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

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

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bin_install-0.0.33 lib/bin_install/postgres.rb
bin_install-0.0.32 lib/bin_install/postgres.rb