Gemfile and plugins improvements

Hi, Discourse team
I want to offer you an interesting solution for Gemfile in the plugin directory and adding external gems if they are needed

# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/{Gemfile}", __FILE__) do |file|
  eval_gemfile file

If we add this to the main Gemfile, we can load Gemfiles from plugins.
Lets discuss this solution.
P.S. DSL doc for eval_gemfile => eval_gemfile (Bundler::Dsl) - APIdock


That is interesting! At the moment plugins can require gems by listing the whole recursive dependency tree in the plugin.rb file, eg:


Thanks, this is what I was looking for.
But I think my decision is more clear and understandable for me.

  1. We leave plugin.rb more clean
  2. Gemfile is more understandable for rails devs.
1 Like

Unfortunately this means that the lock file will become a moving target, and we ship that in source control.

Gem files are nice, but until we can ship delta lock files this type of solution will not work.