spork 0.9.0.rc9 doesn't reload sinatra files nested in a rails3 app #132

Open
ajsharp opened this Issue Jul 26, 2011 · 1 comment

Projects

None yet

2 participants

@ajsharp
ajsharp commented Jul 26, 2011

We have a sinatra app nested inside of a rails 3 app, and the files don't reload like rails models do. Of course, they don't get reloaded in dev like the rest of rails does, so this may be a separate issue...

nbraem commented Oct 10, 2012

I have a Sinatra app mounted in my Rails routes. I have reloading working with Spork for testing. Here's how:

  • Sinatra app is autoloaded from lib folder (filename and module name need to match, e.g. lib/sinatra_app and SinatraApp::App). In routes.rb:
mount SinatraApp::App => "/sinatra"
  • Spork reloads routes when forking:
Spork.prefork do
  Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
end
Spork.each_run do
  load Rails.root.join("config/routes.rb")
end
  • Sinatra app reloads itself on change using Sinatra::Reloader
class SinatraApp < Sinatra::Base
  register Sinatra::Reloader
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment