supermatter/reviewthis — Issue #8: Not getting user from GitHub
Author: garethr
Created: 2012-01-15 18:39:06+00:00
State: open

Pushing the latest source to heroku gives me an error when I try and hit it from a post commit hook.

012-01-15T18:08:10+00:00 app[web.1]: URI::InvalidURIError - bad URI(is not URI?): /user/show/["garethr"]:
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/1.9.1/uri/common.rb:156:in `split'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/1.9.1/uri/common.rb:628:in `parse'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/httparty-0.4.5/lib/httparty/request.rb:19:in `path='
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/httparty-0.4.5/lib/httparty/request.rb:11:in `initialize'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/1.9.1/uri/common.rb:174:in `parse'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/httparty-0.4.5/lib/httparty.rb:136:in `get'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/octopussy-0.2.3/lib/octopussy/client.rb:354:in `get'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/httparty-0.4.5/lib/httparty.rb:171:in `new'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/httparty-0.4.5/lib/httparty.rb:171:in `perform_request'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/octopussy-0.2.3/lib/octopussy/client.rb:23:in `user'
2012-01-15T18:08:10+00:00 app[web.1]: /app/reviewthis.rb:84:in `block (3 levels) in '
2012-01-15T18:08:10+00:00 app[web.1]: /app/reviewthis.rb:83:in `scan'
2012-01-15T18:08:10+00:00 app[web.1]: /app/reviewthis.rb:83:in `block (2 levels) in '
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:in `block in route'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `instance_eval'
2012-01-15T18:08:10+00:00 app[web.1]: /app/reviewthis.rb:63:in `each'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `route_eval'
51 end
2012-01-15T18:08:10+00:00 app[web.1]: /app/reviewthis.rb:63:in `block in '
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `catch'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `block in route!'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `route!'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `each'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `block in invoke'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:601:in `dispatch!'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `block in call!'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `catch'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:500:in `block (2 levels) in route!'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/commonlogger.rb:20:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchronize'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /home/heroku_rack/lib/static_assets.rb:9:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /home/heroku_rack/lib/last_access.rb:15:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/methodoverride.rb:24:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:52:in `block in call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:46:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /home/heroku_rack/lib/date_header.rb:14:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `block in call'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/builder.rb:134:in `call'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:76:in `block in pre_process'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:74:in `catch'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:74:in `pre_process'
2012-01-15T18:08:10+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:46:in `each'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:57:in `process'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:42:in `receive_data'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/backends/base.rb:57:in `start'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/server.rb:156:in `start'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:80:in `start'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:177:in `run_command'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `

'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `load'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:143:in `run!'
2012-01-15T18:08:10+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/bin/thin:6:in `'
2012-01-15T18:08:10+00:00 app[web.1]: 207.97.227.253, 127.0.0.1 - - [15/Jan/2012 10:08:10] "POST / HTTP/1.0" 500 30 0.0137
2012-01-15T18:08:10+00:00 heroku[router]: POST stormy-ice-7457.heroku.com/ dyno=web.1 queue=0 wait=0ms service=25ms status=500 bytes=30

The line in the code which causes the error is this one:

user = Octopussy.user(username)

Apparently due to the fact that username is actually an array.

Paraphrasing the code:

USER = /[^a-z0-9_]@([a-z0-9_]+)/i
m = "fabric commands for executing arbitrary commands #reviewthis @garethr"
m.scan(USER) do |username|
puts username.class
end
>> Array

I've fixed this locally with:

user = Octopussy.user(username.first)