Rails plugin generator

This is awesome :slight_smile: :tada:

A few quick thoughts:

  • You could add notes in the plugin.rb and the initializer to direct the author to discourse-specific methods they can use in each context. Something like

    after_initialize do
      # see lib/plugin/instance.rb for the methods available in this context
    end
    
    withPluginApi('0.8.x', api => {
      // see app/assets/javascripts/discourse/lib/plugin-api for the functions available via the api object.
    })
    
  • On first blush I wondered whether it makes sense to create the module and engine out of the box. A number of plugins don’t need any new server methods. But on balance I think it makes sense, as it indicates the way to go about it, and there’s no harm in having an unused module.

  • I reckon the about should be blank rather than AWESOME_PLUGIN.

  • It’s cool that the url defaults to github.com/${author} however this was a little unexpected. Sometimes folks put their full name in that field and sometimes there are multiple authors (e.g. the polls plugin), which could make this problematic. Perhaps the CLI could explicitly ask for the author’s github username then use that for both the author and to generate the url.

Generally, how far do you want to go down the path of explicit direction / hand-holding?

If the goal is to make it easier for new plugin devs to find their feet, there are a number of other things we could add such as more notes or links to helpful meta topics, examples of overriding existing Discourse methods and other common plugin patterns.

17 Likes