-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruby_debian_dev.rb
More file actions
108 lines (93 loc) · 2.9 KB
/
ruby_debian_dev.rb
File metadata and controls
108 lines (93 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
module RubyDebianDev
RUBY_INTERPRETERS = {}
def self.skip
@skip ||= (ENV["RUBY_ALL_DEV_SKIP"] || "").split
end
def self.has_support_for(ruby)
return if skip.include?(ruby)
RUBY_INTERPRETERS[ruby] = yield
end
has_support_for 'ruby4.0' do
{
version: '4.0',
binary: '/usr/bin/ruby4.0',
api_version: '4.0.0',
shared_library: 'libruby4.0',
min_ruby_version: '1:4.0~0',
ruby_upper_bound: '1:4.0~',
}
end
has_support_for 'ruby3.4' do
{
version: '3.4',
binary: '/usr/bin/ruby3.4',
api_version: '3.4.0',
shared_library: 'libruby3.4',
min_ruby_version: '1:3.4~0',
ruby_upper_bound: '1:3.4~',
}
end
has_support_for 'ruby3.3' do
{
version: '3.3',
binary: '/usr/bin/ruby3.3',
api_version: '3.3.0',
shared_library: 'libruby3.3',
min_ruby_version: '1:3.3~0',
ruby_upper_bound: '1:3.3~',
}
end
has_support_for 'ruby3.2' do
{
version: '3.2',
binary: '/usr/bin/ruby3.2',
api_version: '3.2.0',
shared_library: 'libruby3.2',
min_ruby_version: '1:3.2~0',
ruby_upper_bound: '1:3.2~',
}
end
has_support_for 'ruby3.1' do
{
version: '3.1',
binary: '/usr/bin/ruby3.1',
api_version: '3.1.0',
shared_library: 'libruby3.1',
min_ruby_version: '1:3.1~0',
ruby_upper_bound: '1:3.1~',
}
end
def self.min_ruby_dependency_for(shared_library)
RUBY_INTERPRETERS.each do |int,data|
if data[:shared_library] == shared_library
return "libruby (>= %s)" % data[:min_ruby_version]
end
end
return nil
end
def self.ruby_upper_bound
sort = IO.popen('sort -V', 'w+')
RUBY_INTERPRETERS.values.map do |data|
sort.puts(data[:ruby_upper_bound])
end
sort.close_write()
version = sort.read.split.last
"libruby (<< #{version})"
end
#################################################################
# These constants below are kept here for backwards compatibility
#################################################################
SUPPORTED_RUBY_VERSIONS = RUBY_INTERPRETERS.keys.inject({}) do |supported,interpreter|
supported[interpreter] = RUBY_INTERPRETERS[interpreter][:binary]
supported
end
RUBY_CONFIG_VERSION = RUBY_INTERPRETERS.keys.inject({}) do |supported,interpreter|
supported[interpreter] = RUBY_INTERPRETERS[interpreter][:version]
supported
end
RUBY_API_VERSION = RUBY_INTERPRETERS.keys.inject({}) do |supported,interpreter|
supported[interpreter] = RUBY_INTERPRETERS[interpreter][:api_version]
supported
end
SUPPORTED_RUBY_SHARED_LIBRARIES = RUBY_INTERPRETERS.map { |k,v| v[:shared_library] }
end