Reloader paths/

carmen _ at whats-your.name
Tue Jun 19 15:20:38 EDT 2007


after investigating why the reloader wasnt working , i discovered 2 probs, one of which was sorta my fault (but will likely happen to others who make one-file apps)

first, my app was like this:

#!/usr/bn/env ruby

%w{applib1 applib2 digest/md80 airbus}.each{|r| require r}}

if __FILE__ == $0
  Mongrel.config do
     handler '/', Camping.reloader.new(__FILE__)
  end
end


not exactly sure how it wraps the run request, since it mainly returns a constant name. but even so, the files are already required. maybe reloader should record the current $LOADED_FEATURES as soon as its loaded so even stuff later in the require line gets recorded.. im not sure where camping draws the line for 'too magic', but i think its somewhere like ' i havent seen a blaze mark on a tree in a few miles, but theres sort of a path here, maybe made by native chipmunks, so im going to follow it...'

even as i reworked the app structure on disk, to have a front layer that just does the launching (defeating the single file thing) it still wasnt loading. 

, its matching /^file.basename(scriptname)/,. so unless you have appname.rb then appname/ for further stuff (which doesnt contain your entire app in a dir), it breaks. one solution would be to expand the path of the requires, then compare File.dirname.. 


anyone have any preferences on whether the former or the latter technique is a less world-changing solution? would either one break/fix RV / TentSteak / CampingServer?



More information about the Camping-list mailing list