Skip to content

Commit

Permalink
update reloading section
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Dec 13, 2012
1 parent ae2c300 commit 7617305
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions faq.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,33 @@ Frequently Asked Questions
* this will become the toc
{:toc}

What happened to reloading in Sinatra 0.9.2? {#reloading}
--------------------------------------------
How do I make my Sinatra app reload on changes? {#reloading}
-----------------------------------------------

Source file reloading was removed in the 0.9.2 due to excess complexity.
First off, in-process code reloading in Ruby [is hard](http://rkh.im/code-reloading)
and having a solution that works for every scenario is technically impossible.

For reloading Sinatra we recommend either using the
[reloader](/contrib/reloader) or
[shotgun](http://rtomayko.github.com/shotgun/).
Which is why we recommend you to do out-of-process reloading.

The reloader will reload single files that changed, whereas shotgun will
restart the HTTP server on every request. See ["Reloading Ruby
Code"](http://rkh.im/code-reloading) to learn more about the differences.
First you need to install [rerun](https://github.com/alexch/rerun) if you haven't already:

$ gem install rerun

Now if you start your Sinatra app like this:

$ ruby app.rb

All you have to do for reloading is instead do this:

$ rerun 'ruby app.rb'

If you are for instance using `rackup`, instead do the following:

$ rerun 'rackup'

You get the idea.

If you still want in-process reloading, check out [Sinatra::Reloader](/contrib/reloader).

What are my deployment options? {#deploy}
-------------------------------
Expand Down

5 comments on commit 7617305

@TrevorBramble
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkh Shouldn't we offer reloader as the default, and rerun as an alternative? I hadn't even heard of rerun and was confused by the confusion in this Rogues episode. http://rubyrogues.com/116-rr-non-rails-projects/ (about 20:00:00).

I'll rewrite if agreeable.

@rkh
Copy link
Member Author

@rkh rkh commented on 7617305 Aug 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... dunno. I actually think rerun is the better solution.

@zzak
Copy link
Member

@zzak zzak commented on 7617305 Aug 10, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never had an issue with Sinatra::Reloader, but what does everyone think of deprecating it to the old sinatra-reloader gem and cleaning up contrib a little?

@rkh
Copy link
Member Author

@rkh rkh commented on 7617305 Aug 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, wait, I don't think it's an issue with the sinatra-contrib reloader vs the old reloader, but more about in-process reloading not working very well in Ruby.

@zzak
Copy link
Member

@zzak zzak commented on 7617305 Aug 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkh I mean to move it out of sinatra-contrib, those that want (and can) use it will need to install sinatra-reloader.

This will help us in the sense that we no longer deal with it in contrib. But the problem still exists in Ruby.

Please sign in to comment.