Class: Pray::Manifest
- Inherits:
-
Struct
- Object
- Struct
- Pray::Manifest
- Defined in:
- lib/pray/manifest.rb
Instance Attribute Summary collapse
-
#deprecated_keywords ⇒ Object
Returns the value of attribute deprecated_keywords.
-
#local ⇒ Object
Returns the value of attribute local.
-
#packages ⇒ Object
Returns the value of attribute packages.
-
#prayfile_version ⇒ Object
Returns the value of attribute prayfile_version.
-
#render ⇒ Object
Returns the value of attribute render.
-
#sources ⇒ Object
Returns the value of attribute sources.
-
#symbols ⇒ Object
Returns the value of attribute symbols.
-
#targets ⇒ Object
Returns the value of attribute targets.
Instance Method Summary collapse
- #canonicalized ⇒ Object
- #deprecation_warnings ⇒ Object
-
#initialize(prayfile_version: "", sources: [], targets: [], packages: [], local: [], symbols: {}, render: RenderPolicy.default, deprecated_keywords: []) ⇒ Manifest
constructor
A new instance of Manifest.
- #manifest_hash ⇒ Object
- #note_deprecated_keyword(keyword) ⇒ Object
Constructor Details
#initialize(prayfile_version: "", sources: [], targets: [], packages: [], local: [], symbols: {}, render: RenderPolicy.default, deprecated_keywords: []) ⇒ Manifest
Returns a new instance of Manifest.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/pray/manifest.rb', line 61 def initialize( prayfile_version: "", sources: [], targets: [], packages: [], local: [], symbols: {}, render: RenderPolicy.default, deprecated_keywords: [] ) super end |
Instance Attribute Details
#deprecated_keywords ⇒ Object
Returns the value of attribute deprecated_keywords
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def deprecated_keywords @deprecated_keywords end |
#local ⇒ Object
Returns the value of attribute local
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def local @local end |
#packages ⇒ Object
Returns the value of attribute packages
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def packages @packages end |
#prayfile_version ⇒ Object
Returns the value of attribute prayfile_version
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def prayfile_version @prayfile_version end |
#render ⇒ Object
Returns the value of attribute render
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def render @render end |
#sources ⇒ Object
Returns the value of attribute sources
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def sources @sources end |
#symbols ⇒ Object
Returns the value of attribute symbols
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def symbols @symbols end |
#targets ⇒ Object
Returns the value of attribute targets
56 57 58 |
# File 'lib/pray/manifest.rb', line 56 def targets @targets end |
Instance Method Details
#canonicalized ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'lib/pray/manifest.rb', line 94 def canonicalized dup.tap do |copy| copy.sources = sources.sort_by(&:name) copy.targets = targets.sort_by(&:name) copy.packages = packages.sort_by { |package| [package.name, package.source.to_s, package.constraint] } copy.local = local.sort_by(&:path) copy.deprecated_keywords = [] end end |
#deprecation_warnings ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/pray/manifest.rb', line 80 def deprecation_warnings replacements = { "target" => "compose` / `tree", "output" => "compose", "agent" => "pray" } (deprecated_keywords || []).filter_map do |keyword| replacement = replacements[keyword] next unless replacement "warning: `#{keyword}` is deprecated and will be removed in version 2; prefer `#{replacement}`" end end |
#manifest_hash ⇒ Object
104 105 106 107 |
# File 'lib/pray/manifest.rb', line 104 def manifest_hash bytes = ManifestJson.encode_compact(canonicalized) Hashing.sha256_prefixed(bytes) end |
#note_deprecated_keyword(keyword) ⇒ Object
74 75 76 77 78 |
# File 'lib/pray/manifest.rb', line 74 def note_deprecated_keyword(keyword) return unless %w[target output agent].include?(keyword) self.deprecated_keywords ||= [] deprecated_keywords << keyword unless deprecated_keywords.include?(keyword) end |