Discourse Plugin Dev: Problems with Discourse Plugin Gem Parser (ruby-openai gemspec dependancy)

Yesterday I spent most of the try trying to resolve an issue caused by the gem parser in the Discourse plugin methods.

The issue occurred because I was working with the ruby-openai Ruby gem where the owner of the gem specified a gemspec dependency as follows:

 spec.add_dependency "httparty", ">= 0.18.1", "< 0.22.0"

However, Discourse will not parse this in the Discourse plugin code; and so 8 hours later, I found that only one workaround was to "hack" the Gemfile during the container build process, as follows:

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_bundle_exec:
    - exec:
        cd: $home
        cmd:
          - echo "Hello Neo"
          - echo "gem 'httparty'" >> Gemfile
          - echo "gem 'ruby-openai'" >> Gemfile
          - su discourse -c 'bundle config unset deployment'
          - su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'

The above hack works. Nothing else worked. Believe me, I tried for 8 hours to accomplish this without hacking the Discourse Gemfile in this manner.

If anyone can get this to work without this messy hack, please post your solution.

Thanks.

OK. It looks like the developer of the ruby-openai gem has replied to my comment on this issue and plans to modify his code:

See also: