Class: RubyLens::Index::GitPackageSource::NixStoreProvider
- Inherits:
-
Object
- Object
- RubyLens::Index::GitPackageSource::NixStoreProvider
- Defined in:
- lib/rubylens/index/git_package_source.rb
Overview
Nix stores gems in immutable, content-addressed store objects, so a checkout symlinked into one is trustworthy even though it resolves outside the bundle directory.
Constant Summary collapse
- STORE_ROOT =
Pathname("/nix/store").freeze
- STORE_OBJECT_PATTERN =
/\A[0123456789abcdfghijklmnpqrsvwxyz]{32}-.+\z/
Instance Method Summary collapse
-
#trusted?(path) ⇒ Boolean
: (Pathname | String) -> bool.
Instance Method Details
#trusted?(path) ⇒ Boolean
: (Pathname | String) -> bool
41 42 43 44 45 46 47 48 49 |
# File 'lib/rubylens/index/git_package_source.rb', line 41 def trusted?(path) path = Pathname(path). return false unless Paths.inside?(path, STORE_ROOT) first_component = path.relative_path_from(STORE_ROOT).each_filename.first return false unless first_component STORE_OBJECT_PATTERN.match?(first_component) end |