On Wed, Jan 2, 2013 at 7:02 PM, Koaps Freeman <koapsfree...@gmail.com> wrote:
> Hi Guys,
> I just started playing with camping and so far it's pretty awesomo.
> After much messing around I was finally able to get Apache Passenger,
> Camping and ActiveRecord to PostgreSQL working.
> One thing I was wondering about, can I use reloader with Apache Passenger?
> Always having to touch/rm a tmp/restart.txt to see changes or reloading
> apache altogether is kinda a pain and I was hoping I can use reloader to
> just detect changes to make recovering from errors faster as I type code.
> I saw some previous post about using reloader:
> http://rubyforge.org/pipermail/camping-list/2010-August/001378.html
> Which used on_reload which doesn't seem to exist anymore.
> I'm still learning rack/rails stuff so not really sure how to setup my
> config.ru to use reloader.
> In the reference it says:
>  require 'camping/reloader'
>   reloader = Camping::Reloader.new('/path/to/yourapp.rb')
>   blog = reloader.apps[:Blog]
> The blog object will behave exactly like your
> Blog and Wiki, but they will update themselves if yourapp.rb changes.
> I'm not sure how I get passenger to then run the blog from the config.ru
> Thanks

Something like this should work:

# config.ru:
require 'camping'
require 'camping/reloader'

class CampingRunner
  def initialize(path, name)
    @reloader = Camping::Reloader.new(path)
    @name = name

  def call(env)
    app = @reloader.apps[@name]
    raise "Could not find app: #{@name}" if app.nil?

run CampingRunner.new('blog.rb', :Blog)
Camping-list mailing list

Reply via email to