tobiassvn/sidetiq — pull request #67 by plukevdh (2014-01-31 16:37:04+00:00)
Title: Fix for use with sinatra-cache

seeing an issue where sinatra-cache takes over the rendering path and
using `File.dirname` from the view is somewhere deep within the cache
gem root. this ensures we have the right path. The error looks like the following:

```
rrno::ENOENT - No such file or directory - /Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bundler/gems/sinatra-cache-9996b52a6593/lib/sinatra/views/assets/styles.css:
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bundler/gems/sinatra-cache-9996b52a6593/lib/sinatra/templates.rb:39:in `read'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bundler/gems/sinatra-cache-9996b52a6593/lib/sinatra/templates.rb:39:in `block in singleton class'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bundler/gems/sinatra-cache-9996b52a6593/lib/sinatra/templates.rb:33:in `instance_eval'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bundler/gems/sinatra-cache-9996b52a6593/lib/sinatra/templates.rb:33:in `singleton class'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bundler/gems/sinatra-cache-9996b52a6593/lib/sinatra/templates.rb:31:in `__tilt_70199651198680'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bundler/gems/sinatra-cache-9996b52a6593/lib/sinatra/templates.rb:40:in `render'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:664:in `erb'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sidetiq-0.5.0/lib/sidetiq/web.rb:17:in `block in registered'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1593:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1593:in `block in compile!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:957:in `[]'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:957:in `block (3 levels) in route!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:976:in `route_eval'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/sinatra.rb:133:in `route_eval_with_newrelic'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:957:in `block (2 levels) in route!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:997:in `block in process_route'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:995:in `catch'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:995:in `process_route'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/sinatra.rb:116:in `process_route_with_newrelic'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:955:in `block in route!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:954:in `each'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:954:in `route!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1067:in `block in dispatch!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in `block in invoke'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in `catch'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in `invoke'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1064:in `dispatch!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/sinatra.rb:151:in `dispatch_and_notice_errors_with_newrelic'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/sinatra.rb:146:in `block in dispatch_with_newrelic'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:339:in `perform_action_with_newrelic_trace'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/sinatra.rb:143:in `dispatch_with_newrelic'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:889:in `block in call!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in `block in invoke'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in `catch'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in `invoke'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:889:in `call!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:877:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/rack/error_collector.rb:50:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/rack/browser_monitoring.rb:23:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/newrelic_rpm-3.7.1.182/lib/new_relic/rack/agent_hooks.rb:28:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-protection-1.5.1/lib/rack/protection/xss_header.rb:18:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-protection-1.5.1/lib/rack/protection/path_traversal.rb:16:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-protection-1.5.1/lib/rack/protection/json_csrf.rb:18:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-protection-1.5.1/lib/rack/protection/base.rb:50:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-protection-1.5.1/lib/rack/protection/base.rb:50:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-protection-1.5.1/lib/rack/protection/frame_options.rb:31:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:180:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:2004:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1469:in `block in call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1778:in `synchronize'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/sinatra-1.4.4/lib/sinatra/base.rb:1469:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-1.5.2/lib/rack/urlmap.rb:65:in `block in call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `each'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `call'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/connection.rb:82:in `block in pre_process'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/connection.rb:80:in `catch'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/connection.rb:80:in `pre_process'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/connection.rb:55:in `process'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/faye-websocket-0.7.2/lib/faye/adapters/thin.rb:40:in `process'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/connection.rb:41:in `receive_data'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/faye-websocket-0.7.2/lib/faye/adapters/thin.rb:44:in `receive_data'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/backends/base.rb:73:in `start'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/server.rb:162:in `start'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/controllers/controller.rb:87:in `start'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/runner.rb:200:in `run_command'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/lib/thin/runner.rb:156:in `run!'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/gems/thin-1.6.1/bin/thin:6:in `'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bin/thin:23:in `load'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bin/thin:23:in `

'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bin/ruby_noexec_wrapper:14:in `eval'
11:24:06 web.1 |	/Users/lvanderhoeven/.rvm/gems/ruby-2.0.0-p247@train_wreck/bin/ruby_noexec_wrapper:14:in `

'
```