rack

Posting a large body crashes our stack -- but only in production mode?

Our Rails application has two environments that we deploy to servers a Staging environment and the default Production environment. The staging.rb file is a copy of the production.rb form the config/environments folder. The difference between the two is whiny nils is set to true: config.whiny_nils = true Since the rails application ...

Using Rack::Session::Datamapper

mkristgan's rack_datamapper gem says that it "can be wrapped to be used in a specific environement, i.e. Rack::Session::Datamapper". Unfortunately, I don't know quite enough about Ruby to accomplish this task yet –Modules/Classes in Ruby are still above my head (coming from PHP). Can anyone offer assistance with using rack_datamapper...

Having trouble debugging Sinatra app in production

Hello Stackies, I'm deploying a Sinatra app using passenger. The deployed app is working, but not entirely: some paths work fine, others simply render a blank page. I can't seem to find any major differences between the routes that work and the routes that don't, and I can't seem to track down any errors.. Handlers I have defined the ...

Re-entrant subrequests in Rack/Rails

I've got a couple Engine plugins with metal endpoints that implement some extremely simple web services I intend to share across multiple applications. They work just fine as they are, but obviously, while loading them locally for development and testing, sending Net::HTTP a get_response message to ask localhost for another page from ins...

Ruby 1.9 encoding problems with Sinatra and Rack

For giggles I tried to start my blog using ruby 1.9. All the gems compile and work, but I crank it up and open it in a browser, I get this: Many newlines I haven't found any useful information regarding this. Code for the application is located here ...

Ruby Based Blogging Engine

What Rack enabled blogging engines exist? I want to deploy a free blog to heroku and need more customizabilty than the free hosting of Wordpress.com or Blogerty provide. Also in another note, has anyone tried to port Wordpress to Ruby? ...

Ruby bindings for a server-side javascript engine ?

I'd like my rack application to be able to interface with a server-side javascript engine. As of now the only way i know this could be possible, is by running JRuby and Rhino on the JVM, but I'm hoping for a leaner solution. Has anyone heard of another, more rubyish perhaps, option ? Edit : Reading the comments I'm starting to think ...

How to use ruby thin with CGI scripts?

I've written some ruby CGI scripts (using the Ruby CGI class) that I serve from my production server using lighttpd. I want to test them on my development server using thin. Basically, I want to drop all my CGI scripts in a directory and start thin in that directory. Then, any requests to http://localhost:3000/<script> should just exe...

Sinatra on Rack under Passenger returning 0-byte pages

I'm trying to write a Sinatra app that will run on a shared Passenger server. For now, I'd be happy just getting a "hello world", but something isn't working quite right. I have: config.ru require 'vendor/sinatra-lib/sinatra.rb' set :environment, :production disable :run require 'myapp.rb' run Sinatra::Application myapp.rb get '/...

Bypassing rack version error using Rails 2.3.5

I'm currently on Dreamhost attempting to run a Rails 2.3.5 app. Here is the situation, Dreamhost's servers have Rails 2.2.2 installed. Of course, I can't update a shared host's rails version, so I froze my Rails in vendor. Rails 2.3.5 requires the rack v1.0.1 gem. Dreamhost uses the rack v1.0.0 gem. So when I try to define: config.gem ...

Sinatra/Rack Sleep until Response Ready (like Exchange ActiveSync)

I'm wanting to do a lightweight push-style HTTP response in my existing Sinatra web app. Is there any mechanism that allows me to not respond to an HTTP request and keep the connection open until I wake up the connection at a future time? ...

Sinatra + Rack:Session:Pool

I am using Rack:Session:Pool for memory based sessions. I would like to access the pool instance variables that is contacted in Rack:Session:Pool so I can see all the active session and contained data. How can I do that from within Sinatra or on the irb prompt. my initial thought was ::Sinatra:Application::Rack::Session:Pool, but that s...

Reloading Sinatra app on every request on Windows

I've set up Rack::Reload according to this thread # config.ru require 'rubygems' require 'sinatra' set :environment, :development require 'app' run Sinatra::Application # app.rb class Sinatra::Reloader < Rack::Reloader def safe_load(file, mtime, stderr = $stderr) if file == Sinatra::Application.app_file ::Sinatra::Appli...

Testing controller instance variables with Rack::Test and Sinatra

I have a Sinatra app that serves pages as read-only or editable depending on if the user is logged in. The controller sets a variable @can_edit, that is used by the views to hide/show edit links. How can I test @can_edit's value in my tests? I have no idea how to get at the current instance of the controller under Rack::Test. I use cl...

Sinatra / Rack fails with non-ascii characters in url

I am getting Encoding::UndefinedConversionError at /find/Wrocław "\xC5" from ASCII-8BIT to UTF-8 For some mysterious reason sinatra is passing the string as ASCII instead of UTF-8 as it should. I have found some kind of ugly workaround... I don't know why Rack assumes the encoding is ASCII-8BIT ... anyway, a way is to use string.forc...

Rails rack 1.0 error

Hi! I have this error when I try to start script/server: /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems.rb:827:in `report_activate_error': RubyGem version error: rack(1.0.0 not ~> 1.0.1) (Gem::LoadError) from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems.rb:261:in `activate' from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems.rb:68:in `ge...

Sinatra on Passenger always fails on first attempt

I have a small Sinatra app I'm running on a shared hosting account using Passenger. However, the first time the app is accessed after a while, I get a Passenger error page saying the application could not be started. Usually because Sinatra could not be found. I am assuming this is just a normal delay from when a new instance is spawned...

Rack::Session:Cookie error using Sinatra, Thin, Rails, and Rack::Cascade

I have a combined Sinatra/Rails app that shares a session using Rack::Session::Cookie. The app works fine when started with Rack::Handler::Thin.run app, but if the rackup file is start with thin start, I get an error in Rack::Session::Cookie: !! Unexpected error while processing request: no marshal_dump is defined for class Proc no mar...

Where should I set HTTP headers, such as Expires?

I want to deploy an app using Sinatra on Phusion Passenger w/ nginx. If I want to set the Expires header on my static content - stylesheets, say - there are appear to be three places where I could accomplish this. In my Sinatra app, using the API With Rack middleware In the server config for my deployment Which of these methods is t...

Rack rSpec Controller Tests with Rack Middleware issue

Howdy, I'm having big trouble testing with rSpec's controller API. Right now I'm using a middleware authentication solution (Warden), and when I run the specs, the proxy added by the middleware is not there, and all the authentication tests are throwing NilPointerExceptions all over the place. It seems rSpec is not adding the middlewar...