I have an engine that consolidates code used in several in-house applications. For some of its functionality, this engine depends on other, third-party engines. These other engines are declared as runtime dependencies in my engine''s gemspec. Now, when an application using my engine starts up, the engine itself as well as the other engines it depends on are added to the loadpath. Also, asset paths for my engine are added. However, asset paths for engine dependencies are not added. That''s as much as I expected. So, I was hoping that if I explicitly load the engines I depend on in an initializer in my engine, they would be picked up for their asset paths. But apparently, that''s already too late, then. So, what this comes to is, that in an application using my own engine, I need to declare that dependency in the app''s Gemfile. On top of that, I also need to declare all the transitive engine dependencies. I''d rather not do that. I''m wondering, did I miss some nice declarative way to say that an engine depends on other engines? Or is this a limitation in the current implementation? Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Hi, You should require dependencies of an engine before initialization, for example in lib/my_engine/engine.rb file: require ''other_engine/engine'' require ''yet_another_engine/engine'' moduleMyEngine class Engine < ::Rails::Engine end end On Wed, Jul 4, 2012 at 4:38 PM, Michael Schuerig <michael.lists@schuerig.de>wrote:> > I have an engine that consolidates code used in several in-house > applications. For some of its functionality, this engine depends on > other, third-party engines. These other engines are declared as runtime > dependencies in my engine''s gemspec. > > Now, when an application using my engine starts up, the engine itself as > well as the other engines it depends on are added to the loadpath. Also, > asset paths for my engine are added. However, asset paths for engine > dependencies are not added. That''s as much as I expected. So, I was > hoping that if I explicitly load the engines I depend on in an > initializer in my engine, they would be picked up for their asset paths. > But apparently, that''s already too late, then. > > So, what this comes to is, that in an application using my own engine, I > need to declare that dependency in the app''s Gemfile. On top of that, I > also need to declare all the transitive engine dependencies. I''d rather > not do that. > > I''m wondering, did I miss some nice declarative way to say that an > engine depends on other engines? Or is this a limitation in the current > implementation? > > Michael > > -- > Michael Schuerig > mailto:michael@schuerig.de > http://www.schuerig.de/michael/ > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- Piotr Sarnacki http://piotrsarnacki.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On Wednesday 04 July 2012, Piotr Sarnacki wrote:> Hi, > > You should require dependencies of an engine before initialization, > for example in lib/my_engine/engine.rb file: > > require ''other_engine/engine'' > require ''yet_another_engine/engine'' > > moduleMyEngine > class Engine < ::Rails::Engine > end > endNow that you''ve said it, it seems incredibly obvious. Thanks! Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
what if you have to include engine dependency from git repository? On Wednesday, July 4, 2012 6:38:18 PM UTC+3, mschuerig wrote:> > On Wednesday 04 July 2012, Piotr Sarnacki wrote: > > Hi, > > > > You should require dependencies of an engine before initialization, > > for example in lib/my_engine/engine.rb file: > > > > require ''other_engine/engine'' > > require ''yet_another_engine/engine'' > > > > moduleMyEngine > > class Engine < ::Rails::Engine > > end > > end > > Now that you''ve said it, it seems incredibly obvious. > > Thanks! > > Michael > > -- > Michael Schuerig > mailto:mic...@schuerig.de <javascript:> > http://www.schuerig.de/michael/ >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/O-l1UZtuDdQJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.