rs_floating_duration 0.1.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f6d39c0feafcc5ac5e12f2e35b67253620ecf5452aab6cd30d7514685d485fe
4
- data.tar.gz: 99bbd3db95336bbc9abc6c840a9521e384dc5a4a0b88282b8a39868fe4ca29a7
3
+ metadata.gz: c9be6ac88f81a3a53fc246561480526d4b5dfab8b40e3a169f30e66ff6ec6c35
4
+ data.tar.gz: 0b6153bb65573860f9a6a56f88cd63b48bec4983b51b3723c7004bf0d1a9b1e3
5
5
  SHA512:
6
- metadata.gz: 24f00116ecf34804c9a689a93c4490a591c0d8c8286665b5051d3c1727f4dfb4d2bc79dd82c30cef44b17031d39cb442b0e5fcc149dce8328d39f796f123bf7f
7
- data.tar.gz: 7314ea6b026dc473a8a55a5b7fefc15c071468fb0cd4d3b7b4b3a28af0ac46a31b7fa34b8de20a4af300adaaca4422570011559a08d1dacd311dce7f14cb5f99
6
+ metadata.gz: 18c1851fd707014e3ffd1e8ea107c39231f510025277bd740299ee346381e659941dbb80718655dd37d978dff52fb2e62c51149cf225c4fcf8730df34e015752
7
+ data.tar.gz: 4f50851940b3abe4f4d4ef9b9c4473ad0f0e1ee2eda53859bee467251acb237aa9577a99726574ce24cc2eda3a7d6095ce7d035c6d5ed83f72e63d608dc83461
data/CHANGELOG.md CHANGED
@@ -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 CHANGED
@@ -1,31 +1,44 @@
1
1
  # RsFloatingDuration
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ This is a simple Ruby gem that wraps the Rust Crate called
4
+ [floating_duration](https://github.com/torkleyy/floating-duration).
4
5
 
5
- 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/rs_floating_duration`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+ The primary purpose of this gem is as a minimal example of how to wrap a native
7
+ library in a ruby gem.
6
8
 
7
9
  ## Installation
8
10
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
11
  Install the gem and add to the application's Gemfile by executing:
12
12
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
13
+ $ bundle add rs_floating_duration
14
14
 
15
15
  If bundler is not being used to manage dependencies, install the gem by executing:
16
16
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
17
+ $ gem install rs_floating_duration
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Here's an example irb session illustrating how to use this gem:
22
22
 
23
- ## Development
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
+ ```
24
31
 
25
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+ ## Development
26
33
 
27
- 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).
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.
28
37
 
29
- ## Contributing
38
+ You will need rust installed to compile the extension.
30
39
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/wjlroe/rs_floating_duration.
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RsFloatingDuration
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "rs_floating_duration/version"
4
- require_relative "rs_floating_duration/rs_floating_duration"
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.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Roe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-17 00:00:00.000000000 Z
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:
@@ -54,7 +51,7 @@ 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.3
54
+ rubygems_version: 3.5.9
58
55
  signing_key:
59
56
  specification_version: 4
60
57
  summary: A wrapper around Rust's floating_duration crate
@@ -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