jakeboxer / hyperloop

Make simple websites with a technology stack familiar to Rails programmers.
MIT License
72 stars 4 forks source link

Add live reload in development/test #15

Closed jakeboxer closed 10 years ago

jakeboxer commented 10 years ago

This branch adds live reloading when RACK_ENV != "production", as requested in #14.

The bulk of this pull involves tweaking the fixture setup. Instead of reading a fixture directly from spec/fixtures/:name, the fixture is copied to tmp/spec/fixtures/:name, where it can then be freely modified without fucking up the original fixture. This way, we can do tests where we change the fixture and make sure live-reloading works as expected.

Note: there's a weird intermittent bug in the tests. Something like 10% of the time, live reloading will work for assets when in production, even though it shouldn't. I gotta talk to someone who knows more about Sprockets; I'm pretty sure Sprockets is doing its own live-reloading in production, and I need to figure out how to turn it off. That can be done in a separate PR though.

For now, live reloading of assets may still happen in production. As far as I can tell, there's no way to turn it off in Sprockets, and turning it off is just an optimization, so let's leave it on until we decide that asset requests are too slow.

/cc @fabianperez @jessicard

jessicard commented 10 years ago

Looks good :thumbsup:

fabianperez commented 10 years ago

:+1: thank you for doing the needful