rb_sys 0.9.46 → 0.9.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f77f084cfb03e13eb0357b3e63b0d8d516ff8e1fac6acf9c6bb98072668ca730
4
- data.tar.gz: c3db1bd7e0886b182555ec81a539e6f91a5beaf172efb588b6efffd2733ad27b
3
+ metadata.gz: 0c20a93e6f901cd93729c524f5637ea642504062393f119c5972ccc198f5c431
4
+ data.tar.gz: 7c3ac7ce3e4085eaadbba8a546ce6a8aabbb61ef8f4b79a47604a8876644bfcc
5
5
  SHA512:
6
- metadata.gz: f54a91c1e95826f61c1df74e5c971e8a41e9fa07a74759f1fb6e8ce854ec174e8097e178198a3d8319e0e192229fab54090ad20e1d1940b9fb9d92675a8ac6cf
7
- data.tar.gz: 1926663702290069dec03533acb610090fac519c37c086e6ff3f52c0a8e70e9be21a960c3ce17e8ad81a2dccf7a90709dde6093e4cf642255c8aed03bee6d2d1
6
+ metadata.gz: a39231d9b950fcc2e5b589ef64e7309c76247cc199feaa4eedaba5137fbdb6cb77daba429990b2a91a5fc3c173c6d677e17a59c573ab680b83d40d4c5c38ede7
7
+ data.tar.gz: 21ac41ec59a49f655a12315066f720036bac026ed086fd410a0562cf3f75c1620992346f33d7d106c50b0d7e9b7f7cb001186fe8f8f9425450dfde0687ccc882
checksums.yaml.gz.sig CHANGED
Binary file
data/exe/rb-sys-dock ADDED
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "optparse"
4
+ require "rb_sys/version"
5
+ require "rb_sys/toolchain_info"
6
+
7
+ options = {
8
+ version: RbSys::VERSION
9
+ }
10
+
11
+ def log(level, message, emoji: true, io: $stderr)
12
+ emoji_opt, shellcode = case level
13
+ when :error
14
+ ["❌", "\e[1;31m"]
15
+ when :warn
16
+ ["⚠️", "\e[1;33m"]
17
+ when :info
18
+ ["ℹ️", "\e[1;37m"]
19
+ when :notice
20
+ ["🐳", "\e[1;34m"]
21
+ else raise "Unknown log level: #{level.inspect}"
22
+ end
23
+
24
+ emoji_opt = if emoji.is_a?(String)
25
+ emoji + " "
26
+ elsif emoji
27
+ emoji_opt + " "
28
+ end
29
+
30
+ io.puts "#{shellcode}#{emoji_opt}#{message}\e[0m"
31
+ end
32
+
33
+ OptionParser.new do |opts|
34
+ opts.banner = "Usage: rb-sys-dock --platform PLATFORM [COMMAND]"
35
+
36
+ opts.on("-v", "--version", "Prints version") do
37
+ require "rb_sys/version"
38
+ puts RbSys::VERSION
39
+ exit
40
+ end
41
+
42
+ opts.on("-p", "--platform PLATFORM", "Platform to build for (i.e. x86_64-linux)") do |p|
43
+ toolchain_info = begin
44
+ RbSys::ToolchainInfo.new(p)
45
+ rescue
46
+ supported_list = RbSys::ToolchainInfo.all
47
+ supported_list.select!(&:supported?)
48
+ list = supported_list.map { |p| "- #{p} (#{p.rust_target})" }.join("\n")
49
+ log(:error, "Platform #{p} is not supported, please use one of:\n\n#{list}")
50
+ exit(1)
51
+ end
52
+
53
+ options[:platform] = p
54
+ options[:toolchain_info] = toolchain_info
55
+ end
56
+
57
+ opts.on("--latest", "Use the latest version of the Docker image") do
58
+ log(:notice, "Using latest version of the Docker image", emoji: "🆕")
59
+ options[:version] = "latest"
60
+ end
61
+
62
+ opts.on("--list-platforms", "--list", "List all supported platforms") do
63
+ log(:notice, "Supported platforms listed below:")
64
+
65
+ RbSys::ToolchainInfo.supported.each do |p|
66
+ log(:info, "- #{p} (#{p.rust_target})", emoji: false, io: $stdout)
67
+ end
68
+
69
+ exit(0)
70
+ end
71
+
72
+ opts.on("-h", "--help", "Prints this help") do
73
+ puts opts
74
+ exit
75
+ end
76
+ end.parse!
77
+
78
+ def rcd(input_args)
79
+ begin
80
+ require "rake_compiler_dock"
81
+ rescue LoadError
82
+ abort "rake-compiler-dock is not installed. Please run `gem install rake-compiler-dock` to use this command."
83
+ end
84
+
85
+ args = input_args.empty? ? ["bash"] : input_args.dup
86
+
87
+ if $stdin.tty?
88
+ # An interactive session should not leave the container on Ctrl-C
89
+ args << {sigfw: false}
90
+ end
91
+
92
+ begin
93
+ RakeCompilerDock.exec(*args) do |ok, res|
94
+ exit(res.exitstatus)
95
+ end
96
+ rescue RakeCompilerDock::DockerIsNotAvailable
97
+ exit(-1)
98
+ end
99
+ end
100
+
101
+ def download_image(_options)
102
+ image = ENV.fetch("RCD_IMAGE")
103
+ if `docker images -q #{image}`.strip.empty?
104
+ # Nicely formatted message that we are downloading the image which might take awhile
105
+ log(:notice, "Downloading container #{image.inspect}, this might take awhile...")
106
+ system("docker pull #{image} --quiet > /dev/null")
107
+ end
108
+ end
109
+
110
+ def log_some_useful_info(_options)
111
+ if ARGV.empty?
112
+ log(:notice, "Entering shell in Docker container #{ENV["RCD_IMAGE"].inspect}")
113
+ else
114
+ log(:notice, "Running command #{ARGV.inspect} in Docker container #{ENV["RCD_IMAGE"].inspect}")
115
+ end
116
+ end
117
+
118
+ def set_env(options)
119
+ ENV["RCD_IMAGE"] = "rbsys/#{options[:toolchain_info]}:#{options[:version]}"
120
+ end
121
+
122
+ set_env(options)
123
+ download_image(options)
124
+ log_some_useful_info(options)
125
+ rcd(ARGV)
@@ -18,6 +18,10 @@ module RbSys
18
18
  @all ||= DATA.keys.map { |k| new(k) }
19
19
  end
20
20
 
21
+ def supported
22
+ @supported ||= all.select(&:supported?)
23
+ end
24
+
21
25
  def local
22
26
  @current ||= new(RbConfig::CONFIG["arch"])
23
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbSys
4
- VERSION = "0.9.46"
4
+ VERSION = "0.9.48"
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.46
4
+ version: 0.9.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
@@ -30,18 +30,20 @@ cert_chain:
30
30
  Rl+ASkq2/1i07TkBpCf+2hq66+h/hx+/Y/KrUzXfe0jtvil0WESkJT2kqRqHWNhD
31
31
  9GKBxaQlXokNDtWCm1/gl6cD8WRZ0N5S4ZGJT1FLLsA=
32
32
  -----END CERTIFICATE-----
33
- date: 2022-12-05 00:00:00.000000000 Z
33
+ date: 2022-12-12 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description:
36
36
  email:
37
37
  - i.kerseymer@gmail.com
38
- executables: []
38
+ executables:
39
+ - rb-sys-dock
39
40
  extensions: []
40
41
  extra_rdoc_files: []
41
42
  files:
42
43
  - LICENSE-APACHE
43
44
  - LICENSE-MIT
44
45
  - certs/ianks.pem
46
+ - exe/rb-sys-dock
45
47
  - lib/rb_sys.rb
46
48
  - lib/rb_sys/cargo_builder.rb
47
49
  - lib/rb_sys/cargo_builder/link_flag_converter.rb
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- "��O{��j�3_#j�#Di�S�F���3�r |��I�э^����������k����}v�s=̻1��6�>
2
- {���G(x��l�;���Ͻ�[�X}��s�C���径�ɽ��cLq�a�L��Zڇ(���(p��H[x�������v]���*1)W�r��z�\ v�����S�2Y�چ�7�/�g�����'��E��H��1΁
1
+ ���g;��`��q��Zu/M=\��Y����0 u
2
+ 9���E�˘ 8�ׅ66��^�j�Ѝ[c7!Cn5e�P>Z�+&�S�
3
+ ���ki� ���+My �ץ�����_EU�4�v#ʆ��N�Fx:��K���{(ǝ_�mU���0�8��5wZ�O�S!_Ef~�qvf����)� �/i�#�62���՜��zCk��ě�Z�'���W/�^���_��`ֺ\�dF웈�T.��wG��]S���w$