Class: Packs::Configuration

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/packs/configuration.rb

Constant Summary collapse

CONFIGURATION_PATHNAME =
T.let(Pathname.new('packs.yml'), Pathname)
DEFAULT_README_TEMPLATE_PATHNAME =
T.let(Pathname.new('README_TEMPLATE.md'), Pathname)
OnPackageTodoLintFailure =
T.type_alias do
  T.proc.params(output: String).void
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



30
31
32
33
34
35
# File 'lib/packs/configuration.rb', line 30

def initialize
  @enforce_dependencies = T.let(default_enforce_dependencies, T::Boolean)
  @user_event_logger = T.let(DefaultUserEventLogger.new, UserEventLogger)
  @on_package_todo_lint_failure = T.let(->(output) {}, OnPackageTodoLintFailure)
  @use_pks = T.let(false, T::Boolean)
end

Instance Attribute Details

#enforce_dependenciesObject



38
39
40
# File 'lib/packs/configuration.rb', line 38

def enforce_dependencies
  @enforce_dependencies
end

#on_package_todo_lint_failureObject

Returns the value of attribute on_package_todo_lint_failure.



27
28
29
# File 'lib/packs/configuration.rb', line 27

def on_package_todo_lint_failure
  @on_package_todo_lint_failure
end

#use_pksObject

Returns the value of attribute use_pks.



20
21
22
# File 'lib/packs/configuration.rb', line 20

def use_pks
  @use_pks
end

#user_event_loggerObject

Returns the value of attribute user_event_logger.



17
18
19
# File 'lib/packs/configuration.rb', line 17

def user_event_logger
  @user_event_logger
end

Instance Method Details

#bust_cache!Object



43
44
45
# File 'lib/packs/configuration.rb', line 43

def bust_cache!
  @enforce_dependencies = default_enforce_dependencies
end

#default_enforce_dependenciesObject



48
49
50
# File 'lib/packs/configuration.rb', line 48

def default_enforce_dependencies
  true
end

#readme_template_pathnameObject



53
54
55
56
57
58
59
60
61
62
# File 'lib/packs/configuration.rb', line 53

def readme_template_pathname
  config_hash = CONFIGURATION_PATHNAME.exist? ? YAML.load_file(CONFIGURATION_PATHNAME) : {}

  specified_readme_template_path = config_hash['readme_template_path']
  if specified_readme_template_path.nil?
    DEFAULT_README_TEMPLATE_PATHNAME
  else
    Pathname.new(specified_readme_template_path)
  end
end