goodieboy
2008-Jan-15 03:14 UTC
Rails plugins that use other plugins - why is does this seem impossible?
OK, probably the most frustrated I''ve ever been with Rails. If I don''t figure this out, I''m going to, um... try again tomorrow. I''m simply trying to create a plugin. I did the ./script/generate plugin MY_NEW_PLUGIN and wha-hoo great! Well, not really... This plugin uses other plugins. For example, acts_as_list, acts_as_money etc.. How the heck to I get these plugins loaded and ready to be used? I''ve put them here: main-app/vendor/plugins/MY_NEW_PLUGIN/vendor/plugins/ I''ve added all of their paths and lib paths to the config.load_paths variable, I''ve tried loading (require and load) their init.rb files. And no matter what, it''s pretty obvious that the paths aren''t setup correctly. I''ve even tried $: << ''path/to/acts_as_list'' $: << ''path/to/acts_as_list/lib'' I''d like to be able to specify additional load_paths in init.rb and then use config.plugins - seems logical.? Ahhhhhhoar!!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-15 03:59 UTC
Re: Rails plugins that use other plugins - why is does this seem impossible?
perhaps just a require ''acts_as_list'' with a rescue with an error message will do it, probably. There''s most likely a better way to go about it, and why not ask the #rubyonrails irc channel in irc.freenode.net? Their responses can be more instantaneous than here most times. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
goodieboy
2008-Jan-15 04:15 UTC
Re: Rails plugins that use other plugins - why is does this seem impossible?
Hi Ryan, I tried irc, which is totally foreign to me. What is nickserv? Am I supposed to signup for membership? On Jan 14, 10:59 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> perhaps just a require ''acts_as_list'' with a rescue with an error message > will do it, probably.Well, my plugin, will come with acts_as_list. So I just want to be able to load it correctly. When my plugins init.rb file is loaded, I''m pretty sure that $LOAD_PATH is already set. So using config.load_paths doesn''t seem to do anything. And the same with config.plugin_paths.> There''s most likely a better way to go about it, and > why not ask the #rubyonrails irc channel in irc.freenode.net? Their > responses can be more instantaneous than here most times.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-15 04:40 UTC
Re: Rails plugins that use other plugins - why is does this seem impossible?
Oh yeah I should''ve mentioned. You have to have a registered name before you go into the channel so that random people can''t spam it. Just type /msg nickserv help register and follow the instructions. On Jan 15, 2008 2:45 PM, goodieboy <goodieBoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi Ryan, > > I tried irc, which is totally foreign to me. What is nickserv? Am I > supposed to signup for membership? > > On Jan 14, 10:59 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > perhaps just a require ''acts_as_list'' with a rescue with an error > message > > will do it, probably. > > Well, my plugin, will come with acts_as_list. So I just want to be > able to load it correctly. When my plugins init.rb file is loaded, I''m > pretty sure that $LOAD_PATH is already set. So using config.load_paths > doesn''t seem to do anything. And the same with config.plugin_paths. > > > There''s most likely a better way to go about it, and > > why not ask the #rubyonrails irc channel in irc.freenode.net? Their > > responses can be more instantaneous than here most times. > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
goodieboy
2008-Jan-15 05:02 UTC
Re: Rails plugins that use other plugins - why is does this seem impossible?
Cool, thank you :) On Jan 14, 11:40 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Oh yeah I should''ve mentioned. You have to have a registered name before you > go into the channel so that random people can''t spam it. Just type /msg > nickserv help register and follow the instructions. > > On Jan 15, 2008 2:45 PM, goodieboy <goodie...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Hi Ryan, > > > I tried irc, which is totally foreign to me. What is nickserv? Am I > > supposed to signup for membership? > > > On Jan 14, 10:59 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > perhaps just a require ''acts_as_list'' with a rescue with an error > > message > > > will do it, probably. > > > Well, my plugin, will come with acts_as_list. So I just want to be > > able to load it correctly. When my plugins init.rb file is loaded, I''m > > pretty sure that $LOAD_PATH is already set. So using config.load_paths > > doesn''t seem to do anything. And the same with config.plugin_paths. > > > > There''s most likely a better way to go about it, and > > > why not ask the #rubyonrails irc channel in irc.freenode.net? Their > > > responses can be more instantaneous than here most times. > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jan-15 08:48 UTC
Re: Rails plugins that use other plugins - why is does this seem impossible?
Is this rails 1.2 or rails 2.0? Quite a bit changed about plugin loading in between. Fred On 15 Jan 2008, at 03:14, goodieboy wrote:> > OK, probably the most frustrated I''ve ever been with Rails. If I don''t > figure this out, I''m going to, um... try again tomorrow. > > I''m simply trying to create a plugin. I did the ./script/generate > plugin MY_NEW_PLUGIN and wha-hoo great! Well, not really... > > This plugin uses other plugins. For example, acts_as_list, > acts_as_money etc.. How the heck to I get these plugins loaded and > ready to be used? I''ve put them here: > > main-app/vendor/plugins/MY_NEW_PLUGIN/vendor/plugins/ > > I''ve added all of their paths and lib paths to the config.load_paths > variable, I''ve tried loading (require and load) their init.rb files. > And no matter what, it''s pretty obvious that the paths aren''t setup > correctly. I''ve even tried > > $: << ''path/to/acts_as_list'' > $: << ''path/to/acts_as_list/lib'' > > I''d like to be able to specify additional load_paths in init.rb and > then use config.plugins - seems logical.? > > Ahhhhhhoar!!! > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > For more options, visit this group at http://groups.google.com/gro--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
goodieboy
2008-Jan-15 14:26 UTC
Re: Rails plugins that use other plugins - why is does this seem impossible?
Rails 2.0.2 I found a way to make it all work - not the correct, Rails way though. It''s not what I would have expected. I thought I could do everything I needed inside of the init.rb file. But from the way it seems, at that point it''s too late to add to the $LOAD_PATH so adding plugins to config.plugins inside of init.rb doesn''t work. Or am I wrong? I tried many different things. I''ll come clean now; this plugin is really another Rails app. it has controllers, models, views, routes etc.. I wanted to be able to reuse this inside of client apps. And maintain only one code base for the "plugin" (updatable via svn etc.) I wanted it to work like Django apps do. And I achieved a lot of that by initializing my plugin inside of the Rails::Initialize.run block: Rails::Initialize.run do |config| MySuperPluginThatsReallyAnApp::init(config) end Basically, I add a bunch of paths (load_paths and load_once_paths), include my plugins etc.. Now I can use that one line in my main apps'' environment.rb file, and without doing anything have a full blown app running without doing any extra coding. And thanks to the load paths, I can override any view, model etc.. just by creating the file in the app that''s using the "plugin". Very handy. I have to manually copy routes, and public folder items, but that''s OK. I want to be able to override those aspects anyway. The big downside is that I can''t do cool, builtin things with Rake, and testing. So I''m going to keep trying to get this to work the correct, Rails 2.0 plugin way. Feedback anyone? On Jan 15, 3:48 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is this rails 1.2 or rails 2.0? Quite a bit changed about plugin > loading in between. > > Fred > On 15 Jan 2008, at 03:14, goodieboy wrote: > > > > > OK, probably the most frustrated I''ve ever been with Rails. If I don''t > > figure this out, I''m going to, um... try again tomorrow. > > > I''m simply trying to create a plugin. I did the ./script/generate > > plugin MY_NEW_PLUGIN and wha-hoo great! Well, not really... > > > This plugin uses other plugins. For example, acts_as_list, > > acts_as_money etc.. How the heck to I get these plugins loaded and > > ready to be used? I''ve put them here: > > > main-app/vendor/plugins/MY_NEW_PLUGIN/vendor/plugins/ > > > I''ve added all of their paths and lib paths to the config.load_paths > > variable, I''ve tried loading (require and load) their init.rb files. > > And no matter what, it''s pretty obvious that the paths aren''t setup > > correctly. I''ve even tried > > > $: << ''path/to/acts_as_list'' > > $: << ''path/to/acts_as_list/lib'' > > > I''d like to be able to specify additional load_paths in init.rb and > > then use config.plugins - seems logical.? > > > Ahhhhhhoar!!! > > --~--~---------~--~----~------------~-------~--~----~ > > You received this message because you are subscribed to the Google > > Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > For more options, visit this group athttp://groups.google.com/gro--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---