PubyConfig.fromProjectPath constructor

PubyConfig.fromProjectPath(
  1. String path
)

Create a puby config from a project path

Implementation

factory PubyConfig.fromProjectPath(String path) {
  final file = File(p.join(path, 'puby.yaml'));
  if (!file.existsSync()) {
    return PubyConfig.empty();
  }

  final yaml = loadYaml(file.readAsStringSync());
  final excludes = (yaml['exclude'] as List?)?.cast<String>() ?? [];

  return PubyConfig._(excludes: excludes);
}