diff --git a/lib/bundix.rb b/lib/bundix.rb index 5f86960..1e65cd6 100755 --- a/lib/bundix.rb +++ b/lib/bundix.rb @@ -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? + 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)) } diff --git a/test/convert.rb b/test/convert.rb index 7de156c..c6d0b5b 100644 --- a/test/convert.rb +++ b/test/convert.rb @@ -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 diff --git a/test/data/bundler-audit/Gemfile b/test/data/bundler-audit/Gemfile index 89edc2b..97e9c57 100644 --- a/test/data/bundler-audit/Gemfile +++ b/test/data/bundler-audit/Gemfile @@ -1,3 +1,4 @@ source 'https://rubygems.org' do gem 'bundler-audit' + gem 'sorbet', '= 0.4.4821' end diff --git a/test/data/bundler-audit/Gemfile.lock b/test/data/bundler-audit/Gemfile.lock index fa8847c..d69a7f9 100644 --- a/test/data/bundler-audit/Gemfile.lock +++ b/test/data/bundler-audit/Gemfile.lock @@ -4,6 +4,9 @@ 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 @@ -11,6 +14,7 @@ PLATFORMS DEPENDENCIES bundler-audit! + sorbet (= 0.4.4821)! BUNDLED WITH 1.12.5