Method: PDK::Module::Release#initialize

Defined in:
lib/pdk/module/release.rb

#initialize(module_path, options = {}) ⇒ Release

Returns a new instance of Release.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pdk/module/release.rb', line 13

def initialize(module_path, options = {})
  @options = options

  # TODO: Currently the release process can ONLY be run if the working directory IS the module root. However, in the future
  # this WILL change, so we have the API arguments for it, but only accept `nil` for the first parameter
  raise PDK::CLI::ExitWithError, 'Running the release process outside of the working directory is not supported' unless module_path.nil?

  if module_path.nil?
    module_path = PDK::Util.module_root
    raise PDK::CLI::ExitWithError, 'The module release process requires a valid module path' if module_path.nil?
  end
  raise PDK::CLI::ExitWithError, format('%{module_path} is not a valid module', module_path: module_path) unless PDK::Util.in_module_root?(module_path)

  @module_path = module_path
end