From 2af41e1769225ac42027f2f686763389296bab79 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Tue, 15 Apr 2014 22:12:16 +0300 Subject: Remove dependency to sequel, sqlite3 and grit Not every installation will use git + sql. Try to give helpful error message on missing dependencies. --- lib/oxidized/source/sql.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/oxidized/source') diff --git a/lib/oxidized/source/sql.rb b/lib/oxidized/source/sql.rb index f84a7a8..9f862e5 100644 --- a/lib/oxidized/source/sql.rb +++ b/lib/oxidized/source/sql.rb @@ -1,6 +1,10 @@ module Oxidized class SQL < Source - require 'sequel' + begin + require 'sequel' + rescue LoadError + raise LoadError, 'sequel not found: sudo gem install sequel' + end def initialize super @@ -23,7 +27,11 @@ class SQL < Source nodes = [] db = case @cfg.adapter when 'sqlite' - require 'sqlite3' + begin + require 'sqlite3' + rescue LoadError + raise LoadError, 'sqlite3 not found: sudo apt install libsqlite3-dev; sudo gem install sqlite3' + end Sequel.sqlite @cfg.file end db[@cfg.table.to_sym].each do |node| -- cgit v1.2.1