square / fdoc

Documentation format and verification
Other
379 stars 59 forks source link

Custom Fdoc.service_path is broken in scaffold mode #4

Closed grossbart closed 12 years ago

grossbart commented 12 years ago

In Fdoc::Service a DefaultService is created:

DefaultService = self.new(Fdoc::DEFAULT_SERVICE_PATH)

This uses the constant DEFAULT_SERVICE_PATH which has nothing to do with the Fdoc.service_path setting. This is normally not a problem, but as soon as we try to test with scaffold mode on (FDOC_SCAFFOLD=true) and the Fdoc.service_path is different from the default, an exception is being thrown:

No such file or directory - docs/fdoc
fdoc-0.2.3/lib/fdoc/service.rb:20:in `mkdir'
fdoc-0.2.3/lib/fdoc/service.rb:20:in `initialize'
fdoc-0.2.3/lib/fdoc/service.rb:30:in `new'
fdoc-0.2.3/lib/fdoc/service.rb:30:in `<class:Service>'
fdoc-0.2.3/lib/fdoc/service.rb:4:in `<top (required)>'
fdoc-0.2.3/lib/fdoc.rb:37:in `require'
fdoc-0.2.3/lib/fdoc.rb:37:in `<top (required)>'

By just removing the DefaultService things start to work again, so my question is: is the DefaultService really needed? It seems to be quite difficult to get a configuration for Fdoc.service_path in there before the DefaultService is created.

zachmargolis commented 12 years ago

I think you're right, DefaultService is probably not needed, but was useful for testing at the time.

I made a change and put it on the change-default-service branch, it changes the default service to be lazy-loaded from Fdoc.service_path, which should hopefully help with your ordering problem.

Please check it out and let me know if that fixes things.

chris-baynes commented 12 years ago

I had the same problem, and this fixes it for me. Any chance of merging this?

zachmargolis commented 12 years ago

Yup, I'll do that now, was waiting on confirmation it actually fixed the problem.

zachmargolis commented 12 years ago

Done: 9678ab8a1048146879553651067f47015340566e

grossbart commented 12 years ago

Thanks for confirming this, Chris, and for the patch Zach! I'm sorry I didn't confirm this earlier, but I'm on a holiday and wanted to wait until I could confirm it in code, not just theoretically... Cheers, Peter

Am 15.08.2012 um 19:01 schrieb "Zach Margolis" notifications@github.com:

Done: 9678ab8

— Reply to this email directly or view it on GitHub.