Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gemset generation for Gem version including the platform requirement #67

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/bundix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,19 @@ def platforms(spec, dep_cache)
{platforms: platforms}
end

def version(spec)
platform = spec.platform
if platform == Gem::Platform::RUBY || platform.nil?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec.version.to_s
else
"#{spec.version}-#{platform}"
end
end

def convert_spec(spec, cache, dep_cache)
{
spec.name => {
version: spec.version.to_s,
version: version(spec),
source: Source.new(spec, fetcher).convert
}.merge(platforms(spec, dep_cache)).merge(groups(spec, dep_cache))
}
Expand Down
1 change: 1 addition & 0 deletions test/convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_bundler_dep
) do |gemset|
assert_equal("0.5.0", gemset.dig("bundler-audit", :version))
assert_equal("0.19.4", gemset.dig("thor", :version))
assert_equal("0.4.4821-universal-darwin-14", gemset.dig("sorbet-static", :version))
end
end
end
1 change: 1 addition & 0 deletions test/data/bundler-audit/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source 'https://rubygems.org' do
gem 'bundler-audit'
gem 'sorbet', '= 0.4.4821'
end
4 changes: 4 additions & 0 deletions test/data/bundler-audit/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ GEM
bundler-audit (0.5.0)
bundler (~> 1.2)
thor (~> 0.18)
sorbet (0.4.4821)
sorbet-static (= 0.4.4821)
sorbet-static (0.4.4821-universal-darwin-14)
thor (0.19.4)

PLATFORMS
ruby

DEPENDENCIES
bundler-audit!
sorbet (= 0.4.4821)!

BUNDLED WITH
1.12.5