I''m writing a rails plugin, and figured I''d do it as a GemPlugin to be ahead of the curve. I need to install some assets when the plugin is installed in a rails app, but it would seem there''s no mechanism by which this occurs; install.rb is never run for a GemPlugin, unless I''m missing something entirely. I could check for the assets in init.rb and copy them over if they don''t exist, but that strikes me as poor behavior. I would guess the thing to do would be to create a new gems task, gems:plugin:install or similar, which would invoke the install scripts on all config.gems that have been tagged with :plugin => true. Before I dive in and give this a whirl, though, I figured I''d check with the dev team and see if a. I''ve overlooked an existing installation mechanism, b. someone already had something in the works, or even c. the GemPlugin idea was still considered to be the future of plugins, or if yet another strategy was being considered. - donald --~--~---------~--~----~------------~-------~--~----~ 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 Tue, Nov 25, 2008 at 20:59, Donald Ball <donald.ball@gmail.com> wrote:> > I would guess the > thing to do would be to create a new gems task, gems:plugin:install or > similar, which would invoke the install scripts on all config.gems > that have been tagged with :plugin => true.I agree that there should be an install hook. Gem plugins are just plugins that have the benefits of rubygems. But it''s not easy. Plugins had an interface for installing: "script/plugin install". Gems, on the other hand, can be installed in a variety of ways: from referencing them in environment.rb to freezing them in the application. But now, less and less people use "script/plugin" in favor of dependencies management tools. Same could be used for "freezing" gems (see recent discussions on this list). http://github.com/gary/dependency_management_talk/tree/master/notes.markdown This poses a question: how to trigger an install hook when you don''t control the means of installation anymore? Maybe the 3rd party tools should follow the standard to execute install.rb when they see it. But how will they provide the same environment Rails did when it executes them in "script/plugin"? Another question is are installation hooks worth this trouble? All they do is show README on the console or copy assets to "public/". The former is just luxury, while the latter can easly be available through rake/thor tasks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
>> I would guess the >> thing to do would be to create a new gems task, gems:plugin:install or >> similar, which would invoke the install scripts on all config.gems >> that have been tagged with :plugin => true. > > I agree that there should be an install hook. Gem plugins are just plugins > that have the benefits of rubygems. > But it''s not easy. Plugins had an interface for installing: "script/plugin > install". Gems, on the other hand, can be installed in a variety of ways: > from referencing them in environment.rb to freezing them in the application. > But now, less and less people use "script/plugin" in favor of dependencies > management tools. Same could be used for "freezing" gems (see recent > discussions on this list). > http://github.com/gary/dependency_management_talk/tree/master/notes.markdownRegardless of how the gems are actually installed, folks are still "supposed" to use config.gems to require all the gems used by their rails apps, right? If so, couldn''t you still tag those gems that are also plugins in the config file and provide a gems:plugins:install task to run any plugin install scripts?> Another question is are installation hooks worth this trouble? All they do > is show README on the console or copy assets to "public/". The former is > just luxury, while the latter can easly be available through rake/thor > tasks.I agree the former is unnecessary. Can the latter in fact be done with rake tasks? That is to say, can system gems make rake tasks globally available? Or are you proposing some mechanism by which gems required via config.gem can be queried for rake tasks they make available to the rails app? - donald --~--~---------~--~----~------------~-------~--~----~ 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 Thu, Nov 27, 2008 at 00:05, Donald Ball <donald.ball@gmail.com> wrote:> That is to say, can system gems make rake tasks globally > available? Or are you proposing some mechanism by which gems required > via config.gem can be queried for rake tasks they make available to > the rails app?I clearly wasn''t thinking at all when I said that. But now that you mention it, theoretically it''s possible for gem plugins referenced in environment.rb to expose some sort of tasks. Most of the rails rake tasks load the environment, anyway ... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---