Class: Omgcnb::BuildpacksFromDir

Inherits:
Object
  • Object
show all
Defined in:
lib/omgcnb.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir:, exclude: []) ⇒ BuildpacksFromDir

Returns a new instance of BuildpacksFromDir.



13
14
15
16
# File 'lib/omgcnb.rb', line 13

def initialize(dir: , exclude: [])
  @dir = dir
  @exclude = exclude
end

Instance Method Details

#buildpacksObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/omgcnb.rb', line 18

def buildpacks
  @buildpacks ||= ScanBuildpackToml.new(dir: @dir, exclude: @exclude).call.files.map do |file|
    changelog = file.parent.join("CHANGELOG.md")

    raise "Expected #{changelog} to exist but it does not" unless changelog.exist?
    BitOfBuildpack.new(
      toml_contents: file.read,
      changelog_contents: changelog.read
    )
  end
end