module GitCompound::Command::Procedure::Element::Manifest

Manifest mixin

Public Class Methods

included(parent_class) click to toggle source
# File lib/git_compound/command/procedure/element/manifest.rb, line 13
def self.included(parent_class)
  parent_class.class_eval do
    include Element::Option
    add_argument :manifest, type: :string, scope: :global
  end
end
new(opts) click to toggle source
# File lib/git_compound/command/procedure/element/manifest.rb, line 8
def initialize(opts)
  super
  @manifest = manifest_load(opts[:manifest])
end

Private Instance Methods

manifest_load(filename) click to toggle source
# File lib/git_compound/command/procedure/element/manifest.rb, line 22
def manifest_load(filename)
  files = filename ? [filename] : GitCompound::Manifest::FILENAMES
  found = files.select { |file| File.exist?(file) }

  raise GitCompoundError,
        "Manifest `#{filename || files.inspect}` not found !" if found.empty?

  contents = File.read(found.first)
  GitCompound::Manifest.new(contents)
end