rs_floating_duration 0.1.1 → 0.1.2
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +24 -8
- data/Rakefile +13 -0
- data/lib/rs_floating_duration/version.rb +1 -1
- data/lib/rs_floating_duration.rb +6 -1
- metadata +6 -9
- data/lib/rs_floating_duration/rs_floating_duration.bundle +0 -0
- data/lib/rs_floating_duration/rs_floating_duration.so +0 -0
- data/rs_floating_duration.gemspec +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9be6ac88f81a3a53fc246561480526d4b5dfab8b40e3a169f30e66ff6ec6c35
|
4
|
+
data.tar.gz: 0b6153bb65573860f9a6a56f88cd63b48bec4983b51b3723c7004bf0d1a9b1e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18c1851fd707014e3ffd1e8ea107c39231f510025277bd740299ee346381e659941dbb80718655dd37d978dff52fb2e62c51149cf225c4fcf8730df34e015752
|
7
|
+
data.tar.gz: 4f50851940b3abe4f4d4ef9b9c4473ad0f0e1ee2eda53859bee467251acb237aa9577a99726574ce24cc2eda3a7d6095ce7d035c6d5ed83f72e63d608dc83461
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# RsFloatingDuration
|
2
2
|
|
3
|
-
This is a simple Ruby gem that wraps the Rust Crate called
|
4
|
-
(https://github.com/torkleyy/floating-duration).
|
3
|
+
This is a simple Ruby gem that wraps the Rust Crate called
|
4
|
+
[floating_duration](https://github.com/torkleyy/floating-duration).
|
5
|
+
|
6
|
+
The primary purpose of this gem is as a minimal example of how to wrap a native
|
7
|
+
library in a ruby gem.
|
5
8
|
|
6
9
|
## Installation
|
7
10
|
|
@@ -15,14 +18,27 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
15
18
|
|
16
19
|
## Usage
|
17
20
|
|
18
|
-
|
21
|
+
Here's an example irb session illustrating how to use this gem:
|
19
22
|
|
20
|
-
|
23
|
+
```ruby
|
24
|
+
irb(main):001> require "rs_floating_duration"
|
25
|
+
=> true
|
26
|
+
irb(main):002> RsFloatingDuration.time_format(0.5)
|
27
|
+
=> "500.000ms"
|
28
|
+
irb(main):003> RsFloatingDuration.time_format_long(0.5)
|
29
|
+
=> "500.000 milliseconds"
|
30
|
+
```
|
21
31
|
|
22
|
-
|
32
|
+
## Development
|
23
33
|
|
24
|
-
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can
|
35
|
+
also run `bin/console` for an interactive prompt that will allow you to
|
36
|
+
experiment.
|
25
37
|
|
26
|
-
|
38
|
+
You will need rust installed to compile the extension.
|
27
39
|
|
28
|
-
|
40
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
41
|
+
release a new version, update the version number in `version.rb`, and then run
|
42
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
43
|
+
git commits and the created tag, and push the `.gem` file to
|
44
|
+
[rubygems.org](https://rubygems.org).
|
data/Rakefile
CHANGED
@@ -10,6 +10,12 @@ GEMSPEC = Gem::Specification.load("rs_floating_duration.gemspec")
|
|
10
10
|
|
11
11
|
RbSys::ExtensionTask.new("rs_floating_duration", GEMSPEC) do |ext|
|
12
12
|
ext.lib_dir = "lib/rs_floating_duration"
|
13
|
+
ext.cross_compile = true
|
14
|
+
ext.cross_platform = [
|
15
|
+
"aarch64-linux",
|
16
|
+
"x86_64-linux",
|
17
|
+
"arm64-darwin"
|
18
|
+
]
|
13
19
|
end
|
14
20
|
|
15
21
|
task default: :compile
|
@@ -27,3 +33,10 @@ task examples: :build do
|
|
27
33
|
puts "(#{number}s) => (short) #{RsFloatingDuration.time_format(number)} (long) #{RsFloatingDuration.time_format_long(number)}"
|
28
34
|
end
|
29
35
|
end
|
36
|
+
|
37
|
+
task :gem_filename do
|
38
|
+
platform = Gem::Platform.new(RUBY_PLATFORM).to_s
|
39
|
+
latest_gem = Dir.glob("pkg/rs_floating_duration-*-#{platform}.gem").sort.last
|
40
|
+
raise "Couldn't find a gem for platform: #{platform}!" if latest_gem.nil?
|
41
|
+
puts "GEM_FILENAME=#{File.basename(latest_gem)}"
|
42
|
+
end
|
data/lib/rs_floating_duration.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "rs_floating_duration/version"
|
4
|
-
|
4
|
+
begin
|
5
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
6
|
+
require_relative "#{$1}/rs_floating_duration/rs_floating_duration"
|
7
|
+
rescue LoadError
|
8
|
+
require "rs_floating_duration/rs_floating_duration"
|
9
|
+
end
|
5
10
|
|
6
11
|
module RsFloatingDuration
|
7
12
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rs_floating_duration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Roe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The floating_duration crate can format time durations as strings
|
14
14
|
email:
|
@@ -28,10 +28,7 @@ files:
|
|
28
28
|
- ext/rs_floating_duration/extconf.rb
|
29
29
|
- ext/rs_floating_duration/src/lib.rs
|
30
30
|
- lib/rs_floating_duration.rb
|
31
|
-
- lib/rs_floating_duration/rs_floating_duration.bundle
|
32
|
-
- lib/rs_floating_duration/rs_floating_duration.so
|
33
31
|
- lib/rs_floating_duration/version.rb
|
34
|
-
- rs_floating_duration.gemspec
|
35
32
|
- sig/rs_floating_duration.rbs
|
36
33
|
homepage: https://github.com/wjlroe/rs_floating_duration
|
37
34
|
licenses:
|
@@ -39,7 +36,7 @@ licenses:
|
|
39
36
|
metadata:
|
40
37
|
allowed_push_host: https://rubygems.org
|
41
38
|
homepage_uri: https://github.com/wjlroe/rs_floating_duration
|
42
|
-
post_install_message:
|
39
|
+
post_install_message:
|
43
40
|
rdoc_options: []
|
44
41
|
require_paths:
|
45
42
|
- lib
|
@@ -54,8 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
51
|
- !ruby/object:Gem::Version
|
55
52
|
version: 3.3.11
|
56
53
|
requirements: []
|
57
|
-
rubygems_version: 3.5.
|
58
|
-
signing_key:
|
54
|
+
rubygems_version: 3.5.9
|
55
|
+
signing_key:
|
59
56
|
specification_version: 4
|
60
57
|
summary: A wrapper around Rust's floating_duration crate
|
61
58
|
test_files: []
|
Binary file
|
Binary file
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/rs_floating_duration/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "rs_floating_duration"
|
7
|
-
spec.version = RsFloatingDuration::VERSION
|
8
|
-
spec.authors = ["William Roe"]
|
9
|
-
spec.email = ["rubygems@wjlr.org.uk"]
|
10
|
-
spec.licenses = ["MIT"]
|
11
|
-
|
12
|
-
spec.summary = "A wrapper around Rust's floating_duration crate"
|
13
|
-
spec.description = "The floating_duration crate can format time durations as strings"
|
14
|
-
spec.homepage = "https://github.com/wjlroe/rs_floating_duration"
|
15
|
-
spec.required_ruby_version = ">= 2.6.0"
|
16
|
-
spec.required_rubygems_version = ">= 3.3.11"
|
17
|
-
|
18
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
|
-
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
|
22
|
-
# Specify which files should be added to the gem when it is released.
|
23
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
-
spec.files = Dir.chdir(__dir__) do
|
25
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
-
(File.expand_path(f) == __FILE__) ||
|
27
|
-
f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile .github])
|
28
|
-
end + Dir.glob("lib/**/*.{so,bundle}")
|
29
|
-
end
|
30
|
-
spec.bindir = "exe"
|
31
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = ["lib"]
|
33
|
-
spec.extensions = ["ext/rs_floating_duration/Cargo.toml"]
|
34
|
-
|
35
|
-
# Uncomment to register a new dependency of your gem
|
36
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
37
|
-
|
38
|
-
# For more information and examples about making a new gem, check out our
|
39
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
40
|
-
end
|