class Packwerk::Configuration

Constants

DEFAULT_CONFIG_PATH
DEFAULT_EXCLUDE_GLOBS
DEFAULT_INCLUDE_GLOBS

Attributes

config_path[R]
custom_associations[R]
exclude[R]
include[R]
inflections_file[R]
load_paths[R]
package_paths[R]
root_path[R]

Public Class Methods

from_path(path = Dir.pwd) click to toggle source
# File lib/packwerk/configuration.rb, line 10
def from_path(path = Dir.pwd)
  raise ArgumentError, "#{File.expand_path(path)} does not exist" unless File.exist?(path)

  default_packwerk_path = File.join(path, DEFAULT_CONFIG_PATH)

  if File.file?(default_packwerk_path)
    from_packwerk_config(default_packwerk_path)
  else
    new
  end
end

Private Class Methods

from_packwerk_config(path) click to toggle source
# File lib/packwerk/configuration.rb, line 24
def from_packwerk_config(path)
  new(
    YAML.load_file(path) || {},
    config_path: path
  )
end