librollenspielsache-rb 0.0.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 +7 -0
- data/.github/workflows/ruby.yml +24 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +54 -0
- data/README.md +35 -0
- data/Rakefile +16 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/librollenspielsache.so +0 -0
- data/lib/librollenspielsache/dice/roll.rb +47 -0
- data/lib/librollenspielsache/dice/roll_result.rb +27 -0
- data/lib/librollenspielsache/version.rb +5 -0
- data/lib/librollenspielsache.rb +10 -0
- data/librollenspielsache-rb.gemspec +35 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce29474760b8d89db90f29af3379e9380b084c5f6a07c5b58f137cad0e91eb6a
|
4
|
+
data.tar.gz: d068cdac8e26e3518d93cef2b06169179bd05486480be2bc91a52bc286ceea84
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9bd84a55ad5f57cc69080d02807172815d6dab280f57ac8c8e7508ae7036f66bf705d38a8d04998f0817bf942db95b9a6bc3158e1496df548006158106488e0e
|
7
|
+
data.tar.gz: 5b85a5edbbd34949a0ee9a14c85bc15705c6371477544f484cf02ca7c8d5966e66ec58956ca265f9f5e090e76dcb2bba9ce76d9252b2ca95985f30b9fb6132fd
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby 2.7
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.7.x
|
20
|
+
- name: Build and test with Rake
|
21
|
+
run: |
|
22
|
+
gem install bundler
|
23
|
+
bundle install --jobs 4 --retry 3
|
24
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
librollenspielsache-rb (0.0.1)
|
5
|
+
ffi
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
ffi (1.12.2)
|
13
|
+
jaro_winkler (1.5.4)
|
14
|
+
parallel (1.19.1)
|
15
|
+
parser (2.7.1.0)
|
16
|
+
ast (~> 2.4.0)
|
17
|
+
rainbow (3.0.0)
|
18
|
+
rake (12.3.3)
|
19
|
+
rexml (3.2.4)
|
20
|
+
rspec (3.9.0)
|
21
|
+
rspec-core (~> 3.9.0)
|
22
|
+
rspec-expectations (~> 3.9.0)
|
23
|
+
rspec-mocks (~> 3.9.0)
|
24
|
+
rspec-core (3.9.2)
|
25
|
+
rspec-support (~> 3.9.3)
|
26
|
+
rspec-expectations (3.9.1)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.9.0)
|
29
|
+
rspec-mocks (3.9.1)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.9.0)
|
32
|
+
rspec-support (3.9.3)
|
33
|
+
rubocop (0.80.1)
|
34
|
+
jaro_winkler (~> 1.5.1)
|
35
|
+
parallel (~> 1.10)
|
36
|
+
parser (>= 2.7.0.1)
|
37
|
+
rainbow (>= 2.2.2, < 4.0)
|
38
|
+
rexml
|
39
|
+
ruby-progressbar (~> 1.7)
|
40
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
41
|
+
ruby-progressbar (1.10.1)
|
42
|
+
unicode-display_width (1.6.1)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
librollenspielsache-rb!
|
49
|
+
rake (~> 12.0)
|
50
|
+
rspec (~> 3.0)
|
51
|
+
rubocop
|
52
|
+
|
53
|
+
BUNDLED WITH
|
54
|
+
2.1.4
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Librollenspielsache-rb
|
2
|
+
|
3
|
+
Ruby bindings for [`librollenspielsache`](https://crates.io/crates/librollenspielsache).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'librollenspielsache-rb'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install librollenspielsache-rb
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
27
|
+
|
28
|
+
For now, this expects a pre-compiled `librollenspielsache.so` available in `ext/`. One is provided with the repo.
|
29
|
+
|
30
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/librollenspielsache-rb.
|
35
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
|
7
|
+
ENV['LD_LIBRARY_PATH'] = 'ext'
|
8
|
+
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
|
11
|
+
RuboCop::RakeTask.new(:lint) do |task|
|
12
|
+
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
13
|
+
task.fail_on_error = false
|
14
|
+
end
|
15
|
+
|
16
|
+
task default: :spec
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "librollenspielsache/rb"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
Binary file
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Librollenspielsache
|
4
|
+
module Dice
|
5
|
+
# A single roll
|
6
|
+
class Roll < FFI::AutoPointer
|
7
|
+
class << self
|
8
|
+
def release(ptr)
|
9
|
+
Binding.free ptr
|
10
|
+
end
|
11
|
+
|
12
|
+
def from_str(str)
|
13
|
+
Binding.from_str str
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
Binding.execute self
|
19
|
+
end
|
20
|
+
|
21
|
+
def base
|
22
|
+
Binding.get_base self
|
23
|
+
end
|
24
|
+
|
25
|
+
def repeat
|
26
|
+
Binding.get_repeat self
|
27
|
+
end
|
28
|
+
|
29
|
+
# Rust exported fns
|
30
|
+
module Binding
|
31
|
+
extend FFI::Library
|
32
|
+
ffi_lib 'librollenspielsache'
|
33
|
+
|
34
|
+
# Builds a new Roll from a string
|
35
|
+
attach_function :from_str, :roll_from_str, [:string], Roll
|
36
|
+
# Free the object
|
37
|
+
attach_function :free, :roll_free, [], :void
|
38
|
+
# Returns a pointer to RollResult
|
39
|
+
attach_function :execute, :roll_execute, [Roll], :pointer
|
40
|
+
# Get the base
|
41
|
+
attach_function :get_base, :roll_base, [Roll], :int
|
42
|
+
# Get the repeat
|
43
|
+
attach_function :get_repeat, :roll_repeat, [Roll], :uint
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ffi'
|
4
|
+
|
5
|
+
module Librollenspielsache
|
6
|
+
module Dice
|
7
|
+
# The Result from a roll
|
8
|
+
class RollResult < FFI::AutoPointer
|
9
|
+
def self.release(ptr)
|
10
|
+
Binding.free ptr
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s(ptr)
|
14
|
+
Binding.to_s ptr
|
15
|
+
end
|
16
|
+
|
17
|
+
# Rust externs
|
18
|
+
module Binding
|
19
|
+
extend FFI::Library
|
20
|
+
ffi_lib 'librollenspielsache'
|
21
|
+
|
22
|
+
attach_function :to_s, :roll_result_to_string, [:pointer], :string
|
23
|
+
attach_function :free, :roll_result_free, [:pointer], :void
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/librollenspielsache/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'librollenspielsache-rb'
|
7
|
+
spec.version = Librollenspielsache::VERSION
|
8
|
+
spec.authors = ['Ben Lovy']
|
9
|
+
spec.email = ['ben@deciduously.com']
|
10
|
+
|
11
|
+
spec.summary = 'Ruby binding for librolenspiesache'
|
12
|
+
spec.description = 'Complete Ruby-idiomatic wrapper for librollenspielsache'
|
13
|
+
spec.homepage = 'https://github.com/deciduously/librollenspielsache-rb'
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
15
|
+
|
16
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
17
|
+
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/deciduously/librollenspielsache-rb'
|
20
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
21
|
+
|
22
|
+
# spec.add_dependency 'dotenv'
|
23
|
+
spec.add_dependency 'ffi'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'rubocop'
|
26
|
+
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
|
+
end
|
32
|
+
spec.bindir = 'exe'
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ['lib']
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: librollenspielsache-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Lovy
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ffi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Complete Ruby-idiomatic wrapper for librollenspielsache
|
42
|
+
email:
|
43
|
+
- ben@deciduously.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".github/workflows/ruby.yml"
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
57
|
+
- ext/librollenspielsache.so
|
58
|
+
- lib/librollenspielsache.rb
|
59
|
+
- lib/librollenspielsache/dice/roll.rb
|
60
|
+
- lib/librollenspielsache/dice/roll_result.rb
|
61
|
+
- lib/librollenspielsache/version.rb
|
62
|
+
- librollenspielsache-rb.gemspec
|
63
|
+
homepage: https://github.com/deciduously/librollenspielsache-rb
|
64
|
+
licenses: []
|
65
|
+
metadata:
|
66
|
+
allowed_push_host: https://rubygems.org
|
67
|
+
homepage_uri: https://github.com/deciduously/librollenspielsache-rb
|
68
|
+
source_code_uri: https://github.com/deciduously/librollenspielsache-rb
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.0
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.1.2
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: Ruby binding for librolenspiesache
|
88
|
+
test_files: []
|