summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-04-15 22:12:16 +0300
committerSaku Ytti <saku@ytti.fi>2014-04-15 22:12:16 +0300
commit2af41e1769225ac42027f2f686763389296bab79 (patch)
tree33ccf4abc090a5ee77c248df7d487b0ee733600d
parenta7ddb8df89ba82d48f678982d081aa341fca57cc (diff)
Remove dependency to sequel, sqlite3 and grit
Not every installation will use git + sql. Try to give helpful error message on missing dependencies.
-rw-r--r--lib/oxidized/output/git.rb6
-rw-r--r--lib/oxidized/source/sql.rb12
-rw-r--r--oxidized.gemspec8
3 files changed, 17 insertions, 9 deletions
diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb
index ff9237b..6f232cb 100644
--- a/lib/oxidized/output/git.rb
+++ b/lib/oxidized/output/git.rb
@@ -1,6 +1,10 @@
module Oxidized
class Git < Output
- require 'grit'
+ begin
+ require 'grit'
+ rescue LoadError
+ raise LoadError, 'grit not found: sudo gem install grit'
+ end
require 'oxidized/fix/grit' if RUBY_VERSION[0..1] == '2.'
include Grit
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|
diff --git a/oxidized.gemspec b/oxidized.gemspec
index 6e132d4..e72e1ef 100644
--- a/oxidized.gemspec
+++ b/oxidized.gemspec
@@ -12,16 +12,12 @@ Gem::Specification.new do |s|
s.executables = %w( oxidized )
s.require_path = 'lib'
+ s.add_dependency 'asetus', '>= 0.0.7'
+ s.add_dependency 'slop'
s.add_dependency 'net-ssh'
- s.add_dependency 'sqlite3'
- s.add_dependency 'grit'
- s.add_dependency 'sequel'
s.add_dependency 'sinatra'
s.add_dependency 'sinatra-contrib'
s.add_dependency 'puma'
s.add_dependency 'haml'
s.add_dependency 'sass'
- s.add_dependency 'slop'
- s.add_dependency 'asetus', '>= 0.0.7'
-
end