rb_sys 0.1.0 → 0.1.1

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: e650056d7563c1227524d815d43e7654d5b58da5f9289e728199bc55283eb191
4
- data.tar.gz: 2753b100e813a4552ab8ff54c25f81a907164bbf0f136043b9a189831f0b9da2
3
+ metadata.gz: 47fb2e73263b33afa15f4ac7d7c1b07e752d18c7a85eaebf9e8bb2d22290a582
4
+ data.tar.gz: f279658a40c3f61275ad78df0c3168599281a150424607ef0529bd8e2381e53c
5
5
  SHA512:
6
- metadata.gz: f8c2d47e88fdd0c3725921e02bdf0f3e1514a8ae6d81e76c9327c9af2a0ce4b3645caea3290e84ec7c6ed23188142e024dda0b9716d7d8b2038703a4962e4d1b
7
- data.tar.gz: 96440631627644e6fb2a2cb3306591cbe592e4bfa4c1a2cba17e2026ed1c2e9ddf494b0a033d6fa522d8f9f3a45b0964c62db9b6f6c11f41778a2696b3f8c81d
6
+ metadata.gz: 2899ac6f022b458be71dfb6cc5188d5e5a5e759bc13d816beac0e6c28376d342a9fa2dac0e6171895723d0bfb8b0f5f2ce54373177e2e1de1931e019514f1ee1
7
+ data.tar.gz: 45112b70ade6c7fca1c3f5a4d3034840f90cf53daf599f08e00d2db29a5285b2f212a24a206aa1696374971077cc2e82c4f5aa10a85fe48feeb2179eab205ca8
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rb_sys/mkmf.rb CHANGED
@@ -1,32 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rubygems/ext"
4
- require "rubygems/ext/cargo_builder"
4
+ require "shellwords"
5
+ require_relative "./../../vendor/rubygems/ext/cargo_builder"
5
6
 
6
7
  # Root module
7
8
  module RbSys
8
9
  # Helpers for creating a Ruby compatible makefile for Rust
9
10
  module Mkmf
10
- def create_rust_makefile(target, cargo_dir = Dir.pwd)
11
+ def create_rust_makefile(target, srcprefix = nil)
12
+ if target.include?("/")
13
+ target_prefix, target = File.split(target)
14
+ target_prefix[0, 0] = "/"
15
+ else
16
+ target_prefix = ""
17
+ end
18
+
19
+ spec = Struct.new(:name, :metadata).new(target, {})
20
+ builder = Gem::Ext::CargoBuilder.new(spec)
21
+ srcprefix ||= "$(srcdir)/#{srcprefix}".chomp("/")
22
+ RbConfig.expand(srcdir = srcprefix.dup)
23
+
11
24
  # rubocop:disable Style/GlobalVars
12
25
  make_install = <<~MAKE
13
- target_prefix = /#{target}
26
+ target_prefix = #{target_prefix}
14
27
  CARGO_PROFILE = release
15
- CLEANLIBS = target/ $(RUSTLIB) $(DLLIB)
16
- DLLIB = $(TARGET).#{RbConfig::CONFIG["DLEXT"]}
28
+ CLEANLIBS = $(RUSTLIB) $(DLLIB)
29
+ DISTCLEANDIRS = target/
17
30
  RUBYARCHDIR = $(sitearchdir)$(target_prefix)
18
- RUSTLIB = target/$(CARGO_PROFILE)/lib$(TARGET).#{RbConfig::CONFIG["SOEXT"]}
31
+ RUSTLIB = #{dllib_path(builder)}
19
32
  TARGET = #{target}
33
+ DLLIB = $(TARGET).#{RbConfig::CONFIG["DLEXT"]}
20
34
 
21
- #{base_makefile(cargo_dir)}
35
+ #{base_makefile(srcdir)}
22
36
 
23
- #{env_vars(cargo_dir, target)}
37
+ #{env_vars(builder)}
24
38
 
25
39
  FORCE: ;
26
40
 
27
41
  $(DLLIB): FORCE
28
- \t#{cargo_command(cargo_dir, target)}
29
- \tcp $(RUSTLIB) $@
42
+ \t#{cargo_command(srcdir, builder)}
43
+ \t$(COPY) "$(RUSTLIB)" $@
30
44
 
31
45
  install: $(DLLIB)
32
46
  \t$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
@@ -34,34 +48,35 @@ module RbSys
34
48
  all: #{$extout ? "install" : "$(DLLIB)"}
35
49
  MAKE
36
50
 
37
- File.write(File.join(cargo_dir, "Makefile"), make_install)
51
+ File.write("Makefile", make_install)
38
52
  end
39
53
  # rubocop:enable Style/GlobalVars
40
54
 
41
55
  private
42
56
 
43
57
  def base_makefile(cargo_dir)
44
- base_makefile = dummy_makefile(cargo_dir).join("\n")
58
+ base_makefile = dummy_makefile(__dir__).join("\n")
45
59
  base_makefile.gsub!("all install static install-so install-rb", "all static install-so install-rb")
46
60
  base_makefile.gsub!("clean-so::", "clean-so:\n\t-$(Q)$(RM) $(DLLIB)\n")
61
+ base_makefile.gsub!(/^srcdir = .*$/, "srcdir = #{cargo_dir}")
47
62
  base_makefile
48
63
  end
49
64
 
50
- def cargo_command(cargo_dir, target)
51
- spec = Struct.new(:name, :metadata).new(target, {})
52
- builder = Gem::Ext::CargoBuilder.new(spec)
53
- dest_path = File.join(cargo_dir, "target")
65
+ def cargo_command(cargo_dir, builder)
66
+ dest_path = File.join(Dir.pwd, "target")
54
67
  args = []
55
68
  cargo_cmd = builder.cargo_command(cargo_dir, dest_path, args)
56
- cargo_cmd.join(" ")
69
+ Shellwords.join(cargo_cmd).gsub("\\=", "=")
57
70
  end
58
71
 
59
- def env_vars(cargo_dir, target)
60
- spec = Struct.new(:name, :metadata).new(target, {})
61
- builder = Gem::Ext::CargoBuilder.new(spec)
72
+ def env_vars(builder)
62
73
  builder.build_env.map { |k, v| %($(DLLIB): export #{k} = #{v.gsub("\n", '\n')}) }.join("\n")
63
74
  end
75
+
76
+ def dllib_path(builder)
77
+ builder.cargo_dylib_path(File.join(Dir.pwd, "target"))
78
+ end
64
79
  end
65
80
  end
66
81
 
67
- Kernel.include RbSys::Mkmf
82
+ include RbSys::Mkmf # rubocop:disable Style/MixinUsage
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbSys
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
4
+ # Converts Ruby link flags into something cargo understands
5
+ class LinkFlagConverter
6
+ def self.convert(arg)
7
+ case arg.chomp
8
+ when /^-L\s*(.+)$/
9
+ ["-L", "native=#{$1}"]
10
+ when /^--library=(\w+\S+)$/, /^-l\s*(\w+\S+)$/
11
+ ["-l", $1]
12
+ when /^-l\s*:lib(\S+).a$/
13
+ ["-l", "static=#{$1}"]
14
+ when /^-l\s*:lib(\S+).(so|dylib|dll)$/
15
+ ["-l", "dylib=#{$1}"]
16
+ when /^-F\s*(.*)$/
17
+ ["-l", "framework=#{$1}"]
18
+ else
19
+ ["-C", "link_arg=#{arg}"]
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,330 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This class is used by rubygems to build Rust extensions. It is a thin-wrapper
4
+ # over the `cargo rustc` command which takes care of building Rust code in a way
5
+ # that Ruby can use.
6
+ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
7
+ attr_accessor :spec, :runner, :profile
8
+
9
+ def initialize(spec)
10
+ require "rubygems/command"
11
+ require_relative "cargo_builder/link_flag_converter"
12
+
13
+ @spec = spec
14
+ @runner = self.class.method(:run)
15
+ @profile = :release
16
+ end
17
+
18
+ def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd)
19
+ require "fileutils"
20
+ require "shellwords"
21
+
22
+ build_crate(dest_path, results, args, cargo_dir)
23
+ validate_cargo_build!(dest_path)
24
+ rename_cdylib_for_ruby_compatibility(dest_path)
25
+ finalize_directory(dest_path, lib_dir, cargo_dir)
26
+ results
27
+ end
28
+
29
+ def build_crate(dest_path, results, args, cargo_dir)
30
+ env = build_env
31
+ cmd = cargo_command(cargo_dir, dest_path, args)
32
+ runner.call cmd, results, "cargo", cargo_dir, env
33
+
34
+ results
35
+ end
36
+
37
+ def build_env
38
+ build_env = rb_config_env
39
+ build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?("RUBY_STATIC")
40
+ build_env
41
+ end
42
+
43
+ def cargo_command(cargo_dir, dest_path, args = [])
44
+ manifest = File.join(cargo_dir, "Cargo.toml")
45
+ cargo = ENV.fetch("CARGO", "cargo")
46
+
47
+ cmd = []
48
+ cmd += [cargo, "rustc"]
49
+ cmd += ["--target", ENV["CARGO_BUILD_TARGET"]] if ENV["CARGO_BUILD_TARGET"]
50
+ cmd += ["--target-dir", dest_path]
51
+ cmd += ["--manifest-path", manifest]
52
+ cmd += ["--lib"]
53
+ cmd += ["--profile", profile.to_s]
54
+ cmd += ["--locked"] if profile == :release
55
+ cmd += Gem::Command.build_args
56
+ cmd += args
57
+ cmd += ["--"]
58
+ cmd += [*cargo_rustc_args(dest_path)]
59
+ cmd
60
+ end
61
+
62
+ def cargo_dylib_path(dest_path)
63
+ prefix = so_ext == "dll" ? "" : "lib"
64
+ path_parts = [dest_path]
65
+ path_parts << ENV["CARGO_BUILD_TARGET"] if ENV["CARGO_BUILD_TARGET"]
66
+ path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"]
67
+ File.join(*path_parts)
68
+ end
69
+
70
+ private
71
+
72
+ def rb_config_env
73
+ result = {}
74
+ RbConfig::CONFIG.each { |k, v| result["RBCONFIG_#{k}"] = v }
75
+ result
76
+ end
77
+
78
+ def cargo_rustc_args(dest_dir)
79
+ [
80
+ *linker_args,
81
+ *mkmf_libpath,
82
+ *rustc_dynamic_linker_flags(dest_dir),
83
+ *rustc_lib_flags(dest_dir),
84
+ *platform_specific_rustc_args(dest_dir),
85
+ *debug_flags
86
+ ]
87
+ end
88
+
89
+ def platform_specific_rustc_args(dest_dir, flags = [])
90
+ if mingw_target?
91
+ # On mingw platforms, mkmf adds libruby to the linker flags
92
+ flags += libruby_args(dest_dir)
93
+
94
+ # Make sure ALSR is used on mingw
95
+ # see https://github.com/rust-lang/rust/pull/75406/files
96
+ flags += ["-C", "link-arg=-Wl,--dynamicbase"]
97
+ flags += ["-C", "link-arg=-Wl,--disable-auto-image-base"]
98
+
99
+ # If the gem is installed on a host with build tools installed, but is
100
+ # run on one that isn't the missing libraries will cause the extension
101
+ # to fail on start.
102
+ flags += ["-C", "link-arg=-static-libgcc"]
103
+ end
104
+
105
+ flags
106
+ end
107
+
108
+ # We want to use the same linker that Ruby uses, so that the linker flags from
109
+ # mkmf work properly.
110
+ def linker_args
111
+ # Have to handle CC="cl /nologo" on mswin
112
+ cc_flag = Shellwords.split(makefile_config("CC"))
113
+ linker = cc_flag.shift
114
+ link_args = cc_flag.flat_map { |a| ["-C", "link-arg=#{a}"] }
115
+
116
+ ["-C", "linker=#{linker}", *link_args]
117
+ end
118
+
119
+ def libruby_args(dest_dir)
120
+ libs = makefile_config(ruby_static? ? "LIBRUBYARG_STATIC" : "LIBRUBYARG_SHARED")
121
+ raw_libs = Shellwords.split(libs)
122
+ raw_libs.flat_map { |l| ldflag_to_link_modifier(l) }
123
+ end
124
+
125
+ def ruby_static?
126
+ return true if %w[1 true].include?(ENV["RUBY_STATIC"])
127
+
128
+ makefile_config("ENABLE_SHARED") == "no"
129
+ end
130
+
131
+ # Ruby expects the dylib to follow a file name convention for loading
132
+ def rename_cdylib_for_ruby_compatibility(dest_path)
133
+ new_path = final_extension_path(dest_path)
134
+ FileUtils.cp(cargo_dylib_path(dest_path), new_path)
135
+ new_path
136
+ end
137
+
138
+ def validate_cargo_build!(dir)
139
+ dylib_path = cargo_dylib_path(dir)
140
+
141
+ raise DylibNotFoundError, dir unless File.exist?(dylib_path)
142
+
143
+ dylib_path
144
+ end
145
+
146
+ def final_extension_path(dest_path)
147
+ dylib_path = cargo_dylib_path(dest_path)
148
+ dlext_name = "#{spec.name}.#{makefile_config("DLEXT")}"
149
+ dylib_path.gsub(File.basename(dylib_path), dlext_name)
150
+ end
151
+
152
+ def cargo_crate_name
153
+ spec.metadata.fetch("cargo_crate_name", spec.name).tr("-", "_")
154
+ end
155
+
156
+ def rustc_dynamic_linker_flags(dest_dir)
157
+ split_flags("DLDFLAGS")
158
+ .map { |arg| maybe_resolve_ldflag_variable(arg, dest_dir) }
159
+ .compact
160
+ .flat_map { |arg| ldflag_to_link_modifier(arg) }
161
+ end
162
+
163
+ def rustc_lib_flags(dest_dir)
164
+ split_flags("LIBS").flat_map { |arg| ldflag_to_link_modifier(arg) }
165
+ end
166
+
167
+ def split_flags(var)
168
+ Shellwords.split(RbConfig::CONFIG.fetch(var, ""))
169
+ end
170
+
171
+ def ldflag_to_link_modifier(arg)
172
+ LinkFlagConverter.convert(arg)
173
+ end
174
+
175
+ def msvc_target?
176
+ makefile_config("target_os").include?("msvc")
177
+ end
178
+
179
+ def darwin_target?
180
+ makefile_config("target_os").include?("darwin")
181
+ end
182
+
183
+ def mingw_target?
184
+ makefile_config("target_os").include?("mingw")
185
+ end
186
+
187
+ def win_target?
188
+ target_platform = RbConfig::CONFIG["target_os"]
189
+ !!Gem::WIN_PATTERNS.find { |r| target_platform =~ r }
190
+ end
191
+
192
+ # Interpolate substition vars in the arg (i.e. $(DEFFILE))
193
+ def maybe_resolve_ldflag_variable(input_arg, dest_dir)
194
+ var_matches = input_arg.match(/\$\((\w+)\)/)
195
+
196
+ return input_arg unless var_matches
197
+
198
+ var_name = var_matches[1]
199
+
200
+ return input_arg if var_name.nil? || var_name.chomp.empty?
201
+
202
+ case var_name
203
+ # On windows, it is assumed that mkmf has setup an exports file for the
204
+ # extension, so we have to to create one ourselves.
205
+ when "DEFFILE"
206
+ write_deffile(dest_dir)
207
+ else
208
+ RbConfig::CONFIG[var_name]
209
+ end
210
+ end
211
+
212
+ def write_deffile(dest_path)
213
+ dest_dir = File.dirname(final_extension_path(dest_path))
214
+ FileUtils.mkdir_p(dest_dir)
215
+ deffile_path = File.join(dest_dir, "#{spec.name}-#{RbConfig::CONFIG["arch"]}.def")
216
+ export_prefix = makefile_config("EXPORT_PREFIX") || ""
217
+
218
+ File.open(deffile_path, "w") do |f|
219
+ f.puts "EXPORTS"
220
+ f.puts "#{export_prefix.strip}Init_#{spec.name}"
221
+ end
222
+
223
+ deffile_path
224
+ end
225
+
226
+ # We have to basically reimplement RbConfig::CONFIG['SOEXT'] here to support
227
+ # Ruby < 2.5
228
+ #
229
+ # @see https://github.com/ruby/ruby/blob/c87c027f18c005460746a74c07cd80ee355b16e4/configure.ac#L3185
230
+ def so_ext
231
+ return RbConfig::CONFIG["SOEXT"] if RbConfig::CONFIG.key?("SOEXT")
232
+
233
+ if win_target?
234
+ "dll"
235
+ elsif darwin_target?
236
+ "dylib"
237
+ else
238
+ "so"
239
+ end
240
+ end
241
+
242
+ # Corresponds to $(LIBPATH) in mkmf
243
+ def mkmf_libpath
244
+ ["-L", "native=#{makefile_config("libdir")}"]
245
+ end
246
+
247
+ def makefile_config(var_name)
248
+ val = RbConfig::MAKEFILE_CONFIG[var_name]
249
+
250
+ return unless val
251
+
252
+ RbConfig.expand(val.dup)
253
+ end
254
+
255
+ # Good balance between binary size and debugability
256
+ def debug_flags
257
+ return [] if profile == :dev
258
+
259
+ ["-C", "debuginfo=1"]
260
+ end
261
+
262
+ # Copied from ExtConfBuilder
263
+ def finalize_directory(dest_path, lib_dir, extension_dir)
264
+ require "fileutils"
265
+ require "tempfile"
266
+
267
+ ext_path = final_extension_path(dest_path)
268
+
269
+ begin
270
+ tmp_dest = Dir.mktmpdir(".gem.", extension_dir)
271
+
272
+ # Some versions of `mktmpdir` return absolute paths, which will break make
273
+ # if the paths contain spaces. However, on Ruby 1.9.x on Windows, relative
274
+ # paths cause all C extension builds to fail.
275
+ #
276
+ # As such, we convert to a relative path unless we are using Ruby 1.9.x on
277
+ # Windows. This means that when using Ruby 1.9.x on Windows, paths with
278
+ # spaces do not work.
279
+ #
280
+ # Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
281
+ tmp_dest_relative = get_relative_path(tmp_dest.clone, extension_dir)
282
+
283
+ if tmp_dest_relative
284
+ full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
285
+
286
+ # TODO: remove in RubyGems 3
287
+ if Gem.install_extension_in_lib && lib_dir
288
+ FileUtils.mkdir_p lib_dir
289
+ FileUtils.cp_r ext_path, lib_dir, remove_destination: true
290
+ end
291
+
292
+ FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|
293
+ destent = ent.class.new(dest_path, ent.rel)
294
+ destent.exist? || FileUtils.mv(ent.path, destent.path)
295
+ end
296
+ end
297
+ ensure
298
+ FileUtils.rm_rf tmp_dest if tmp_dest
299
+ end
300
+ end
301
+
302
+ def get_relative_path(path, base)
303
+ path[0..base.length - 1] = "." if path.start_with?(base)
304
+ path
305
+ end
306
+
307
+ def profile_target_directory
308
+ case profile
309
+ when :release then "release"
310
+ when :dev then "debug"
311
+ else raise "unknown target directory for profile: #{profile}"
312
+ end
313
+ end
314
+
315
+ # Error raised when no cdylib artifact was created
316
+ class DylibNotFoundError < StandardError
317
+ def initialize(dir)
318
+ files = Dir.glob(File.join(dir, "**", "*")).map { |f| "- #{f}" }.join "\n"
319
+
320
+ super <<~MSG
321
+ Dynamic library not found for Rust extension (in #{dir})
322
+
323
+ Make sure you set "crate-type" in Cargo.toml to "cdylib"
324
+
325
+ Found files:
326
+ #{files}
327
+ MSG
328
+ end
329
+ end
330
+ 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.1.0
4
+ version: 0.1.1
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-04-13 00:00:00.000000000 Z
33
+ date: 2022-04-23 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description:
36
36
  email:
@@ -39,20 +39,13 @@ executables: []
39
39
  extensions: []
40
40
  extra_rdoc_files: []
41
41
  files:
42
- - ".rubocop.yml"
43
- - ".standard.yml"
44
- - CHANGELOG.md
45
- - Gemfile
46
- - Gemfile.lock
47
- - LICENSE.txt
48
- - README.md
49
- - Rakefile
50
42
  - certs/ianks.pem
51
43
  - lib/rb_sys.rb
52
44
  - lib/rb_sys/mkmf.rb
53
45
  - lib/rb_sys/version.rb
54
- - rb_sys.gemspec
55
46
  - sig/rb_sys.rbs
47
+ - vendor/rubygems/ext/cargo_builder.rb
48
+ - vendor/rubygems/ext/cargo_builder/link_flag_converter.rb
56
49
  homepage: https://github.com/oxidize-rb/rb-sys
57
50
  licenses:
58
51
  - MIT
@@ -73,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
66
  - !ruby/object:Gem::Version
74
67
  version: '0'
75
68
  requirements: []
76
- rubygems_version: 3.4.0.dev
69
+ rubygems_version: 3.3.7
77
70
  signing_key:
78
71
  specification_version: 4
79
72
  summary: Helpers for compiling Rust extensions for ruby
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- hh����syxnGCa����
2
- �wN)�9�ZV!�8w ��۔�L�G� ��%$K�s��}yc�N�4W����rr~Gˢ�H�f�:{G�!s�j2�T��EK:OB��*Ojz{��3��p
1
+ ��O㧍�sH=y5hp&��*�}Fi�'�A��4�0�C{�\0˻�FQ�)�k}@]93���vǛ*8�@��{�����,-Ij���R5�N������]�rz���*R�pܥ�ޗϬ�p�0Q��gT�$$��bw�Œ
data/.rubocop.yml DELETED
@@ -1,4 +0,0 @@
1
- require: standard
2
-
3
- inherit_gem:
4
- standard: config/base.yml
data/.standard.yml DELETED
@@ -1,3 +0,0 @@
1
- # For available configuration options, see:
2
- # https://github.com/testdouble/standard
3
- ruby_version: 2.6
data/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2022-04-13
4
-
5
- - Initial release
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in rb_sys.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "minitest", "~> 5.0"
11
-
12
- gem "standard", "~> 1.3"
data/Gemfile.lock DELETED
@@ -1,48 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rb_sys (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.2)
10
- minitest (5.15.0)
11
- parallel (1.22.1)
12
- parser (3.1.2.0)
13
- ast (~> 2.4.1)
14
- rainbow (3.1.1)
15
- rake (13.0.6)
16
- regexp_parser (2.3.0)
17
- rexml (3.2.5)
18
- rubocop (1.27.0)
19
- parallel (~> 1.10)
20
- parser (>= 3.1.0.0)
21
- rainbow (>= 2.2.2, < 4.0)
22
- regexp_parser (>= 1.8, < 3.0)
23
- rexml
24
- rubocop-ast (>= 1.16.0, < 2.0)
25
- ruby-progressbar (~> 1.7)
26
- unicode-display_width (>= 1.4.0, < 3.0)
27
- rubocop-ast (1.17.0)
28
- parser (>= 3.1.1.0)
29
- rubocop-performance (1.13.3)
30
- rubocop (>= 1.7.0, < 2.0)
31
- rubocop-ast (>= 0.4.0)
32
- ruby-progressbar (1.11.0)
33
- standard (1.10.0)
34
- rubocop (= 1.27.0)
35
- rubocop-performance (= 1.13.3)
36
- unicode-display_width (2.1.0)
37
-
38
- PLATFORMS
39
- arm64-darwin-21
40
-
41
- DEPENDENCIES
42
- minitest (~> 5.0)
43
- rake (~> 13.0)
44
- rb_sys!
45
- standard (~> 1.3)
46
-
47
- BUNDLED WITH
48
- 2.4.0.dev
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 Ian Ker-Seymer
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/README.md DELETED
@@ -1,33 +0,0 @@
1
- # RbSys
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rb_sys`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Install the gem and add to the application's Gemfile by executing:
10
-
11
- $ bundle add rb_sys
12
-
13
- If bundler is not being used to manage dependencies, install the gem by executing:
14
-
15
- $ gem install rb_sys
16
-
17
- ## Usage
18
-
19
- TODO: Write usage instructions here
20
-
21
- ## Development
22
-
23
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
-
25
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
-
27
- ## Contributing
28
-
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/ianks/rb_sys.
30
-
31
- ## License
32
-
33
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rake/testtask"
5
-
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/test_*.rb"]
10
- end
11
-
12
- require "standard/rake"
13
-
14
- task default: %i[test standard]
data/rb_sys.gemspec DELETED
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/rb_sys/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "rb_sys"
7
- spec.version = RbSys::VERSION
8
- spec.authors = ["Ian Ker-Seymer"]
9
- spec.email = ["i.kerseymer@gmail.com"]
10
-
11
- spec.summary = "Helpers for compiling Rust extensions for ruby"
12
- spec.homepage = "https://github.com/oxidize-rb/rb-sys"
13
- spec.license = "MIT"
14
- spec.required_ruby_version = ">= 2.4.0"
15
-
16
- spec.metadata["homepage_uri"] = spec.homepage
17
- spec.metadata["source_code_uri"] = "https://github.com/oxidize-rb/rb-sys"
18
- # spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here."
19
-
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(__dir__) do
23
- `git ls-files -z`.split("\x0").reject do |f|
24
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
- end
26
- end
27
- spec.bindir = "exe"
28
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
30
-
31
- # Security
32
- spec.cert_chain = ["certs/ianks.pem"]
33
- spec.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if /gem\z/.match?($0) # rubocop:disable Performance/EndWith
34
- spec.metadata = {"rubygems_mfa_required" => "true"}
35
- end