Method: Integrations::IrkerWorker#perform

Defined in:
app/workers/integrations/irker_worker.rb

#perform(project_id, channels, colors, push_data, settings) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/workers/integrations/irker_worker.rb', line 16

def perform(project_id, channels, colors, push_data, settings)
  # Establish connection to irker server
  return false unless start_connection(
    settings['server_host'],
    settings['server_port']
  )

  @project = Project.find(project_id)
  @colors = colors
  @channels = channels

  @repo_path = @project.full_path
  @repo_name = push_data['repository']['name']
  @committer = push_data['user_name']
  @branch = push_data['ref'].gsub(%r{refs/[^/]*/}, '')

  if @colors
    @repo_name = "\x0304#{@repo_name}\x0f"
    @branch = "\x0305#{@branch}\x0f"
  end

  # First messages are for branch creation/deletion
  send_branch_updates(push_data)

  # Next messages are for commits
  send_commits(push_data)

  close_connection
  true
end