Class: Locomotive::Cmd::MongoChecker

Inherits:
Thor::Group
  • Object
show all
Defined in:
lib/locomotive_cmd/mongo_checker.rb

Instance Method Summary collapse

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'lib/locomotive_cmd/mongo_checker.rb', line 3

def exists?
  mongo_path = `which mongo`
  if mongo_path.include? 'mongo'
    say 'Mongo installation: ✔', :green
  else
    say 'Mongo installation: ✗ (mongo command not found)', :red
  end
end

#running?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
# File 'lib/locomotive_cmd/mongo_checker.rb', line 12

def running?
  mongo = `ps cax | grep mongod`
  unless mongo.include? 'mongod'
    say 'MongoDB is not running, please turn it on!', :red
    exit -1
  end
end