jcrosby / cloudkit

An Open Web JSON Appliance
http://getcloudkit.com
MIT License
303 stars 33 forks source link

CloudKit crash if rack >= 1.4 is installed #3

Open prathe opened 12 years ago

prathe commented 12 years ago

I wanted to try the curl demo

and the following command crashed

$ rackup config.ru

/Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/cloudkit-0.11.2/lib/cloudkit/rack/builder.rb:43:in `expose': undefined method `<<' for nil:NilClass (NoMethodError)
  from /Users/prathe/src/demo/cloudkit/config.ru:3:in `block in <main>'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
  from /Users/prathe/src/demo/cloudkit/config.ru:1:in `new'
  from /Users/prathe/src/demo/cloudkit/config.ru:1:in `<main>'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/bin/rackup:19:in `load'
  from /Users/prathe/.rbenv/versions/1.9.2-p290/bin/rackup:19:in `<main>'

I had rack 1.4.1 installed and after

$ gem uninstall -v '>=1.4' rack

I had no problems

prathe commented 12 years ago

Even with this fix, the rackup binary won't load the specified Rack version since it looks like this:

#!/usr/bin/env ruby

require "rack"
Rack::Server.start

This is an inline rackup replacement that will load the good rack version.

$ ruby -e "gem 'rack', '=1.3.6'; require 'rack'; Rack::Server.start" config.ru

You may have to adjust the rack version specified above depending on which rack version you have installed.