Created
April 16, 2015 15:42
-
-
Save cbartlett/9dbb1c727c4659a9a774 to your computer and use it in GitHub Desktop.
How often do you deploy to Heroku?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Copyright 2015 Colin Bartlett, Inc. | |
# MIT Licensed: http://opensource.org/licenses/MIT | |
# Usage: ./average_deploy.rb your-heroku-app-name | |
require 'time' | |
dates = `heroku releases -n 50 -a #{ARGV[0]} | grep Deploy` | |
.split("\n") | |
.map { |s| s.match(/[\d]{4}\/[\d]{2}\/[\d]{2} [\d]{2}\:[\d]{2}\:[\d]{2}/).to_s } | |
seconds = dates.each.with_index.reduce([]) do |a,(d,i)| | |
if i != dates.size-1 | |
a << Time.parse(d).to_i - Time.parse(dates[i+1]).to_i | |
end | |
a | |
end.instance_eval { reduce(:+) / size.to_f } | |
puts "Average time between deploys:" | |
puts "#{seconds.to_i} seconds" | |
puts "aka #{(seconds / 60).to_i} minutes" | |
puts "aka #{(seconds / 60 / 60).round(2)} hours" | |
puts "aka #{(seconds / 60 / 60 / 24).round(2)} days" | |
puts | |
puts "You deploy an average of #{ (1 / (seconds / 60 / 60 / 24)).round(2)} times per day" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment