rs_floating_duration 0.1.2-arm64-darwin-23
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/.ruby-version +1 -0
- data/CHANGELOG.md +19 -0
- data/README.md +44 -0
- data/Rakefile +42 -0
- data/lib/rs_floating_duration/rs_floating_duration.bundle +0 -0
- data/lib/rs_floating_duration/version.rb +5 -0
- data/lib/rs_floating_duration.rb +14 -0
- data/rs_floating_duration.gemspec +34 -0
- data/sig/rs_floating_duration.rbs +4 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 74f2e9d3a786fd3937bcbf87c8271fe23f47bcc4cf6f9b6920eaac2d7a3560dd
|
4
|
+
data.tar.gz: a5a9f6cea8230931a24e911e8fe84fbcaaf1d0bdbcc1d4aec2b9865e80183bed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 35420fc02e6bcf46bee4f9ec3bdb26c21f04589af50e21f587552d3dee90d03af6de7c0d19d71febe72af882ba81741a47977de18bbfedac103dd641d32bf7e2
|
7
|
+
data.tar.gz: 2e5110d9385d758f6834509c0f69d9c993ef92ffab99ef6435f3c47802f96cc1c0101dd4a690336a13f87784c10e3f074e588779e774cf2d574c742d257eb6d6
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.3.0
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# 0.1.2 / 2024-07-19
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* Compile a linux-x86_64 native gem on github
|
6
|
+
* Remove the macOS build as github isn't running macos jobs right now
|
7
|
+
|
8
|
+
# 0.1.1 / 2024-02-17
|
9
|
+
|
10
|
+
## Enhancements
|
11
|
+
|
12
|
+
* Compile and bundle macos arm64 native library
|
13
|
+
|
14
|
+
# 0.1.0 / 2024-02-17
|
15
|
+
|
16
|
+
## Enhancements
|
17
|
+
|
18
|
+
* Initial release of the gem.
|
19
|
+
* Native libraries bundled for Linux x86_64, macOS x86_64
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# RsFloatingDuration
|
2
|
+
|
3
|
+
This is a simple Ruby gem that wraps the Rust Crate called [floating_duration]
|
4
|
+
(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.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
12
|
+
|
13
|
+
$ bundle add rs_floating_duration
|
14
|
+
|
15
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
+
|
17
|
+
$ gem install rs_floating_duration
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Here's an example irb session illustrating how to use this gem:
|
22
|
+
|
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
|
+
```
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
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.
|
37
|
+
|
38
|
+
You will need rust installed to compile the extension.
|
39
|
+
|
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 [rubygems.org]
|
44
|
+
(https://rubygems.org).
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rb_sys/extensiontask"
|
5
|
+
require "standard/rake"
|
6
|
+
|
7
|
+
task build: :compile
|
8
|
+
|
9
|
+
GEMSPEC = Gem::Specification.load("rs_floating_duration.gemspec")
|
10
|
+
|
11
|
+
RbSys::ExtensionTask.new("rs_floating_duration", GEMSPEC) do |ext|
|
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
|
+
]
|
19
|
+
end
|
20
|
+
|
21
|
+
task default: :compile
|
22
|
+
|
23
|
+
task examples: :build do
|
24
|
+
require "bundler/setup"
|
25
|
+
require "rs_floating_duration"
|
26
|
+
numbers = [
|
27
|
+
0.5,
|
28
|
+
0.001,
|
29
|
+
0.02,
|
30
|
+
10
|
31
|
+
]
|
32
|
+
numbers.each do |number|
|
33
|
+
puts "(#{number}s) => (short) #{RsFloatingDuration.time_format(number)} (long) #{RsFloatingDuration.time_format_long(number)}"
|
34
|
+
end
|
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
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "rs_floating_duration/version"
|
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
|
10
|
+
|
11
|
+
module RsFloatingDuration
|
12
|
+
class Error < StandardError; end
|
13
|
+
# Your code goes here...
|
14
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
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
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rs_floating_duration
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: arm64-darwin-23
|
6
|
+
authors:
|
7
|
+
- William Roe
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The floating_duration crate can format time durations as strings
|
14
|
+
email:
|
15
|
+
- rubygems@wjlr.org.uk
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".ruby-version"
|
21
|
+
- CHANGELOG.md
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- lib/rs_floating_duration.rb
|
25
|
+
- lib/rs_floating_duration/rs_floating_duration.bundle
|
26
|
+
- lib/rs_floating_duration/version.rb
|
27
|
+
- rs_floating_duration.gemspec
|
28
|
+
- sig/rs_floating_duration.rbs
|
29
|
+
homepage: https://github.com/wjlroe/rs_floating_duration
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata:
|
33
|
+
allowed_push_host: https://rubygems.org
|
34
|
+
homepage_uri: https://github.com/wjlroe/rs_floating_duration
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.3'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.4.dev
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 3.3.11
|
52
|
+
requirements: []
|
53
|
+
rubygems_version: 3.5.9
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: A wrapper around Rust's floating_duration crate
|
57
|
+
test_files: []
|