Here's another option, one you may have considered already.

Extension routes are loaded before the Radiant routes and all of this is 
taken care of by Radiant::Initializer.  You could either extend 
Radiant::Initializer or use the define_routes block in the extension to 
load the primary routes.rb.  I'm not sure whether you should parse, 
process, and eval it or some other method, but it is conceivably 
possible.  I think it has to do with generators or rake tasks, but 
Radiant does something similar to redefine some stock Rails stuff.

Sean

Matt Parrish wrote:
> Okay, cool.  As for the routes, my extension currently has the user  
> modify config/routes.rb a bit since /vendor/radiant/config/routes.rb  
> calls the Rails route initialization.  If we could change it so that  
> Radiant hooks into that process differently, then the developer can  
> write config/routes.rb as is done traditionally.  It doesn't look  
> like the Rails guys have given an easy way to hook into that process,  
> although it could easily be a one line call to Radiant to load its  
> routes at the end of the ActionController::Routing::Routes.draw { | 
> map| } block.  However Radiant's /vendor/radiant/config/routes.rb  
> would need to change slightly to be like how extensions define routes.
>
> Here's the change I see.  Instead of how Radiant currently does  
> config/routes.rb and vendor/radiant/config/routes.rb as
>
> load File.join(RADIANT_ROOT, "config", "routes.rb")
>
> and
>
> ActionController::Routing::Routes.draw do |map|
>
>    # Admin Routes
>    map.with_options(:controller => 'admin/welcome') do |welcome|
>
>    ...
>
> end
>
>
> respectively.  It could look like this:
>
> ActionController::Routing::Routes.draw do |map|
>
>    # Place for Rails Routes
>    map.with_options(:controller => 'admin/welcome') do |welcome|
>    ...
>
>    RadiantRoutes.define_routes(map)
> end
>
> and
>
> class RadiantRoutes
>    def self.define_routes(map)
>
>    # Admin Routes
>    map.with_options(:controller => 'admin/welcome') do |welcome|
>
>    ...
>
>    end
> end
>
> What do you think about making a change like that?  We would just  
> need to make sure that config/routes.rb can see the RadiantRoutes  
> class.  It wouldn't affect the current Radiant usage, but would allow  
> for developers to work with config/routes.rb like normal.  The  
> RadiantOnRails extension is like the first solution, except that I  
> have the user create a class RailsRoutes with a define_routes method  
> that my extension calls.  I think the second solution here would be  
> preferred.
>
> Matt Parrish
> http://www.pearware.org
>
>
> On Jun 2, 2007, at 9:52 AM, Sean Cribbs wrote:
>
>   
>> The stock environment.rb and boot.rb will load Radiant from
>> vendor/radiant automatically.  The challenge of course, would be  
>> loading
>> the proper routes and adding the traditional app directories to the  
>> load
>> path.  I think you guys already have that, no?
>>
>> The other issue is that Radiant radically alters the bootup process  
>> and
>> needs to do so for the purpose of loading extensions.  It's my guess
>> that if you put it in vendor/plugins/radiant, things are going to be
>> much harder to hook up.
>>
>> Sean
>>
>> Matt Parrish wrote:
>>     
>>> Oh, I guess I didn't realize that vendor/radiant would be any easier
>>> than vendor/plugins/radiant.  How would that change things?  If it's
>>> in vendor/radiant, don't we have to get into config/environment.rb or
>>> config/boot.rb to load radiant, whereas if it was in vendor/plugins/
>>> radiant, then Rails would automatically start initializing it
>>> (although I'm not sure at what part of the process it would do that)?
>>>
>>> Matt
>>>
>>> On Jun 2, 2007, at 9:41 AM, Sean Cribbs wrote:
>>>
>>>
>>>       
>>>> Why not keep Radiant in vendor/radiant?  Then the startup scripts
>>>> would
>>>> require less modification.
>>>>
>>>> Sean
>>>>
>>>> Matt Parrish wrote:
>>>>
>>>>         
>>>>> Yes, it seems to me like that is the goal.  Currently, Radiant  
>>>>> takes
>>>>> control of the files in config/ to do its initialization.  It seems
>>>>> like we would want to keep the Rails files as is, and do the
>>>>> initialization in plugins/radiant/init.rb.  I haven't looked at it
>>>>> yet, but I'm guessing there will be a few challenges to getting  
>>>>> this
>>>>> to work properly.  One challenge I immediately see is getting
>>>>> Radiant's routes to coordinate with the Rails ones in config/
>>>>> routes.rb.
>>>>>
>>>>> Matt Parrish
>>>>> http://www.pearware.org
>>>>>
>>>>>
>>>>> On Jun 1, 2007, at 9:17 PM, Meekish wrote:
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> Loren Johnson wrote:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> You're absolutely right, sorry I hadn't looked closely enough.
>>>>>>>
>>>>>>> You could gem install Radiant and generate an instance and then
>>>>>>> merge
>>>>>>> the necessary bits from the environment.rb it generates into your
>>>>>>> existing app.
>>>>>>>
>>>>>>> If I get a chance I'll try and determine what those necessary  
>>>>>>> bits
>>>>>>> are later today and email back what I learn.
>>>>>>>
>>>>>>> Loren
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> So is the goal at this point to make it possible to install  
>>>>>> Radiant
>>>>>> as a
>>>>>> plugin with the folder structure that John laid out?
>>>>>>
>>>>>> plugins/
>>>>>>    radiant/
>>>>>>      init.rb
>>>>>>      lib/
>>>>>>      vendor/
>>>>>>        radiant/  <<< an svn:external to trunk/radiant
>>>>>>
>>>>>> -- 
>>>>>> Posted via http://www.ruby-forum.com/.
>>>>>> _______________________________________________
>>>>>> Radiant mailing list
>>>>>> Post:   [email protected]
>>>>>> Search: http://radiantcms.org/mailing-list/search/
>>>>>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>>>>>
>>>>>>
>>>>>>             
>>>>> _______________________________________________
>>>>> Radiant mailing list
>>>>> Post:   [email protected]
>>>>> Search: http://radiantcms.org/mailing-list/search/
>>>>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> _______________________________________________
>>>> Radiant mailing list
>>>> Post:   [email protected]
>>>> Search: http://radiantcms.org/mailing-list/search/
>>>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>>>
>>>>         
>>> _______________________________________________
>>> Radiant mailing list
>>> Post:   [email protected]
>>> Search: http://radiantcms.org/mailing-list/search/
>>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>>
>>>
>>>       
>> _______________________________________________
>> Radiant mailing list
>> Post:   [email protected]
>> Search: http://radiantcms.org/mailing-list/search/
>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>     
>
> _______________________________________________
> Radiant mailing list
> Post:   [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
>   

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to