Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3754848
D506.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D506.diff
View Options
diff --git a/tommy.rb b/tommy.rb
--- a/tommy.rb
+++ b/tommy.rb
@@ -18,24 +18,31 @@
property :last_failed_url
property :colour
+ def self.parse_project(project)
+ Project.new(
+ name: project['displayName'].tr('-', ' '),
+ build_score: project['healthReport'].first['score'].to_i,
+ last_build_number: project['builds'].first['number'],
+ last_build_url: (project['lastBuild'].blank? ? '' : project['lastBuild']['url']),
+ last_stable_build: (project['lastStableBuild'].blank? ? '' : project['lastStableBuild']['number']),
+ health_report: project['healthReport'].first['description'],
+ last_complete_url: (project['lastCompletedBuild'].blank? ? '' : project['lastCompletedBuild']['url']),
+ last_failed_url: (project['lastFailedBuild'].blank? ? '' : project['lastFailedBuild']['url']),
+ colour: project['color']
+ )
+ end
+
def self.parse_incoming_json(json)
returned_projects = []
projects = json['jobs']
projects.each do |project|
next unless project['buildable']
-
- returned_projects << Project.new(
- name: project['displayName'].tr('-', ' '),
- build_score: project['healthReport'].first['score'].to_i,
- last_build_number: project['builds'].first['number'],
- last_build_url: (project['lastBuild'].blank? ? '' : project['lastBuild']['url']),
- last_stable_build: (project['lastStableBuild'].blank? ? '' : project['lastStableBuild']['number']),
- health_report: project['healthReport'].first['description'],
- last_complete_url: (project['lastCompletedBuild'].blank? ? '' : project['lastCompletedBuild']['url']),
- last_failed_url: (project['lastFailedBuild'].blank? ? '' : project['lastFailedBuild']['url']),
- colour: project['color']
- )
+ begin
+ returned_projects << parse_project(project)
+ rescue
+ next
+ end
end
return returned_projects
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 10:25 (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2252396
Default Alt Text
D506.diff (1 KB)
Attached To
Mode
D506: When no health information is available for a project, for example because it's new, there is no real point to include it to our dashboard.
Attached
Detach File
Event Timeline
Log In to Comment