Created
June 16, 2009 22:27
-
-
Save will/130946 to your computer and use it in GitHub Desktop.
This file contains 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome. Let me know how it goes. If you have any feedback I'd love to hear it!
-Bryan