fzngagan
(Faizaan Gagan)
8월 22, 2020, 10:53오후
1
@sam
플러그인에서 일부 gems를 설치할 수 없습니다. 예를 들어 google-protobuf가 있습니다. 이 gem은 google-cloud-vision gem의 의존성입니다.
설치를 시도하는 플러그인은 다음과 같습니다. GitHub - fzngagan/gem-issue · GitHub
로그
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
그 이유는 .gemspec 파일의 이름이 여기 코드에서 가정하는 spec_file의 이름과 일치하지 않기 때문입니다.
spec_file = spec_path + "/#{name}-#{version}.gemspec"
unless File.exists? spec_file
command = "gem install #{name} -v #{version} -i #{gems_path} --no-document --ignore-dependencies --no-user-install"
if opts[:source]
command << " --source #{opts[:source]}"
end
puts command
puts `#{command}`
end
if File.exists? spec_file
spec = Gem::Specification.load spec_file
spec.activate
unless opts[:require] == false
require opts[:require_name] ? opts[:require_name] : name
end
else
puts "You are specifying the gem #{name} in #{path}, however it does not exist!"
puts "Looked for: #{spec_file}"
exit(-1)
end
end
제 생각에는 플랫폼별 gems를 사용할 때만 이런 일이 발생할 가능성이 높습니다. 플랫폼에 종속적인 경우 플랫폼 이름이 gem 이름에 추가되므로요. 이 내용은 여기에 설명되어 있습니다. Specification Reference - RubyGems Guides
이 주제에서 왜 저를 언급하셨는지 이해가 되지 않습니다. 저희 커스텀 gem 해결 방식에 대해 잘 모르겠어서 죄송합니다.
fzngagan
(Faizaan Gagan)
8월 24, 2020, 5:45오후
3
blame를 확인해 봤는데, 해당 파일에 커밋을 가장 많이 한 사람이 당신인 것 같네요? 올바른 방향으로 안내해 주시면 감사하겠습니다
I think @sam might be able to help. He wrote the gem importing for plugins.
@sam @fzngagan의 이 문제에 대해 도와줄 수 있을까요? 이 플러그인을 후원하고 있습니다:
A plugin that checks all images uploaded to Discourse via the Google Cloud Vision API and rejects if not appropriate according to set levels.
Documentation:
A Ruby Gem is provided by Google:
This plugin should hook into the main image upload process of Discourse for all images (posts, avatars, profile backgrounds etc.) and reject images that contain disallowed content:
puts "Adult: #{safe_search.adult}" puts "Spoof: #{safe_search.spoof}" puts "Medical: #{safe_search.medical…
이 플러그인은 모든 사용자가 사용할 수 있도록 공개될 예정입니다. 잠재적으로 해를 끼칠 수 있는 이미지를 포럼에서 차단하는 것은 매우 중요하며, 허용되지 않는 콘텐츠로 인한 Google AdSense의 제재를 피하는 데에도 큰 도움이 될 것입니다.
sam
(Sam Saffron)
8월 28, 2020, 7:50오전
8
여기 버그가 있는 것 같은데, 이 문제를 수정하기 위해 PR을 올려볼까요?
fzngagan
(Faizaan Gagan)
8월 28, 2020, 9:25오후
9
master ← fzngagan:gem-platform
merged 02:36AM - 31 Aug 20 UTC
Discussed here: https://meta.discourse.org/t/facing-an-issue-while-installing-so… me-gems-in-the-plugin/161780
이 문제를 수정하는 매우 간단한 PR입니다.
개발자들이 플랫폼 관련 문제를 걱정하지 않도록 좀 더 우아한 해결책을 찾아보려 했지만, 찾지 못했습니다. 더 나은 해결책을 찾게 되면 개선하겠습니다.
또한 개발자를 위한 팁으로, 개발 중에는 discourse의 Gemfile에 해당 gem을 직접 넣으면 됩니다. 이렇게 하면 정신건강을 유지할 수 있습니다. 배포 시에만 이 모든 것에 신경 쓰면 됩니다.