rubygems-requirements-system 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +141 -0
- data/Rakefile +35 -0
- data/doc/text/gpl-3.txt +674 -0
- data/doc/text/lgpl-3.txt +165 -0
- data/doc/text/news.md +5 -0
- data/lib/rubygems-requirements-system/executable-finder.rb +87 -0
- data/lib/rubygems-requirements-system/installer.rb +122 -0
- data/lib/rubygems-requirements-system/os-release.rb +59 -0
- data/lib/rubygems-requirements-system/package.rb +17 -0
- data/lib/rubygems-requirements-system/platform/alpine-linux.rb +44 -0
- data/lib/rubygems-requirements-system/platform/alt-linux.rb +52 -0
- data/lib/rubygems-requirements-system/platform/amazon-linux-2.rb +50 -0
- data/lib/rubygems-requirements-system/platform/amazon-linux-2023.rb +40 -0
- data/lib/rubygems-requirements-system/platform/arch-linux.rb +43 -0
- data/lib/rubygems-requirements-system/platform/base.rb +135 -0
- data/lib/rubygems-requirements-system/platform/conda.rb +43 -0
- data/lib/rubygems-requirements-system/platform/debian.rb +67 -0
- data/lib/rubygems-requirements-system/platform/fedora.rb +44 -0
- data/lib/rubygems-requirements-system/platform/freebsd.rb +43 -0
- data/lib/rubygems-requirements-system/platform/gentoo-linux.rb +50 -0
- data/lib/rubygems-requirements-system/platform/homebrew.rb +43 -0
- data/lib/rubygems-requirements-system/platform/macports.rb +43 -0
- data/lib/rubygems-requirements-system/platform/pld-linux.rb +43 -0
- data/lib/rubygems-requirements-system/platform/red-hat-enterprise-linux.rb +67 -0
- data/lib/rubygems-requirements-system/platform/suse.rb +51 -0
- data/lib/rubygems-requirements-system/platform/ubuntu.rb +41 -0
- data/lib/rubygems-requirements-system/platform/unknown.rb +31 -0
- data/lib/rubygems-requirements-system/platform.rb +72 -0
- data/lib/rubygems-requirements-system/version.rb +18 -0
- data/lib/rubygems_plugin.rb +21 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7b4f3b0dc17cf9b76958081357cc6f9cf1ab338e86a88aad5ed4643d9bca8766
|
4
|
+
data.tar.gz: 4ebf3a4f17907e0c5ac6ce55a857eeddc5265cb85c6cd229a19f89ca5b738eb2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dabaddfe7338b0918888b16933b8c110a2bd6a7de9b626e425fab0736b6314d70f3daf48814f4c69d778f6d178f3da2b5e05a626ceec3c37090125f0fc35586e
|
7
|
+
data.tar.gz: 6f6caa567e5e2d34c680e86e8ba08ca60b1d8f0d6cdfcde0314c90b5db86ae39314796fefe938b009d919a97d9f2c25be1b704144660b034a08222be529d1e6b
|
data/README.md
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
# rubygems-requirements-system
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
|
5
|
+
This is a RubyGems plugin. This installs system packages that are
|
6
|
+
needed by a gem automatically.
|
7
|
+
|
8
|
+
This is convenient for both of users and developers.
|
9
|
+
|
10
|
+
Users don't need to install gem dependencies separately.
|
11
|
+
|
12
|
+
Developers don't need to write documents how to install gem
|
13
|
+
dependencies.
|
14
|
+
|
15
|
+
## Motivation
|
16
|
+
|
17
|
+
Bindings are helpful for developers because developers don't need to
|
18
|
+
re-implement existing features. But users need to install not only
|
19
|
+
bindings but also dependencies.
|
20
|
+
|
21
|
+
There are some approaches to reduce the inconvenience:
|
22
|
+
|
23
|
+
1. Installs dependencies automatically
|
24
|
+
2. Bundles dependencies (a.k.a. fat gem)
|
25
|
+
|
26
|
+
The 1. approach is used by Ruby-GNOME packages such as glib2 gem and
|
27
|
+
gtk4 gem.
|
28
|
+
|
29
|
+
The 2. approach is used by Nokogiri.
|
30
|
+
|
31
|
+
If gems that use the 2. approach are maintained actively, there are
|
32
|
+
not much problems. There are several problems otherwise. For example,
|
33
|
+
security concerns and new CRuby support.
|
34
|
+
|
35
|
+
See also:
|
36
|
+
https://slide.rabbit-shocker.org/authors/kou/rubykaigi-takeout-2020/
|
37
|
+
|
38
|
+
The 1. approach will reduce maintenance costs. It will help both of
|
39
|
+
developers and users. If we can reduce maintenance costs for
|
40
|
+
developers, developers can focus on new features and bug fixes than
|
41
|
+
releases.
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
Add `rubygems-requirements-system` to your gem's runtime dependencies:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
Gem::Specification.new do |spec|
|
49
|
+
# ...
|
50
|
+
spec.add_runtime_dependency("rubygems-requirements-system")
|
51
|
+
# ...
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
Add dependency information to `Gem::Specification#requirements`:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
Gem::Specification.new do |spec|
|
59
|
+
# ...
|
60
|
+
|
61
|
+
# Install GObject. Package ID is pkg-config's package name for now.
|
62
|
+
# We'll add support for other package system's name such as CMake
|
63
|
+
# package's name.
|
64
|
+
# We can specify package names for each platform.
|
65
|
+
spec.requirements << "system: gobject-2.0: alt_linux: glib2-devel"
|
66
|
+
spec.requirements << "system: gobject-2.0: arch_linux: glib2"
|
67
|
+
spec.requirements << "system: gobject-2.0: conda: glib"
|
68
|
+
spec.requirements << "system: gobject-2.0: debian: libglib2.0-dev"
|
69
|
+
spec.requirements << "system: gobject-2.0: gentoo_linux: dev-libs/glib"
|
70
|
+
spec.requirements << "system: gobject-2.0: homebrew: glib"
|
71
|
+
spec.requirements << "system: gobject-2.0: macports: glib2"
|
72
|
+
# We can omit the Red Hat Enterprise Linux family case because
|
73
|
+
# "pkgconfig(gobject-2.0)" can be generated automatically.
|
74
|
+
spec.requirements << "system: gobject-2.0: rhel: pkgconfig(gobject-2.0)"
|
75
|
+
|
76
|
+
# ...
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
You can require dependency A or B. For example, you can require
|
81
|
+
`mysqlclient` or `libmariadb`.
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
Gem::Specification.new do |spec|
|
85
|
+
# ...
|
86
|
+
|
87
|
+
# We need mysqliclient or libmariadb for this gem.
|
88
|
+
spec.requirements << "system: mysqlclient|libmariadb: arch_linux: mariadb-libs"
|
89
|
+
spec.requirements << "system: mysqlclient|libmariadb: debian: libmysqlclient-dev"
|
90
|
+
spec.requirements << "system: mysqlclient|libmariadb: debian: libmariadb-dev"
|
91
|
+
|
92
|
+
# ...
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
You can install multiple packages for a dependency.
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
Gem::Specification.new do |spec|
|
100
|
+
# ...
|
101
|
+
|
102
|
+
# We need to install multiple packages to use cairo with conda.
|
103
|
+
spec.requirements << "system: cairo: conda: cairo"
|
104
|
+
spec.requirements << "system: cairo: conda: expat"
|
105
|
+
spec.requirements << "system: cairo: conda: xorg-kbproto"
|
106
|
+
spec.requirements << "system: cairo: conda: xorg-libxau"
|
107
|
+
spec.requirements << "system: cairo: conda: xorg-libxext"
|
108
|
+
spec.requirements << "system: cairo: conda: xorg-libxrender"
|
109
|
+
spec.requirements << "system: cairo: conda: xorg-renderproto"
|
110
|
+
spec.requirements << "system: cairo: conda: xorg-xextproto"
|
111
|
+
spec.requirements << "system: cairo: conda: xorg-xproto"
|
112
|
+
spec.requirements << "system: cairo: conda: zlib"
|
113
|
+
|
114
|
+
# ...
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
118
|
+
## Requirements
|
119
|
+
|
120
|
+
RubyGems 3.5.0 or later is required. RubyGems can load installed
|
121
|
+
plugin immediately since 3.5.0.
|
122
|
+
|
123
|
+
If `gem install glib2` installs rubygems-requirements-system gem as a
|
124
|
+
dependency, old RubyGems doesn't use a RubyGems plugin in
|
125
|
+
rubygems-requirements-system gem while installing glib2 gem. So glib2
|
126
|
+
gem dependencies aren't installed automatically.
|
127
|
+
|
128
|
+
## History
|
129
|
+
|
130
|
+
This is based on
|
131
|
+
[native-package-installer](https://github.com/ruby-gnome/native-package-installer)
|
132
|
+
gem. We could add support for RubyGems plugin to
|
133
|
+
native-package-installer but we didn't. Because "native" package isn't
|
134
|
+
a natural name for a package on the target platform. We want to use
|
135
|
+
other word than "native". So we create a new gem.
|
136
|
+
|
137
|
+
## License
|
138
|
+
|
139
|
+
Copyright (C) 2013-2025 Ruby-GNOME Project Team
|
140
|
+
|
141
|
+
LGPL-3 or later. See doc/text/lgpl-3.txt for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2025 Ruby-GNOME Project Team
|
4
|
+
#
|
5
|
+
# This library is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require "bundler/gem_helper"
|
19
|
+
|
20
|
+
base_dir = File.dirname(__FILE__)
|
21
|
+
helper = Bundler::GemHelper.new(base_dir)
|
22
|
+
def helper.version_tag
|
23
|
+
version
|
24
|
+
end
|
25
|
+
helper.install
|
26
|
+
|
27
|
+
release_task = Rake.application["release"]
|
28
|
+
# We use Trusted Publishing.
|
29
|
+
release_task.prerequisites.delete("build")
|
30
|
+
release_task.prerequisites.delete("release:rubygem_push")
|
31
|
+
release_task_comment = release_task.comment
|
32
|
+
if release_task_comment
|
33
|
+
release_task.clear_comments
|
34
|
+
release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
|
35
|
+
end
|