Skip to content

Commit a0ab39d

Browse files
committed
feat(scripts): load gem targets from config
1 parent 7feb70c commit a0ab39d

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

MAINTAINERS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ A helper script is available to build and push all gems in one go:
6464
ruby scripts/publish_gems.rb
6565
```
6666

67+
The list of target triples used by the script lives in
68+
`scripts/targets.txt`. You can override it by passing targets as
69+
arguments to the helper script.
70+
6771
### Native extension gem
6872

6973
1. Install the development dependencies:

scripts/publish_gems.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33

44
require 'fileutils'
55

6-
TARGETS = [
7-
'x86_64-unknown-linux-gnu',
8-
'aarch64-unknown-linux-gnu',
9-
'x86_64-apple-darwin',
10-
'aarch64-apple-darwin',
11-
'x86_64-pc-windows-msvc'
12-
].freeze
6+
def load_targets
7+
return ARGV unless ARGV.empty?
138

9+
config_path = File.join(__dir__, 'targets.txt')
10+
unless File.exist?(config_path)
11+
abort("No targets specified and #{config_path} is missing")
12+
end
13+
14+
File.readlines(config_path, chomp: true)
15+
.map { |l| l.strip }
16+
.reject { |l| l.empty? || l.start_with?('#') }
17+
end
18+
19+
TARGETS = load_targets.freeze
1420

1521
def run(cmd, env = {})
1622
command = env.map { |k, v| "#{k}=#{v}" }.join(' ')

scripts/targets.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
x86_64-unknown-linux-gnu
2+
aarch64-unknown-linux-gnu
3+
x86_64-apple-darwin
4+
aarch64-apple-darwin
5+
x86_64-pc-windows-msvc

0 commit comments

Comments
 (0)