Hi Pat et al, just implemented this:
ThinkingSphinx::Configuration.configure do |config| config.app_root = File.expand_path(File.dirname(__FILE__) + '/..') config.app_env_task = :environment end commits are there: - http://github.com/thbar/thinking-sphinx/commit/313c99c6c8ffff4b43b1eec8c49616456281cb21 (app_root) - http://github.com/thbar/thinking-sphinx/commit/43f8b9e2b158118d958f97aa4a6dcbdaa607b43f (app_env_task) After thinking about it, I decided that Rake was wide-spread enough so that a symbol or string for app_env_task would be good enough (supporting a proc wouldn't be hard though). I'm quite happy with the external API, the spec and the fact that it works; I'm less happy with the internal implementation (Configuration.reset get called twice for instance, and a reset will not memorize the block passed to configure initially). Feel free to comment, patch or suggest anything to make it better. cheers, -- Thibaut On Jan 21, 4:45 pm, Pat Allan <[email protected]> wrote: > Hi Thibaut > > What you're suggesting makes a lot of sense. If you want to get a > generic patch for it working, please, go ahead. My one suggested > change is make app_env_task accept strings or symbols indicating the > task name - Thinking Sphinx should be able to translate it to the > relevant call by itself (and if you want to make the setting accept > lambdas *as well* as strings and symbols, that'd be pretty cool too). > > Cheers > > -- > Pat > > On 11/01/2009, at 8:01 PM, Thibaut Barrère wrote: > > > > > Hi Pat, > > > toughts after a night: it would be much better not to rely on > > RAMAZE_ROOT (some thing that do not actually exist in Ramaze), but > > instead to provide extensions point. It would cover Ramaze and any > > other framework, too. > > > From what I've seen, the two extension points required today seem to > > be: > > 1/ app_root setting > > 2/ rake env task calling on app_env, if useful > > > (there is another question on how paths are build inside .conf file, > > but I'll noddle around it before suggesting something). > > > What about transforming TS so that it can let the caller configure > > itself (inversion of control) ?: > > > ThinkingSphinx::Configuration.configure do |config| > > config.app_root = my_ramaze_root > > config.app_env_task = lambda { Rake::Task[:environment].invoke } > > end > > > That would require some bits of refactoring, but would leave the > > ability to customize things for the end-user. The Rails/Merb default > > would be invoked, unless a config is provided to override it. > > > What do you think ? > > > regards, > > > -- Thibaut --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en -~----------~----~----~----~------~----~------~--~---
