Skip to content

Commit f2d24ad

Browse files
committed
Dynamically compute the version overrides
1 parent 2ae9e08 commit f2d24ad

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

lib/shopify_ruby_definitions/ruby_versions.rb

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,14 @@ module ShopifyRubyDefinitions
44
module RubyVersions
55
VERSIONS_DIRECTORY = File.expand_path("../../../rubies", __FILE__)
66
ALL_VERSIONS = Dir["#{VERSIONS_DIRECTORY}/*"].map { |f| File.basename(f) }
7+
VERSION_OVERRIDES = ALL_VERSIONS.sort_by do |version|
8+
version.scan(/\d+/).map(&:to_i)
9+
end.to_h do |version|
10+
[version.split("-").first, version]
11+
end.freeze
712

813
def version_overrides
9-
{
10-
"3.0.0" => "3.0.0-pshopify9",
11-
"3.0.1" => "3.0.1-pshopify2",
12-
"3.0.2" => "3.0.2-pshopify3",
13-
"3.1.0" => "3.1.0-pshopify1",
14-
"3.1.1" => "3.1.1-pshopify2",
15-
"3.1.2" => "3.1.2-pshopify2",
16-
"3.1.3" => "3.1.3-pshopify1",
17-
"3.1.4" => "3.1.4-pshopify1",
18-
"3.2.0" => "3.2.0-pshopify2",
19-
"3.2.1" => "3.2.1-pshopify5",
20-
"3.2.2" => "3.2.2-pshopify3",
21-
}.freeze
14+
VERSION_OVERRIDES
2215
end
2316

2417
def resolve_version(version)

0 commit comments

Comments
 (0)