The discussion centers on a bug where Discourse’s bootstrap process fails when a plugin’s Ruby file specifies gem version ranges (e.g., ~>1.7) instead of exact versions. jonathon notes that version ranges are legal in RubyGems and work with manual gem install, but Discourse’s plugin system throws an error because it expects exact versions for consistency and debugging. sam explains that plugins follow Discourse core’s policy of using explicit versions due to lockfiles, though this isn’t documented for plugin developers. jonathon argues that bootstrap should either accept legal syntax or fail with a clearer error, rather than silently break. He questions why this restriction isn’t documented in developer guides, pointing out that new plugin authors may not realize they must mimic Discourse’s internal development practices — including setting up a local dev environment that mirrors core’s locked dependencies — rather than developing on a production-like setup. sam acknowledges that while bundler doesn’t support cascading lockfiles today, core’s approach is intentional for stability. The thread highlights a gap in documentation and developer expectations around plugin gem versioning, suggesting the barrier to entry for plugin development is higher than implied.
and running a gem install manually will succeed as expected, e.g.:
$ gem install ruby-saml -v '~>1.7'
Successfully installed ruby-saml-1.7.2
Parsing documentation for ruby-saml-1.7.2
Done installing documentation for ruby-saml after 1 seconds
1 gem installed
However, bootstrap will fail when anything other than a plain number is used:
ERROR: While executing gem ... (Gem::Requirement::BadRequirementError)
Illformed requirement ["/home/discourse"]
I, [2018-03-13T12:15:08.087153 #16] INFO -- : gem install ruby-saml -v ~>1.7 -i /var/www/discourse/plugins/discourse-saml/gems/2.4.2 --no-document --ignore-dependencies
You are specifying the gem ruby-saml in /var/www/discourse/plugins/discourse-saml/plugin.rb, however it does not exist!
Looked for: /var/www/discourse/plugins/discourse-saml/gems/2.4.2/specifications/ruby-saml-~>1.7.gemspec
In bundle and rubygems, sure, but in our gem specification for plugins it is not allowed, we need to know the exact version so we can consistently debug our plugins.
I’m not saying plugins shouldn’t use explicit gem versions - I’m saying that bootstrap shouldn’t fail (or should fail with a useful error) when otherwise-legal language syntax/features are used.
I want to be able to specify a gem version range in my plugin, as is legal, as subversion/point releases of gems should maintain backwards-compatibility and only introduce bugfixes.
Attempting to install a plugin which includes a (legal) gem version range fails and does not generate an explicit error message.
Without wanting to put words in your mouth, you appear to be saying this is not supported because you (by policy rather than a technical reason) use explicit gem versions in plugins, and so this should be detected during plugin development.
The following questions are rhetorical.
So - at what point is it made clear that plugins should only use explicit gem versions because of your (internal?) development methodology?
My take-away from this is that as a “beginning” plugin developer I must adapt my normal practices to match how you write Discourse, much in the same way Rails isn’t really Ruby. It appears the barrier for entry is higher than I had originally thought and so needs more work on my part to create a development environment (with all its moving parts) that matches as closely as possible those in use by others, rather than developing on a “production mirror” (which, for example, normally makes sure that any changes I make will be exactly reflected when deployed).