נתקלתי בבעיה בעת התקנת כמה אבני חן בתוסף

סיכום מבוסס בינה מלאכותית

Facing an issue while installing some gems in the plugin

fzngagan is experiencing issues installing certain gems, specifically google-protobuf, in a plugin. The issue arises from the .gemspec file’s name not matching the spec_file’s name assumed in the code.

After further discussion, fzngagan created a pull request (#9) to fix the issue, which was merged by sam. The pull request resolves the problem by addressing the platform-specific naming convention in gem files.

This issue is particularly relevant to a plugin being developed to integrate the Google Cloud Vision API into the upload process, which is being sponsored by Terrapop.

@sam

I’m unable to install some gems in the plugin, for e.g. google-protobuf. This gem is dependency for google-cloud-vision gem.

Here’s a plugin trying to install it. GitHub - fzngagan/gem-issue · GitHub

Logs
gem install google-protobuf -v 3.13.0 -i /Users/faiz/discenv/discourse/plugins/gem-issue/gems/2.6.3 --no-document --ignore-dependencies --no-user-install
Successfully installed google-protobuf-3.13.0-universal-darwin
1 gem installed
You are specifying the gem google-protobuf in /Users/faiz/discenv/discourse/plugins/gem-issue/plugin.rb, however it does not exist!
Looked for: /Users/faiz/discenv/discourse/plugins/gem-issue/gems/2.6.3/specifications/google-protobuf-3.13.0.gemspec

The reason for this is that the .gemspec file’s name doesn’t match the spec_file’s name assumed in the code here.

IMO, this would happen probably only when using platform-specific gems as the platform name gets added to the gem name if its platform dependent. This is described here. Specification Reference - RubyGems Guides

It’s unclear why you mentioned me on this topic? I don’t know much about our custom gem resolution, sorry.

I checked the blame and you have the most commits to the file I guess? Happy to be pointed in the right direction here :slight_smile:

I think @sam might be able to help. He wrote the gem importing for plugins.

Sure, thanks for the lead.

@sam did you get a chance to take a look?

@sam could you help @fzngagan on this? I am sponsoring this plugin:

And it will be made available for everybody. It is vital to keep a forum free of images that could potentially harm and will certainly help to not getting strikes from Google Adsense for disallowed content.

I guess it looks like there is a bug here, perhaps do a PR to try and fix this quirk?

https://github.com/discourse/discourse/pull/10559

Here’s a very simple PR fixing the issue.

I tried to find a fancy way to tackle this so that the devs don’t have to worry about the platform thing but didn’t find any. Happy to improve upon this if I find a better solution.

Also, a tip for devs, you can simply put the gem in discourse’s gemfile during development and not go insane. Only worry about all of this for deployment.

Thanks for merging @sam.