what is context of plugin in init.rb ?

I have some code in init.rb which works fine most of the time, but when I try to generate another plugin via script/generate plugin the generate crashes and I think it is because of the other plugins I have. I don't seem to get a sensible stack trace if I use -t. I am not sure why that is ? Is it because of the eval(), what else can I do to trace it ?

I am wondering how can I tell from an existing plugin what the context is, that is are we starting up via script/server, generate or what ?