Class: PostgresChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/postgres_checker.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.checkObject



2
3
4
# File 'lib/postgres_checker.rb', line 2

def self.check
  new.check
end

Instance Method Details

#brew_installed?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/postgres_checker.rb', line 17

def brew_installed?
  !`which brew`.empty?
end

#checkObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/postgres_checker.rb', line 6

def check
  if !brew_installed?
    puts "You must have Homebrew installed."
    exit
  else
    if !postgres_installed?
      install_postgres
    end
  end
end

#install_postgresObject



25
26
27
# File 'lib/postgres_checker.rb', line 25

def install_postgres
  system('brew install postgresql')
end

#postgres_installed?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/postgres_checker.rb', line 21

def postgres_installed?
  !`brew ls --versions postgresql`.empty?
end