Module: Slatan

Defined in:
lib/slatan.rb,
lib/slatan/ear.rb,
lib/slatan/heart.rb,
lib/slatan/mouth.rb,
lib/slatan/spirit.rb,
lib/slatan/version.rb,
lib/slatan/buttocks.rb,
lib/slatan/mouth/im.rb,
lib/slatan/mouth/api.rb,
lib/slatan/mouth/ext.rb,
lib/slatan/mouth/rtm.rb,
lib/slatan/mouth/auth.rb,
lib/slatan/mouth/chat.rb,
lib/slatan/mouth/mpim.rb,
lib/slatan/mouth/pins.rb,
lib/slatan/mouth/team.rb,
lib/slatan/affiliation.rb,
lib/slatan/mouth/emoji.rb,
lib/slatan/mouth/files.rb,
lib/slatan/mouth/stars.rb,
lib/slatan/mouth/users.rb,
lib/slatan/mouth/groups.rb,
lib/slatan/mouth/channels.rb,
lib/slatan/mouth/ext/chat.rb,
lib/slatan/mouth/reactions.rb,
lib/slatan/utils/string_ex.rb,
lib/slatan/affiliation/self.rb,
lib/slatan/affiliation/team.rb,
lib/slatan/utils/integer_ex.rb,
lib/slatan/affiliation/users.rb,
lib/slatan/affiliation/channels.rb,
lib/slatan/affiliation/sub_teams.rb

Defined Under Namespace

Modules: Affiliation, Ear, Mouth, Utils Classes: Buttocks, Heart, Spirit

Constant Summary collapse

VERSION =
"0.2.2"

Class Method Summary collapse

Class Method Details

.daemonizeObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/slatan.rb', line 31

def daemonize
  begin
    Process.daemon

    File.open(Spirit.pid_file_path, 'w') do |f|
      f << Process.pid
    end
  rescue => e
    Buttocks.fatal "failed to daemonize slatan.(#{e.message})"
    exit
  end
end

.run(options = {}) ⇒ Object

running slatan

Parameters:

  • options (defaults to: {})

    daemonize: running on daemon mode(default false)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/slatan.rb', line 14

def run(options = {})
  {
    daemonize: false
  }.merge(options)

  Buttocks.init

  @heart = Heart.new

  begin
    daemonize if options[:daemonize]
    @heart.beat
  rescue => e
    Buttocks.fatal "#{e.backtrace.first}: #{e.message} (#{e.class})"
  end
end