Class: Pray::Lockfile
- Inherits:
-
Struct
- Object
- Struct
- Pray::Lockfile
- Defined in:
- lib/pray/lockfile.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#generated_by ⇒ Object
Returns the value of attribute generated_by.
-
#managed_span ⇒ Object
Returns the value of attribute managed_span.
-
#manifest_hash ⇒ Object
Returns the value of attribute manifest_hash.
-
#package ⇒ Object
Returns the value of attribute package.
-
#prayfile_lock ⇒ Object
Returns the value of attribute prayfile_lock.
-
#source ⇒ Object
Returns the value of attribute source.
-
#spec ⇒ Object
Returns the value of attribute spec.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #canonicalized ⇒ Object
- #equivalent_to?(other) ⇒ Boolean
- #file_hash ⇒ Object
-
#initialize(prayfile_lock: "1", spec: "0.1", generated_by: Pray::GENERATED_BY, manifest_hash: "", environment: nil, source: [], package: [], target: [], managed_span: []) ⇒ Lockfile
constructor
A new instance of Lockfile.
- #serialized ⇒ Object
Constructor Details
#initialize(prayfile_lock: "1", spec: "0.1", generated_by: Pray::GENERATED_BY, manifest_hash: "", environment: nil, source: [], package: [], target: [], managed_span: []) ⇒ Lockfile
Returns a new instance of Lockfile.
28 29 30 31 32 33 |
# File 'lib/pray/lockfile.rb', line 28 def initialize( prayfile_lock: "1", spec: "0.1", generated_by: Pray::GENERATED_BY, manifest_hash: "", environment: nil, source: [], package: [], target: [], managed_span: [] ) super end |
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def environment @environment end |
#generated_by ⇒ Object
Returns the value of attribute generated_by
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def generated_by @generated_by end |
#managed_span ⇒ Object
Returns the value of attribute managed_span
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def managed_span @managed_span end |
#manifest_hash ⇒ Object
Returns the value of attribute manifest_hash
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def manifest_hash @manifest_hash end |
#package ⇒ Object
Returns the value of attribute package
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def package @package end |
#prayfile_lock ⇒ Object
Returns the value of attribute prayfile_lock
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def prayfile_lock @prayfile_lock end |
#source ⇒ Object
Returns the value of attribute source
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def source @source end |
#spec ⇒ Object
Returns the value of attribute spec
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def spec @spec end |
#target ⇒ Object
Returns the value of attribute target
24 25 26 |
# File 'lib/pray/lockfile.rb', line 24 def target @target end |
Instance Method Details
#canonicalized ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/pray/lockfile.rb', line 35 def canonicalized dup.tap do |copy| copy.source = source.sort_by(&:name) copy.package = package.sort_by { |entry| [entry.name, entry.source.to_s, entry.version] } copy.target = target.sort_by(&:name) copy.managed_span = managed_span.sort_by { |span| [span.target, span.open_line, span.id] } end end |
#equivalent_to?(other) ⇒ Boolean
52 53 54 |
# File 'lib/pray/lockfile.rb', line 52 def equivalent_to?(other) canonicalized == other.canonicalized end |
#file_hash ⇒ Object
48 49 50 |
# File 'lib/pray/lockfile.rb', line 48 def file_hash Hashing.sha256_prefixed(serialized) end |
#serialized ⇒ Object
44 45 46 |
# File 'lib/pray/lockfile.rb', line 44 def serialized LockfileIO.lockfile_to_toml(canonicalized) end |