Sha256: 87fd9dacf162c057e9d13f4d48de709e65f48317f56351432ae2125042286744
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
module Travis module Mailer module Helper module Build def repository_build_url(options) [Travis.config.host, options[:slug], 'builds', options[:id]].join('/') end def title(build) "Build Update for #{build.repository.slug}" end def print_build_matrix_summary(matrix) title = '# RVM Duration Status Build Log' summary_lines = matrix.map do |build| [build.number, build.config["RVM"], build_duration(build.started_at, build.finished_at), build.status, "build.link"] end title end # 1 hour, 10 minutes, and 15 seconds # 1 hour, 0 minutes, and 5 seconds # 1 minutes and 1 second # 15 seconds def duration_in_words(started_at, finished_at) # difference in seconds diff = (finished_at - started_at).to_i hours = hours_part(diff) minutes = minutes_part(diff) seconds = seconds_part(diff) time_pieces = [] time_pieces << I18n.t(:'datetime.distance_in_words.hours_exact', :count => hours) if hours > 0 time_pieces << I18n.t(:'datetime.distance_in_words.minutes_exact', :count => minutes) if hours > 0 || minutes > 0 time_pieces << I18n.t(:'datetime.distance_in_words.seconds_exact', :count => seconds) time_pieces.to_sentence end ONE_HOUR = 3600 ONE_MINUTE = 60 def hours_part(diff) diff / ONE_HOUR end def minutes_part(diff) (diff % ONE_HOUR) / ONE_MINUTE end def seconds_part(diff) diff % ONE_MINUTE end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
travis-core-0.0.1 | lib/travis/mailer/helper/build.rb |