Graceful error if serialport gem is needed.

bug/bundler_fix
Pearce Barry 2017-02-01 20:59:33 -06:00
parent 16de745437
commit bb55d1cf3f
No known key found for this signature in database
GPG Key ID: 0916F4DEA5C5DE0A
1 changed files with 10 additions and 2 deletions

View File

@ -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