Skip to content

Instantly share code, notes, and snippets.

@will
Created June 16, 2009 22:27
Show Gist options
  • Save will/130946 to your computer and use it in GitHub Desktop.
Save will/130946 to your computer and use it in GitHub Desktop.
require 'metric_fu'
task "metrics:all" do
require 'yaml'
require 'couchrest'
require 'grit'
report = File.open( File.join( RAILS_ROOT, "tmp", "metric_fu", "report.yml") ) { |f| YAML::load f }
repo = Grit::Repo.new(Dir.pwd)
commit = repo.commits.first
record = {
"_id" => commit.id,
:message => commit.message,
:date => commit.date,
:committer => { :name => commit.committer.name, :email => commit.committer.email },
:report => report
}
db = CouchRest.database!("http://localhost:5984/metric_fu")
begin
db.save_doc record
rescue RestClient::RequestFailed
record["_rev"] = db.get(record["_id"])["_rev"]
db.save_doc record
end
end
@brynary
Copy link

brynary commented Nov 11, 2011

Awesome. Let me know how it goes. If you have any feedback I'd love to hear it!

-Bryan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment