From 959f94b00c6af6ee17fe4fb49bae1f57400a1f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Thu, 3 Nov 2016 20:16:18 -0200 Subject: [PATCH] making Nokogiri dep optional --- lib/ooor/services.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ooor/services.rb b/lib/ooor/services.rb index a5afda0..6c483fc 100644 --- a/lib/ooor/services.rb +++ b/lib/ooor/services.rb @@ -4,7 +4,7 @@ # Licensed under the MIT license, see MIT-LICENSE file require 'json' -require 'nokogiri' + module Ooor autoload :InvalidSessionError, 'ooor/errors' @@ -66,6 +66,10 @@ def login(db, username, password, kw={}) end def csrf_token() + unless defined?(Nokogiri) + raise "You need to install the nokogiri gem for this feature" + end + require 'nokogiri' @session.logger.debug "OOOR csrf_token" conn = @session.get_client(:json, "#{@session.base_jsonrpc2_url}") login_page = conn.get('/web/login') do |req|