Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3783017
D478.id1168.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D478.id1168.diff
View Options
diff --git a/tommy.rb b/tommy.rb
--- a/tommy.rb
+++ b/tommy.rb
@@ -23,28 +23,30 @@
projects = json['jobs']
projects.each do |project|
- next if !project['buildable']
+ next unless project['buildable']
- returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
- :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'])
+ 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']
+ )
end
return returned_projects
end
- def is_green?
- self.last_stable_build == self.last_build_number
+ def green?
+ last_stable_build == last_build_number
end
- def is_building?
- self.colour.include?('anime')
+ def building?
+ colour.include?('anime')
end
end
@@ -58,7 +60,7 @@
helpers do
def css_for_project(project)
score = project.build_score
- if project.is_green?
+ if project.green?
if score == 100
'best'
elsif score >= 80
@@ -70,7 +72,7 @@
else
'worse'
end
- elsif project.is_building?
+ elsif project.building?
'building'
else
'worst'
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 01:44 (4 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2265178
Default Alt Text
D478.id1168.diff (2 KB)
Attached To
Mode
D478: Style: better compliance with community Ruby coding style guide
Attached
Detach File
Event Timeline
Log In to Comment