rb_sys 0.9.51 → 0.9.52

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: 28dd4004edc786adedca1a62a05510881875c6ec30b8a0513c109a619e5034db
4
+ data.tar.gz: 84f5e07b271ff931636ba8e5ea9a5a438604898e27695039ed9f36ea8018cd48
5
5
  SHA512:
6
- metadata.gz: cedf35c9746e0f41baf8c518ef314689e4d3c579558a026bdcff03edff072c0b77f0d8b907649308792af170f7d838f7588d72c04c6f3e4f1f5c8d4a89c22186
7
- data.tar.gz: b5c80c63eae32b9a97d33d5800270b54323257f596041dcebc169f760fae253250fe09edc4b51057c27f72e8bd08f79a1345f8422754a968f3df96d01ab695b7
6
+ metadata.gz: 50bbc9b84dbf72f86f380fbff63a88e10b7d9214c12d54d536ceb53740d1449ec398c53d3b4fc94c441853c3d142b490f46c2fa1ccb53dcd43661eb7492f2269
7
+ data.tar.gz: 49e918700f006a122cd7bcc1010d460416b265c4debc38e14f0d005a2404e7d8b7be197e9907c2c6952d209b5c41414c94dad567d4fa5a4bd5234ec148e03922
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.52"
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.52
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-17 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description:
36
36
  email:
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ����q�R���i���36n,�����2`�OJoq��l����-��ܻ ��k`l;j��dV��&'p�@2f�l�8:L��kU<��E�X���Qm����Pnte��w��@:�^����__��2�׾�!dӍ]cNz{mO����`�\�'V|��e|�9��x����9�K"�ҷ��짪E-��e��[*���秢�"��Qv8��6͌�z�$�]J;7�ﳁ �إ����7��7SC�`U��'{m
1
+ ��ZU�R'��XAW��m�6����H���V�1\3�r8�Ѽ�ױ������12p8v:ݴ�h#o���)��S�E���i?}�:(E3�{�"�
2
+ C�"yԆ~���h����{A���W�5'�6��֪�jXO�\y��-�� �]�?���B�������2�S��~���H�d���1�$�o٧��0ȥ(� .��ѕ��qU�=� Cq&�'���F�~�=�� �|r�1���Pw�6�53�zasŹ%ك��