Class: Milestoner::Tags::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/milestoner/tags/manifest.rb

Overview

Manages build manifest.

Instance Method Summary collapse

Constructor Details

#initialize(name: "manifest.json") ⇒ Manifest

Returns a new instance of Manifest.



17
18
19
20
# File 'lib/milestoner/tags/manifest.rb', line 17

def initialize(name: "manifest.json", **)
  super(**)
  @name = name
end

Instance Method Details

#build_pathObject



22
# File 'lib/milestoner/tags/manifest.rb', line 22

def build_path = settings.build_output.join name

#diff(path = build_path) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/milestoner/tags/manifest.rb', line 24

def diff path = build_path
  git.tags.value_or(Core::EMPTY_ARRAY).then do |tags|
    return Core::EMPTY_HASH if tags.empty?

    content_for(tags).diff read(path)
  end
end

#read(path = build_path) ⇒ Object



32
# File 'lib/milestoner/tags/manifest.rb', line 32

def read(path = build_path) = JSON(path.read, {symbolize_names: true})

#write(path = build_path) ⇒ Object



34
35
36
# File 'lib/milestoner/tags/manifest.rb', line 34

def write(path = build_path, **)
  path.make_ancestors.write JSON.pretty_generate(generator.deep_merge(**))
end