rb_sys 0.9.96 → 0.9.97

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3275545b3a80cee96756629512637f75ec7282bd1b420fe051be2ba97196e119
4
- data.tar.gz: fd350de2bcbddec4425eaf424928fdb9df3cc743f8a1d1e1786c698b7402987b
3
+ metadata.gz: ab6cc75cd0019c1ef5776fce1f1356f89402d1121ecf249d7be13611bd48f2c1
4
+ data.tar.gz: fdb898fe8c841369fe4d028fb560c528c21c340aff5acaf174d9900b2f22f187
5
5
  SHA512:
6
- metadata.gz: 8e86c79218d9b9adad76c2ce893d688562c4a224121dfb758d7a5dbd762761057816cb895793b7be6a1d2ccb30aaa7ff935411f5fe85e6cb9e418d09919edbbd
7
- data.tar.gz: ced60783c5403e69839607083ccf4042554e419f40b18c7d70d2ec91c623145f783a0c87d66ca2dfe8360ef70b959f6d72f8bfe494db75518de218ceb60d53ed
6
+ metadata.gz: 98635ea2f6c932672ada8830c5cfebda6c4ee8c401b7caa2479bc958f3aed2b329c75c063937eebdc23e1478828a4bdcc5f5f98aae7a7dec5ac151b034d53f5d
7
+ data.tar.gz: eccaf0a36185ba534a16500a1e75149ff77ee2819381c3754e0c816caeb4c02f41f6c0d073a6a3da7e2a0c4c70e400e08c6452a66a4944938e0204793b5a48a2
checksums.yaml.gz.sig CHANGED
Binary file
data/exe/rb-sys-dock CHANGED
@@ -18,7 +18,13 @@ OPTIONS = {
18
18
  }
19
19
 
20
20
  def cargo_metadata
21
- @cargo_metadata ||= RbSys::Cargo::Metadata.new("rb-sys-dock", deps: true)
21
+ return @cargo_metadata if defined?(@cargo_metadata)
22
+
23
+ @cargo_metadata = begin
24
+ RbSys::Cargo::Metadata.inferred(deps: true)
25
+ rescue
26
+ nil
27
+ end
22
28
  end
23
29
 
24
30
  def logger
@@ -172,9 +178,9 @@ end
172
178
 
173
179
  def determine_cache_dir
174
180
  return ENV["RB_SYS_DOCK_CACHE_DIR"] if ENV["RB_SYS_DOCK_CACHE_DIR"]
175
- return File.join(ENV["XDG_CACHE_HOME"], "rb-sys-dock") if ENV["XDG_CACHE_HOME"]
181
+ return File.join(ENV["XDG_CACHE_HOME"], "rb-sys") if ENV["XDG_CACHE_HOME"]
176
182
 
177
- File.join(ENV["HOME"], ".cache", "rb-sys-dock")
183
+ File.join(ENV["HOME"], ".cache", "rb-sys")
178
184
  end
179
185
 
180
186
  def docker_tmp
@@ -421,7 +427,7 @@ def set_env
421
427
  end
422
428
 
423
429
  def lint_rb_sys
424
- cargo_version = cargo_metadata.rb_sys_version
430
+ cargo_version = cargo_metadata&.rb_sys_version || RbSys::VERSION
425
431
  return if cargo_version == RbSys::VERSION
426
432
  logger.warn("Cargo rb-sys version (#{cargo_version}) does not match Ruby gem version (#{RbSys::VERSION})")
427
433
  rescue => e
@@ -9,6 +9,26 @@ module RbSys
9
9
  class Metadata
10
10
  attr_reader :name
11
11
 
12
+ class << self
13
+ # Infers the Cargo project's name from the Cargo.toml file.
14
+ #
15
+ # @return [RbSys::Cargo::Metadata]
16
+ def inferred(deps: false)
17
+ new(File.read("Cargo.toml").match(/^name = "(.*)"/)[1], deps: deps)
18
+ rescue
19
+ new(File.basename(Dir.pwd), deps: deps)
20
+ end
21
+
22
+ # Initializes a new Cargo::Metadata instance or infers the Cargo project's name.
23
+ #
24
+ # @param name [String] the name of the Cargo project
25
+ def new_or_inferred(name, deps: false)
26
+ new(name, deps: deps).load!
27
+ rescue CargoMetadataError
28
+ inferred
29
+ end
30
+ end
31
+
12
32
  # Initializes a new Cargo::Metadata instance.
13
33
  #
14
34
  # @param name [String] the name of the Cargo project
@@ -92,12 +112,22 @@ module RbSys
92
112
  end
93
113
 
94
114
  # Returns the rb-sys version, if any.
115
+ #
116
+ # @return [String]
95
117
  def rb_sys_version
96
118
  pkg = packages.find { |p| p.fetch("name") == "rb-sys" }
97
119
  return unless pkg
98
120
  pkg["version"]
99
121
  end
100
122
 
123
+ # Eagerly run `cargo metadata`, raising a RbSys::CargoCargoMetadataError` if it fails.
124
+ #
125
+ # @return [RbSys::Cargo::Metadata]
126
+ def load!
127
+ cargo_metadata
128
+ self
129
+ end
130
+
101
131
  private
102
132
 
103
133
  def package_metadata
@@ -57,7 +57,7 @@ module RbSys
57
57
  end
58
58
 
59
59
  def cargo_metadata
60
- @cargo_metadata ||= Cargo::Metadata.new(@name)
60
+ @cargo_metadata ||= Cargo::Metadata.new_or_inferred(@name)
61
61
  end
62
62
 
63
63
  def extconf
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbSys
4
- VERSION = "0.9.96"
4
+ VERSION = "0.9.97"
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb_sys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.96
4
+ version: 0.9.97
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
@@ -29,7 +29,7 @@ cert_chain:
29
29
  Lvd35BNvZkhFzs9xfykhurpkT2TiP2F3ZFn9dwLXMFe41pwrtEYLIWhYi8mUG4Ek
30
30
  6aR8M/tqIpChVV39
31
31
  -----END CERTIFICATE-----
32
- date: 2024-04-18 00:00:00.000000000 Z
32
+ date: 2024-04-20 00:00:00.000000000 Z
33
33
  dependencies: []
34
34
  description:
35
35
  email:
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - ">="
76
76
  - !ruby/object:Gem::Version
77
- version: 2.3.0
77
+ version: 2.5.0
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
metadata.gz.sig CHANGED
Binary file