summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthias Hecker <mail@apoc.cc>2020-04-14 19:42:37 +0200
committerMatthias Hecker <mail@apoc.cc>2020-04-14 19:42:37 +0200
commitfda847bf583b9cc02eda341730d53887302ffe57 (patch)
treef5ed918626e2b7eb439da30f0c51aa447a18a41b /lib
parent391c2ce19c0954d3ea0f7b6cc17c001d26491ca6 (diff)
refactor: httputil no longer core module see #38
This is intended to make testing/mocking of the http client easier.
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/httputil.rb (renamed from lib/rbot/core/utils/httputil.rb)17
-rw-r--r--lib/rbot/ircbot.rb3
2 files changed, 3 insertions, 17 deletions
diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/httputil.rb
index fb275547..75b5b80b 100644
--- a/lib/rbot/core/utils/httputil.rb
+++ b/lib/rbot/httputil.rb
@@ -726,20 +726,3 @@ class HttpUtil
end
end
end
-
-class HttpUtilPlugin < CoreBotModule
- def initialize(*a)
- super(*a)
- debug 'initializing httputil'
- @bot.httputil = Irc::Utils::HttpUtil.new(@bot)
- end
-
- def cleanup
- debug 'shutting down httputil'
- @bot.httputil.cleanup
- @bot.httputil = nil
- super
- end
-end
-
-HttpUtilPlugin.new
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index ddbc6eb6..3c508229 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -50,6 +50,7 @@ require 'rbot/registry'
require 'rbot/plugins'
require 'rbot/message'
require 'rbot/language'
+require 'rbot/httputil'
module Irc
@@ -471,6 +472,7 @@ class Bot
@plugins = nil
@lang = Language.new(self, @config['core.language'])
+ @httputil = Utils::HttpUtil.new(self)
begin
@auth = Auth::manager
@@ -1236,6 +1238,7 @@ class Bot
debug "\tignoring cleanup error: #{$!}"
end
end
+ @httputil.cleanup
# debug "\tstopping timers ..."
# @timer.stop
# debug "Closing registries"