Module: Octospy

Extended by:
Configurable
Defined in:
lib/octospy.rb,
lib/octospy/url.rb,
lib/octospy/parser.rb,
lib/octospy/worker.rb,
lib/octospy/version.rb,
lib/octospy/recordable.rb,
lib/octospy/parser/gist.rb,
lib/octospy/parser/user.rb,
lib/octospy/parser/wiki.rb,
lib/octospy/configurable.rb,
lib/octospy/parser/issue.rb,
lib/octospy/parser/release.rb,
lib/octospy/parser/download.rb,
lib/octospy/extensions/string.rb,
lib/octospy/parser/repository.rb,
lib/octospy/recordable/channel.rb,
lib/octospy/parser/organization.rb,
lib/octospy/parser/pull_request.rb

Defined Under Namespace

Modules: Configurable, Extensions, Recordable, Url Classes: Parser, Worker

Constant Summary collapse

VERSION =
'0.2.0'

Constants included from Configurable

Configurable::OPTIONS_KEYS

Class Method Summary collapse

Methods included from Configurable

cinch_config_block, configure, keys, options, setup

Class Method Details

.daemonizeObject



49
50
51
52
53
54
55
56
57
# 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_botObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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.        = Octospy.
    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) ⇒ Object



17
18
19
# File 'lib/octospy.rb', line 17

def parse(event)
  Octospy::Parser.new(event).parse
end

.runObject



59
60
61
62
# File 'lib/octospy.rb', line 59

def run
  self.daemonize if Octospy.daemonize
  self.irc_bot.start
end

.worker(repositories, &block) ⇒ Object



21
22
23
# File 'lib/octospy.rb', line 21

def worker(repositories, &block)
  Octospy::Worker.new(repositories, &block)
end