module Octospy

Constants

VERSION

Public Class Methods

daemonize() click to toggle source
# File lib/octospy.rb, line 49
def daemonize
  Process.daemon(nochdir: nil, noclose: true)
  File.open(Octospy.pid_file, 'w') { |f| f << Process.pid }
  log = File.new(Octospy.log_file, 'a')
  log.sync = Octospy.sync_log
  STDIN.reopen '/dev/null'
  STDOUT.reopen log
  STDERR.reopen STDOUT
end
irc_bot() click to toggle source
# File lib/octospy.rb, line 25
def irc_bot
  Octokit.configure do |c|
    c.api_endpoint = Octospy.github_api_endpoint if Octospy.github_api_endpoint
    c.web_endpoint = Octospy.github_web_endpoint if Octospy.github_web_endpoint
    c.login        = Octospy.github_login
    c.access_token = Octospy.github_token
  end

  Cinch::Bot.new do
    configure do |c|
      c.server          = Octospy.server
      c.nick            = Octospy.nick
      c.channels        = Octospy.channels
      c.port            = Octospy.port if Octospy.port
      c.password        = Octospy.password if Octospy.password
      c.ssl.use         = Octospy.ssl if Octospy.ssl
      c.plugins.plugins = [
        Cinch::Plugins::Management,
        Cinch::Plugins::Octospy
      ]
    end
  end
end
parse(event) click to toggle source
# File lib/octospy.rb, line 17
def parse(event)
  Octospy::Parser.new(event).parse
end
run() click to toggle source
# File lib/octospy.rb, line 59
def run
  self.daemonize if Octospy.daemonize
  self.irc_bot.start
end
worker(repositories, &block) click to toggle source
# File lib/octospy.rb, line 21
def worker(repositories, &block)
  Octospy::Worker.new(repositories, &block)
end