Module: Integrity::Integritray::Helpers

Defined in:
lib/integrity/integritray.rb

Instance Method Summary collapse

Instance Method Details

#activity(status) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/integrity/integritray.rb', line 20

def activity(status)
  case status
  when :success, :failed then 'Sleeping'
  when :pending then 'Building'
  else 'Sleeping'
  end
end

#build_status(status) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/integrity/integritray.rb', line 28

def build_status(status)
  case status
  when :success, :pending then 'Success'
  when :failed then 'Failure'
  else 'Unknown'
  end
end

#xml_opts_for_project(project) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/integrity/integritray.rb', line 6

def xml_opts_for_project(project)
  opts = {}
  opts['name']     = project.name
  opts['category'] = project.branch
  opts['activity'] = activity(project.last_build.status) if project.last_build
  opts['webUrl']   = project_url(project)
  if project.last_build
    opts['lastBuildStatus'] = build_status(project.last_build.status)
    opts['lastBuildLabel']  = project.last_build.commit.short_identifier
    opts['lastBuildTime']   = project.last_build.completed_at
  end
  opts
end