rubygems-requirements-system 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +141 -0
  3. data/Rakefile +35 -0
  4. data/doc/text/gpl-3.txt +674 -0
  5. data/doc/text/lgpl-3.txt +165 -0
  6. data/doc/text/news.md +5 -0
  7. data/lib/rubygems-requirements-system/executable-finder.rb +87 -0
  8. data/lib/rubygems-requirements-system/installer.rb +122 -0
  9. data/lib/rubygems-requirements-system/os-release.rb +59 -0
  10. data/lib/rubygems-requirements-system/package.rb +17 -0
  11. data/lib/rubygems-requirements-system/platform/alpine-linux.rb +44 -0
  12. data/lib/rubygems-requirements-system/platform/alt-linux.rb +52 -0
  13. data/lib/rubygems-requirements-system/platform/amazon-linux-2.rb +50 -0
  14. data/lib/rubygems-requirements-system/platform/amazon-linux-2023.rb +40 -0
  15. data/lib/rubygems-requirements-system/platform/arch-linux.rb +43 -0
  16. data/lib/rubygems-requirements-system/platform/base.rb +135 -0
  17. data/lib/rubygems-requirements-system/platform/conda.rb +43 -0
  18. data/lib/rubygems-requirements-system/platform/debian.rb +67 -0
  19. data/lib/rubygems-requirements-system/platform/fedora.rb +44 -0
  20. data/lib/rubygems-requirements-system/platform/freebsd.rb +43 -0
  21. data/lib/rubygems-requirements-system/platform/gentoo-linux.rb +50 -0
  22. data/lib/rubygems-requirements-system/platform/homebrew.rb +43 -0
  23. data/lib/rubygems-requirements-system/platform/macports.rb +43 -0
  24. data/lib/rubygems-requirements-system/platform/pld-linux.rb +43 -0
  25. data/lib/rubygems-requirements-system/platform/red-hat-enterprise-linux.rb +67 -0
  26. data/lib/rubygems-requirements-system/platform/suse.rb +51 -0
  27. data/lib/rubygems-requirements-system/platform/ubuntu.rb +41 -0
  28. data/lib/rubygems-requirements-system/platform/unknown.rb +31 -0
  29. data/lib/rubygems-requirements-system/platform.rb +72 -0
  30. data/lib/rubygems-requirements-system/version.rb +18 -0
  31. data/lib/rubygems_plugin.rb +21 -0
  32. metadata +94 -0
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/doc/text/news.md ADDED
@@ -0,0 +1,5 @@
1
+ # News
2
+
3
+ ## 0.0.1 - 2025-01-08
4
+
5
+ Initial release!!!
@@ -0,0 +1,87 @@
1
+ # Copyright (C) 2013-2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "rbconfig"
17
+
18
+ module RubyGemsRequirementsSystem
19
+ class ExecutableFinder
20
+ class << self
21
+ def find(basename)
22
+ new(basename).find
23
+ end
24
+
25
+ def exist?(basename)
26
+ new(basename).exist?
27
+ end
28
+ end
29
+
30
+ def initialize(basename)
31
+ @basename = basename
32
+ @appended_paths = []
33
+ end
34
+
35
+ def find
36
+ extensions = detect_extensions
37
+ paths.each do |path|
38
+ executable_file = File.join(path, @basename)
39
+ return executable_file if executable?(executable_file)
40
+ extensions.each do |extension|
41
+ executable_file_with_extension = executable_file + extension
42
+ if executable?(executable_file_with_extension)
43
+ return executable_file_with_extension
44
+ end
45
+ end
46
+ end
47
+ nil
48
+ end
49
+
50
+ def exist?
51
+ not find.nil?
52
+ end
53
+
54
+ def append_path(path)
55
+ @appended_paths << path
56
+ end
57
+
58
+ private
59
+ def paths
60
+ path_env = ENV["PATH"]
61
+ if path_env
62
+ base_paths = path_env.split(File::PATH_SEPARATOR)
63
+ else
64
+ base_paths = ["/usr/local/bin", "/usr/bin", "/bin"]
65
+ end
66
+ base_paths + @appended_paths
67
+ end
68
+
69
+ def detect_extensions
70
+ exts = RbConfig::CONFIG["EXECUTABLE_EXTS"]
71
+ return exts.split if exts
72
+ ext = RbConfig::CONFIG["EXEEXT"]
73
+ return [ext] if ext
74
+ []
75
+ end
76
+
77
+ def executable?(path)
78
+ begin
79
+ stat = File.stat(path)
80
+ rescue SystemCallError
81
+ false
82
+ else
83
+ stat.file? and stat.executable?
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,122 @@
1
+ # Copyright (C) 2017-2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "shellwords"
17
+
18
+ require "pkg-config"
19
+
20
+ require_relative "version"
21
+
22
+ require_relative "platform"
23
+
24
+ module RubyGemsRequirementsSystem
25
+ Package = Struct.new(:id, :operator, :version) do
26
+ def valid?
27
+ return false if id.empty?
28
+ return false if operator and version.nil?
29
+ true
30
+ end
31
+ end
32
+
33
+ Requirement = Struct.new(:packages, :system_packages) do
34
+ def satisfied?
35
+ packages.any? do |package|
36
+ installed?(package)
37
+ end
38
+ end
39
+
40
+ private
41
+ def installed?(package)
42
+ package_config = PKGConfig.package_config(package.id)
43
+ begin
44
+ package_config.cflags
45
+ rescue PackageConfig::NotFoundError
46
+ return false
47
+ end
48
+
49
+ return true if package.version.nil?
50
+
51
+ current_version = Gem::Version.new(package_config.version)
52
+ required_version = Gem::Version.new(package.version)
53
+ current_version.__send__(package.operator, required_version)
54
+ end
55
+ end
56
+
57
+ class Installer
58
+ include Gem::UserInteraction
59
+
60
+ def initialize(gemspec)
61
+ @gemspec = gemspec
62
+ @platform = Platform.detect
63
+ end
64
+
65
+ def install
66
+ requirements = parse_requirements(@gemspec.requirements)
67
+ requirements.all? do |requirement|
68
+ next true if requirement.satisfied?
69
+ @platform.install(requirement)
70
+ end
71
+ end
72
+
73
+ private
74
+ def parse_requirements(gemspec_requirements)
75
+ all_packages_set = {}
76
+ requirements = {}
77
+ gemspec_requirements.each do |gemspec_requirement|
78
+ components = gemspec_requirement.split(/: +/, 4)
79
+ next unless components.size == 4
80
+
81
+ id, raw_packages, platform, system_package = components
82
+ next unless id == "system"
83
+
84
+ packages = parse_packages(raw_packages)
85
+ next if packages.empty?
86
+
87
+ all_packages_set[packages] = true
88
+
89
+ next unless @platform.target?(platform)
90
+ requirements[packages] ||= []
91
+ requirements[packages] << system_package
92
+ end
93
+ (all_packages_set.keys - requirements.keys).each do |not_used_packages|
94
+ system_packages = @platform.default_system_packages(not_used_packages)
95
+ next if system_packages.nil?
96
+ requirements[not_used_packages] = system_packages
97
+ end
98
+ requirements.collect do |packages, system_packages|
99
+ Requirement.new(packages, system_packages)
100
+ end
101
+ end
102
+
103
+ def parse_packages(raw_packages)
104
+ packages = raw_packages.split(/\s*\|\s*/).collect do |raw_package|
105
+ Package.new(*raw_package.split(/\s*(==|!=|>=|>|<=|<)\s*/, 3))
106
+ end
107
+ # Ignore this requirement if any invalid package is included.
108
+ # We must not report an error for this because
109
+ # Gem::Specification#requirements is a free form
110
+ # configuration. So there are configuration values that use
111
+ # "system: ..." but not for this plugin. We can report a
112
+ # warning instead.
113
+ packages.each do |package|
114
+ unless package.valid?
115
+ # TODO: Report a warning
116
+ return []
117
+ end
118
+ end
119
+ packages
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,59 @@
1
+ # Copyright (C) 2021-2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module RubyGemsRequirementsSystem
17
+ class OSRelease
18
+ include Enumerable
19
+
20
+ def initialize
21
+ parse
22
+ end
23
+
24
+ def each(&block)
25
+ @variables.each(&block)
26
+ end
27
+
28
+ def [](key)
29
+ @variables[key]
30
+ end
31
+
32
+ def id
33
+ self["ID"]
34
+ end
35
+
36
+ def id_like
37
+ (self["ID_LIKE"] || "").split(/ /)
38
+ end
39
+
40
+ def version
41
+ self["VERSION"]
42
+ end
43
+
44
+ private
45
+ def parse
46
+ @variables = {}
47
+ path = "/etc/os-release"
48
+ return unless File.exist?(path)
49
+ File.foreach(path) do |line|
50
+ key, value = line.strip.split("=", 2)
51
+ next if value.nil?
52
+ if value.start_with?("\"") and value.end_with?("\"")
53
+ value = value[1..-2]
54
+ end
55
+ @variables[key] = value
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,17 @@
1
+ # Copyright (C) 2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module RubyGemsRequirementsSystem
17
+ end
@@ -0,0 +1,44 @@
1
+ # Copyright (C) 2023-2024 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require_relative "base"
17
+
18
+ module RubyGemsRequirementsSystem
19
+ module Platform
20
+ class AlpineLinux < Base
21
+ Platform.register(self)
22
+
23
+ class << self
24
+ def current_platform?
25
+ os_release = OSRelease.new
26
+ os_release.id == "alpine"
27
+ end
28
+ end
29
+
30
+ def target?(platform)
31
+ platform == "alpine_linux"
32
+ end
33
+
34
+ private
35
+ def need_super_user_priviledge?
36
+ true
37
+ end
38
+
39
+ def install_command_line(package)
40
+ ["apk", "add", package]
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,52 @@
1
+ # Copyright (C) 2017-2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require_relative "base"
17
+
18
+ module RubyGemsRequirementsSystem
19
+ module Platform
20
+ class ALTLinux < Base
21
+ Platform.register(self)
22
+
23
+ class << self
24
+ def current_platform?
25
+ os_release = OSRelease.new
26
+ os_release.id == "altlinux"
27
+ end
28
+ end
29
+
30
+ def target?(platform)
31
+ platform == "alt_linux"
32
+ end
33
+
34
+ private
35
+ def install_command_line(package)
36
+ [
37
+ "env",
38
+ "DEBIAN_FRONTEND=noninteractive",
39
+ "apt-get",
40
+ "install",
41
+ "-V",
42
+ "-y",
43
+ package,
44
+ ]
45
+ end
46
+
47
+ def need_super_user_priviledge?
48
+ true
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,50 @@
1
+ # Copyright (C) 2022-2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require_relative "red-hat-enterprise-linux"
17
+
18
+ module RubyGemsRequirementsSystem
19
+ module Platform
20
+ class AmazonLinux2 < RedHatEnterpriseLinux
21
+ Platform.register(self)
22
+
23
+ class << self
24
+ def current_platform?
25
+ os_release = OSRelease.new
26
+ os_release.id == "amzn" and os_release.version == "2"
27
+ end
28
+ end
29
+
30
+ def target?(platform)
31
+ case platform
32
+ when "amazon_linux_2", "amazon_linux"
33
+ true
34
+ else
35
+ super
36
+ end
37
+ end
38
+
39
+ private
40
+ def install_command_line(package)
41
+ [
42
+ "yum",
43
+ "install",
44
+ "-y",
45
+ package,
46
+ ]
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,40 @@
1
+ # Copyright (C) 2023-2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require_relative "fedora"
17
+
18
+ module RubyGemsRequirementsSystem
19
+ module Platform
20
+ class AmazonLinux2023 < Fedora
21
+ Platform.register(self)
22
+
23
+ class << self
24
+ def current_platform?
25
+ os_release = OSRelease.new
26
+ os_release.id == "amzn" and os_release.version == "2023"
27
+ end
28
+ end
29
+
30
+ def target?(platform)
31
+ case platform
32
+ when "amazon_linux_2023", "amazon_linux"
33
+ true
34
+ else
35
+ super
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,43 @@
1
+ # Copyright (C) 2017-2025 Ruby-GNOME Project Team
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require_relative "base"
17
+
18
+ module RubyGemsRequirementsSystem
19
+ module Platform
20
+ class ArchLinux < Base
21
+ Platform.register(self)
22
+
23
+ class << self
24
+ def current_platform?
25
+ ExecutableFinder.exist?("pacman")
26
+ end
27
+ end
28
+
29
+ def target?(platform)
30
+ platform == "arch_linux"
31
+ end
32
+
33
+ private
34
+ def install_command_line(package)
35
+ ["pacman", "-S", "--noconfirm", package]
36
+ end
37
+
38
+ def need_super_user_priviledge?
39
+ true
40
+ end
41
+ end
42
+ end
43
+ end