Transforming simple ruby files into a ruby gem

Glad to here you are working on your first plugin :slight_smile:. I would look at the examples of other plugins and see how they do the ruby side of things.

I don’t think your plugin actually needs to have a Gemfile, but you need to specify all of your dependencies and sub-dependencies inside of your plugin.rb file. Discourse will then install all of the gems when it loads the plugin. See this example:

https://github.com/xfalcox/discourse-backups-to-dropbox/blob/master/plugin.rb

Any files your plugin uses you can put inside of the “lib” folder and then require them inside of plugin.rb.

https://github.com/discourse/discourse-data-explorer/blob/master/plugin.rb#L579

9 Likes