You might try wrapping your plugin initialization code in a block like so:

unless defined?(VALID_PREPOSITIONS)
# init.rb contents goes here
end

Any constant defined in the plugin should do, including any class.

Sean

Andrew O'Brien wrote:
> Ah yes, the activation method -- that's probably a better place than
> the top of the file...
>
> My tests are passing, so things seem to be working better.  One
> problem I'm having though is that it seems to be initializing
> constants twice.  E.g.:
>
> /Users/aobrien/WorkingDirectory/tgi_cms/vendor/extensions/subscription_manager/vendor/plugins/authorization/lib/publishare/parser.rb:4:
> warning: already initialized constant VALID_PREPOSITIONS
>
> It does this for all of the constants in the plugin.  They're
> definitely specific to the Authorization plugin and not initialized
> beforehand (I've tried inserting "raise" commands if the constant is
> already defined) and the file is only required once (according to the
> "puts" commands I put in).
>
> They're just warnings, so I can probably live with them, but if this
> rings any bells with anyone, I'd be glad to hear.
>
> Thanks,
> Andrew
>
> On 6/4/07, Sean Cribbs <[EMAIL PROTECTED]> wrote:
>   
>> I included attachment_fu in my page_attachments extension.  It was kind
>> of tricky, but here's the basic strategy:
>>
>> 1) Import the plugin's lib/ directory into the lib/ directory of your
>> extension via svn:externals, piston, or an export.
>> 2) Copy the contents of the init.rb file into the 'activate' method of
>> your extension.
>>
>> You may have to fiddle with things to make sure they work right.  Here's
>> another potential strategy, YMMV:
>> (in 'activate')
>> 1) Wherever you stored it, push the plugin's lib/ directory into the
>> load path.
>> 2) Load or require the plugin's init.rb.
>>
>> In either strategy, the plugin should probably be dealt with first (i.e.
>> placed first in the activate method) if your extension depends on it
>> during its activation.
>>
>> Sean
>>
>> Andrew O'Brien wrote:
>>     
>>> I'm trying to make a radiant friendly wrapping around the
>>> Authorization plugin
>>> (http://www.writertopia.com/developers/authorization) and I was
>>> wondering: what's the best way to use a Rails plugin inside of a
>>> Radiant extension?
>>>
>>> I noticed there's a vendor/plugin directory in the standard project
>>> layout, but it doesn't seem to be in the include path.  I also tried
>>> adding a vendor/plugins directory to the extension (since it would be
>>> kind of nice to bundle them together anyway), but that didn't quite
>>> worked either.
>>>
>>> Any suggestions?
>>>
>>> Thanks,
>>> Andrew
>>>
>>> Oh, and in case you're wondering, I'm trying to add a controller to
>>> allow role creation and assignment, as well as compatibility with
>>> Radiant's existing authorization system.
>>> _______________________________________________
>>> 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