rb_sys 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/.rubocop.yml +4 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +48 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +14 -0
- data/certs/ianks.pem +21 -0
- data/lib/rb_sys/mkmf.rb +67 -0
- data/lib/rb_sys/version.rb +5 -0
- data/lib/rb_sys.rb +8 -0
- data/rb_sys.gemspec +35 -0
- data/sig/rb_sys.rbs +4 -0
- data.tar.gz.sig +0 -0
- metadata +80 -0
- metadata.gz.sig +2 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e650056d7563c1227524d815d43e7654d5b58da5f9289e728199bc55283eb191
|
4
|
+
data.tar.gz: 2753b100e813a4552ab8ff54c25f81a907164bbf0f136043b9a189831f0b9da2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f8c2d47e88fdd0c3725921e02bdf0f3e1514a8ae6d81e76c9327c9af2a0ce4b3645caea3290e84ec7c6ed23188142e024dda0b9716d7d8b2038703a4962e4d1b
|
7
|
+
data.tar.gz: 96440631627644e6fb2a2cb3306591cbe592e4bfa4c1a2cba17e2026ed1c2e9ddf494b0a033d6fa522d8f9f3a45b0964c62db9b6f6c11f41778a2696b3f8c81d
|
checksums.yaml.gz.sig
ADDED
data/.rubocop.yml
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
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
ADDED
@@ -0,0 +1,21 @@
|
|
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
ADDED
@@ -0,0 +1,33 @@
|
|
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
ADDED
@@ -0,0 +1,14 @@
|
|
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/certs/ianks.pem
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtpLmtl
|
3
|
+
cnNleW1lcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
4
|
+
Y29tMB4XDTIyMDQxMzE5NTY1MVoXDTIzMDQxMzE5NTY1MVowQjEUMBIGA1UEAwwL
|
5
|
+
aS5rZXJzZXltZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
6
|
+
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMJ2pG+er4cP
|
7
|
+
PasxsMIKL9/tmLL4gh80EMuF3SCS0qZoh+Oo8dkvRYxW8NXdwEIcp3cCNgE+5G+J
|
8
|
+
TCMOVF8S15n1Z1P7xxXiXxa/BIofKKbtatVRngm14uR/6pjdkvLXqlrWdS57bNwv
|
9
|
+
7LtpzYVfDHfsl/qRWaEi4jq00PNCRSWjcva8teqswjBg8KlwGtyygpezPbVSWP8Y
|
10
|
+
vzWZmVF7fqRBXU78Ah0+pNOhslBXDTvI3xJdN4hQ3H7rLjpD/qxKWq/8o+Qvx6cX
|
11
|
+
dNZ3ugH/Pr3BAsqt4JFLXin9AK7PO9GDMH5JXJrUb+hAt2VNIZqpz9VlKA6BA0jN
|
12
|
+
eWGea+yCZkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
13
|
+
BBYEFOkrF6hsocaIMOjR/K3JBzyXCLJPMCAGA1UdEQQZMBeBFWkua2Vyc2V5bWVy
|
14
|
+
QGdtYWlsLmNvbTAgBgNVHRIEGTAXgRVpLmtlcnNleW1lckBnbWFpbC5jb20wDQYJ
|
15
|
+
KoZIhvcNAQEFBQADggEBADHnvHbZn5nldcpArIQcFF9URCBloCBZHqLFMhlGj5BX
|
16
|
+
bFvuoq4CBmEFiJpTazeoEaxPlsmIK1+4CqBXwg8lHEMC9RV5g9QtJHQry2eFE/8U
|
17
|
+
WrgCbqdxb8HBl9ayOHRcdfcv0RHBlmBHwBOoQ+hXMlInjssjfIX4BS39mTYefclE
|
18
|
+
zxOFntl+vb4kluo0j9/BGzdnGCo7iE+GfGSENFdOn2J38RCDLUzgOCmCtxzSvldq
|
19
|
+
Rl+ASkq2/1i07TkBpCf+2hq66+h/hx+/Y/KrUzXfe0jtvil0WESkJT2kqRqHWNhD
|
20
|
+
9GKBxaQlXokNDtWCm1/gl6cD8WRZ0N5S4ZGJT1FLLsA=
|
21
|
+
-----END CERTIFICATE-----
|
data/lib/rb_sys/mkmf.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubygems/ext"
|
4
|
+
require "rubygems/ext/cargo_builder"
|
5
|
+
|
6
|
+
# Root module
|
7
|
+
module RbSys
|
8
|
+
# Helpers for creating a Ruby compatible makefile for Rust
|
9
|
+
module Mkmf
|
10
|
+
def create_rust_makefile(target, cargo_dir = Dir.pwd)
|
11
|
+
# rubocop:disable Style/GlobalVars
|
12
|
+
make_install = <<~MAKE
|
13
|
+
target_prefix = /#{target}
|
14
|
+
CARGO_PROFILE = release
|
15
|
+
CLEANLIBS = target/ $(RUSTLIB) $(DLLIB)
|
16
|
+
DLLIB = $(TARGET).#{RbConfig::CONFIG["DLEXT"]}
|
17
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
18
|
+
RUSTLIB = target/$(CARGO_PROFILE)/lib$(TARGET).#{RbConfig::CONFIG["SOEXT"]}
|
19
|
+
TARGET = #{target}
|
20
|
+
|
21
|
+
#{base_makefile(cargo_dir)}
|
22
|
+
|
23
|
+
#{env_vars(cargo_dir, target)}
|
24
|
+
|
25
|
+
FORCE: ;
|
26
|
+
|
27
|
+
$(DLLIB): FORCE
|
28
|
+
\t#{cargo_command(cargo_dir, target)}
|
29
|
+
\tcp $(RUSTLIB) $@
|
30
|
+
|
31
|
+
install: $(DLLIB)
|
32
|
+
\t$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
33
|
+
|
34
|
+
all: #{$extout ? "install" : "$(DLLIB)"}
|
35
|
+
MAKE
|
36
|
+
|
37
|
+
File.write(File.join(cargo_dir, "Makefile"), make_install)
|
38
|
+
end
|
39
|
+
# rubocop:enable Style/GlobalVars
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def base_makefile(cargo_dir)
|
44
|
+
base_makefile = dummy_makefile(cargo_dir).join("\n")
|
45
|
+
base_makefile.gsub!("all install static install-so install-rb", "all static install-so install-rb")
|
46
|
+
base_makefile.gsub!("clean-so::", "clean-so:\n\t-$(Q)$(RM) $(DLLIB)\n")
|
47
|
+
base_makefile
|
48
|
+
end
|
49
|
+
|
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")
|
54
|
+
args = []
|
55
|
+
cargo_cmd = builder.cargo_command(cargo_dir, dest_path, args)
|
56
|
+
cargo_cmd.join(" ")
|
57
|
+
end
|
58
|
+
|
59
|
+
def env_vars(cargo_dir, target)
|
60
|
+
spec = Struct.new(:name, :metadata).new(target, {})
|
61
|
+
builder = Gem::Ext::CargoBuilder.new(spec)
|
62
|
+
builder.build_env.map { |k, v| %($(DLLIB): export #{k} = #{v.gsub("\n", '\n')}) }.join("\n")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Kernel.include RbSys::Mkmf
|
data/lib/rb_sys.rb
ADDED
data/rb_sys.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
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
|
data/sig/rb_sys.rbs
ADDED
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rb_sys
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ian Ker-Seymer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtpLmtl
|
14
|
+
cnNleW1lcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
15
|
+
Y29tMB4XDTIyMDQxMzE5NTY1MVoXDTIzMDQxMzE5NTY1MVowQjEUMBIGA1UEAwwL
|
16
|
+
aS5rZXJzZXltZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
17
|
+
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMJ2pG+er4cP
|
18
|
+
PasxsMIKL9/tmLL4gh80EMuF3SCS0qZoh+Oo8dkvRYxW8NXdwEIcp3cCNgE+5G+J
|
19
|
+
TCMOVF8S15n1Z1P7xxXiXxa/BIofKKbtatVRngm14uR/6pjdkvLXqlrWdS57bNwv
|
20
|
+
7LtpzYVfDHfsl/qRWaEi4jq00PNCRSWjcva8teqswjBg8KlwGtyygpezPbVSWP8Y
|
21
|
+
vzWZmVF7fqRBXU78Ah0+pNOhslBXDTvI3xJdN4hQ3H7rLjpD/qxKWq/8o+Qvx6cX
|
22
|
+
dNZ3ugH/Pr3BAsqt4JFLXin9AK7PO9GDMH5JXJrUb+hAt2VNIZqpz9VlKA6BA0jN
|
23
|
+
eWGea+yCZkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
24
|
+
BBYEFOkrF6hsocaIMOjR/K3JBzyXCLJPMCAGA1UdEQQZMBeBFWkua2Vyc2V5bWVy
|
25
|
+
QGdtYWlsLmNvbTAgBgNVHRIEGTAXgRVpLmtlcnNleW1lckBnbWFpbC5jb20wDQYJ
|
26
|
+
KoZIhvcNAQEFBQADggEBADHnvHbZn5nldcpArIQcFF9URCBloCBZHqLFMhlGj5BX
|
27
|
+
bFvuoq4CBmEFiJpTazeoEaxPlsmIK1+4CqBXwg8lHEMC9RV5g9QtJHQry2eFE/8U
|
28
|
+
WrgCbqdxb8HBl9ayOHRcdfcv0RHBlmBHwBOoQ+hXMlInjssjfIX4BS39mTYefclE
|
29
|
+
zxOFntl+vb4kluo0j9/BGzdnGCo7iE+GfGSENFdOn2J38RCDLUzgOCmCtxzSvldq
|
30
|
+
Rl+ASkq2/1i07TkBpCf+2hq66+h/hx+/Y/KrUzXfe0jtvil0WESkJT2kqRqHWNhD
|
31
|
+
9GKBxaQlXokNDtWCm1/gl6cD8WRZ0N5S4ZGJT1FLLsA=
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2022-04-13 00:00:00.000000000 Z
|
34
|
+
dependencies: []
|
35
|
+
description:
|
36
|
+
email:
|
37
|
+
- i.kerseymer@gmail.com
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
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
|
+
- certs/ianks.pem
|
51
|
+
- lib/rb_sys.rb
|
52
|
+
- lib/rb_sys/mkmf.rb
|
53
|
+
- lib/rb_sys/version.rb
|
54
|
+
- rb_sys.gemspec
|
55
|
+
- sig/rb_sys.rbs
|
56
|
+
homepage: https://github.com/oxidize-rb/rb-sys
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata:
|
60
|
+
rubygems_mfa_required: 'true'
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.4.0
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubygems_version: 3.4.0.dev
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Helpers for compiling Rust extensions for ruby
|
80
|
+
test_files: []
|
metadata.gz.sig
ADDED