Graceful error if serialport gem is needed.
parent
16de745437
commit
bb55d1cf3f
|
@ -10,12 +10,20 @@
|
|||
####
|
||||
# This module requires a connected ELM327 or STN1100 is connected to
|
||||
# the machines serial. Sets up a basic RESTful web server to communicate
|
||||
# Requires MSF and the serialport gem
|
||||
#
|
||||
# Requires MSF and the serialport gem to be installed.
|
||||
# - `gem install serialport`
|
||||
# - or, if using rvm: `rvm gemset install serialport`
|
||||
####
|
||||
|
||||
|
||||
### Non-typical gem ###
|
||||
require 'serialport'
|
||||
begin
|
||||
require 'serialport'
|
||||
rescue LoadError => e
|
||||
gem = e.message.split.last
|
||||
abort "#{gem} is not installed. Please install with `gem install #{gem}' or, if using rvm, `rvm gemset install #{gem}' and try again."
|
||||
end
|
||||
|
||||
#
|
||||
# Load our MSF API
|
||||
|
|
Loading…
Reference in New Issue