rb_sys 0.9.51 → 0.9.53

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ddfeaef1982ecc7adb1ffe2875637d009553c46a283d01db8bf55decc5c8a09
4
- data.tar.gz: 682b1a33bb6eb4e3ecc6b98514ff165ab562eae52903183c00654604d2f568ac
3
+ metadata.gz: 56c789860ee94f5b011b20cfd9867fef895b7a219a614a29732c1750f1456f31
4
+ data.tar.gz: a735a77694677786ee5e94e6bdb9658e91fbd81a397463cc3143456b05fda7e5
5
5
  SHA512:
6
- metadata.gz: cedf35c9746e0f41baf8c518ef314689e4d3c579558a026bdcff03edff072c0b77f0d8b907649308792af170f7d838f7588d72c04c6f3e4f1f5c8d4a89c22186
7
- data.tar.gz: b5c80c63eae32b9a97d33d5800270b54323257f596041dcebc169f760fae253250fe09edc4b51057c27f72e8bd08f79a1345f8422754a968f3df96d01ab695b7
6
+ metadata.gz: 60a29e09977445f55a95a0de6ca1d35cb6a710e3c305c45a2baeadfd0ca98cf0eb27de487a1d50d6b0d8a87ba2a37d567f53c983b18c7fd4dd8920eb6301e75e
7
+ data.tar.gz: ecbacfadeadbcb0a1630bafb90720b3eae6bc79f096f245fa01c33bdda9ab36322fa79536252fcbb4e84a5340559e28f2a2fc75a27fd666a074ffc29020ba18a
checksums.yaml.gz.sig CHANGED
Binary file
data/exe/rb-sys-dock CHANGED
@@ -38,6 +38,42 @@ def log(level, message, emoji: true, io: $stderr)
38
38
  io.puts "#{shellcode}#{emoji_opt}#{escaped}\e[0m"
39
39
  end
40
40
 
41
+ def default_docker_command
42
+ return @default_docker_command if defined?(@default_docker_command)
43
+
44
+ @default_docker_command = ENV.fetch("DOCKER", "docker")
45
+ end
46
+
47
+ def run_command!(cmd)
48
+ log(:trace, "Running command: $ #{cmd}")
49
+ stdout, stderr, status = Open3.capture3(cmd)
50
+
51
+ if status.success?
52
+ stdout
53
+ else
54
+ log(:error, "Error running command: $ #{cmd}")
55
+ warn(stderr)
56
+ exit(status.exitstatus)
57
+ end
58
+ end
59
+
60
+ def docker(cmd)
61
+ require "open3"
62
+
63
+ run_command!("#{default_docker_command} #{cmd}")
64
+ rescue Errno::ENOENT
65
+ log(:trace, "Could not find docker command, trying podman")
66
+
67
+ begin
68
+ stdout = run_command!("podman #{cmd}")
69
+ @default_docker_command = "podman"
70
+ stdout
71
+ rescue Errno::ENOENT
72
+ log(:error, "Could not find docker or podman command, please install one of them")
73
+ exit(1)
74
+ end
75
+ end
76
+
41
77
  OptionParser.new do |opts|
42
78
  opts.banner = "Usage: rb-sys-dock --platform PLATFORM [COMMAND]"
43
79
 
@@ -156,7 +192,7 @@ def rcd(input_args, options)
156
192
  run_command = input_args.empty? ? "bash" : input_args.join(" ")
157
193
 
158
194
  cmd = <<~SH
159
- #{docker_command} run \
195
+ #{default_docker_command} run \
160
196
  -v #{Dir.pwd}:#{Dir.pwd} \
161
197
  #{mount_target_dir(options, extra_env)} \
162
198
  #{mount_cargo_registry} \
@@ -183,24 +219,18 @@ def rcd(input_args, options)
183
219
  #{run_command}
184
220
  SH
185
221
 
186
- log(:trace, "Running command: \n$ #{cmd}")
222
+ log(:trace, "Running command: $ #{cmd}")
187
223
 
188
224
  exec(cmd)
189
225
  end
190
226
 
191
- def docker_command
192
- return @docker_command if defined?(@docker_command)
193
-
194
- @docker_command = ENV.fetch("DOCKER", "docker")
195
- end
196
-
197
227
  def download_image(_options)
198
228
  image = ENV.fetch("RCD_IMAGE")
199
229
 
200
- if `#{docker_command} images -q #{image}`.strip.empty?
230
+ if docker("images -q #{image}").strip.empty?
201
231
  # Nicely formatted message that we are downloading the image which might take awhile
202
232
  log(:notice, "Downloading container #{image.inspect}, this might take awhile...")
203
- system("#{docker_command} pull #{image} --quiet > /dev/null")
233
+ docker("pull #{image} --quiet > /dev/null")
204
234
  end
205
235
  end
206
236
 
@@ -22,14 +22,12 @@ module RbSys
22
22
  ["-L", "native=#{$1}"]
23
23
  when /^--library=(\w+\S+)$/, /^-l\s*(\w+\S+)$/
24
24
  ["-l", $1]
25
- when /^-l\s*:lib(\S+).a$/
26
- ["-l", "static=#{$1}"]
27
25
  when /^-l\s*:lib(\S+).(so|dylib|dll)$/
28
26
  ["-l", "dylib=#{$1}"]
29
27
  when /^-F\s*(.*)$/
30
28
  ["-l", "framework=#{$1}"]
31
29
  else
32
- ["-C", "link_arg=#{arg}"]
30
+ ["-C", "link-arg=#{arg}"]
33
31
  end
34
32
  end
35
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbSys
4
- VERSION = "0.9.51"
4
+ VERSION = "0.9.53"
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb_sys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.51
4
+ version: 0.9.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
@@ -30,7 +30,7 @@ cert_chain:
30
30
  Rl+ASkq2/1i07TkBpCf+2hq66+h/hx+/Y/KrUzXfe0jtvil0WESkJT2kqRqHWNhD
31
31
  9GKBxaQlXokNDtWCm1/gl6cD8WRZ0N5S4ZGJT1FLLsA=
32
32
  -----END CERTIFICATE-----
33
- date: 2022-12-15 00:00:00.000000000 Z
33
+ date: 2022-12-26 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description:
36
36
  email:
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.3.22
77
+ rubygems_version: 3.3.26
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Helpers for compiling Rust extensions for ruby
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ����q�R���i���36n,�����2`�O�Joq��l����-��ܻ ��k`l;j��d�V��&'p�@2�f�l�8:L��kU<��E�X���Qm����Pnte��w��@:�^����__��2�׾�!dӍ]�cNz{m�O����`�\�'V|��e|�9��x����9�K"�ҷ��짪E-��e��[*���秢�"��Qv�8��6͌�z�$�]J;7�ﳁ �إ����7��7SC�`U��'{m
1
+ =���X��@Q@�,
2
+ LC��!��"�?o��9k��C�n�Vj=c�*�a�5D�*�e�Dr�#��H�{%�|Ԕn�}w "4��;vW��⇧���@����$���ڄ�I�ye�#Y��[#;!q����������ʪހ�*�q×���:*$�^��.� ���Hskdq���ue�b�|���~Oe���<� �a?p0���_����#d(�]IΈ 'w+/G��I��_*�܃)���[����ԩ���