Module: Cask::Metadata Private
- Included in:
- Cask
- Defined in:
- cask/metadata.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper module for reading and writing cask metadata.
Constant Summary collapse
- METADATA_SUBDIR =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
".metadata"
- TIMESTAMP_FORMAT =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
"%Y%m%d%H%M%S.%L"
Instance Method Summary collapse
-
#metadata_main_container_path(caskroom_path: self.caskroom_path) ⇒ Object
private
-
#metadata_subdir(leaf, version: self.version, timestamp: :latest, create: false, caskroom_path: self.caskroom_path) ⇒ Object
private
-
#metadata_timestamped_path(version: self.version, timestamp: :latest, create: false, caskroom_path: self.caskroom_path) ⇒ Object
private
-
#metadata_versioned_path(version: self.version, caskroom_path: self.caskroom_path) ⇒ Object
private
Instance Method Details
#metadata_main_container_path(caskroom_path: self.caskroom_path) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
12 13 14 |
# File 'cask/metadata.rb', line 12 def (caskroom_path: self.caskroom_path) caskroom_path.join(METADATA_SUBDIR) end |
#metadata_subdir(leaf, version: self.version, timestamp: :latest, create: false, caskroom_path: self.caskroom_path) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'cask/metadata.rb', line 43 def (leaf, version: self.version, timestamp: :latest, create: false, caskroom_path: self.caskroom_path) raise CaskError, "Cannot create metadata subdir when timestamp is :latest." if create && == :latest raise CaskError, "Cannot create metadata subdir for empty leaf." if !leaf.respond_to?(:empty?) || leaf.empty? parent = (version: version, timestamp: , create: create, caskroom_path: caskroom_path) return if parent.nil? subdir = parent.join(leaf) if create && !subdir.directory? odebug "Creating metadata subdirectory: #{subdir}" subdir.mkpath end subdir end |
#metadata_timestamped_path(version: self.version, timestamp: :latest, create: false, caskroom_path: self.caskroom_path) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'cask/metadata.rb', line 24 def (version: self.version, timestamp: :latest, create: false, caskroom_path: self.caskroom_path) raise CaskError, "Cannot create metadata path when timestamp is :latest." if create && == :latest path = if == :latest Pathname.glob((version: version, caskroom_path: caskroom_path).join("*")).max else = if == :now (version: version, caskroom_path: caskroom_path).join() end if create && !path.directory? odebug "Creating metadata directory: #{path}" path.mkpath end path end |
#metadata_versioned_path(version: self.version, caskroom_path: self.caskroom_path) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
16 17 18 19 20 21 22 |
# File 'cask/metadata.rb', line 16 def (version: self.version, caskroom_path: self.caskroom_path) cask_version = (version || :unknown).to_s raise CaskError, "Cannot create metadata path with empty version." if cask_version.empty? (caskroom_path: caskroom_path).join(cask_version) end |