Class: PostgresChecker
- Inherits:
-
Object
- Object
- PostgresChecker
- Defined in:
- lib/postgres_checker.rb
Class Method Summary collapse
Instance Method Summary collapse
- #brew_installed? ⇒ Boolean
- #check ⇒ Object
- #install_postgres ⇒ Object
- #postgres_installed? ⇒ Boolean
Class Method Details
.check ⇒ Object
2 3 4 |
# File 'lib/postgres_checker.rb', line 2 def self.check new.check end |
Instance Method Details
#brew_installed? ⇒ Boolean
17 18 19 |
# File 'lib/postgres_checker.rb', line 17 def brew_installed? !`which brew`.empty? end |
#check ⇒ Object
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_postgres ⇒ Object
25 26 27 |
# File 'lib/postgres_checker.rb', line 25 def install_postgres system('brew install postgresql') end |
#postgres_installed? ⇒ Boolean
21 22 23 |
# File 'lib/postgres_checker.rb', line 21 def postgres_installed? !`brew ls --versions postgresql`.empty? end |