Class: Mudguard::Infrastructure::Persistence::PolicyFile

Inherits:
Object
  • Object
show all
Defined in:
lib/mudguard/infrastructure/persistence/policy_file.rb

Overview

A file containing the Mudguard-Policies

Class Method Summary collapse

Class Method Details

.read(project_path) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mudguard/infrastructure/persistence/policy_file.rb', line 13

def read(project_path)
  policy_file = File.join(project_path, ".mudguard.yml")
  policy_exists = File.exist?(policy_file)

  unless policy_exists
    template_file = File.join(__dir__, ".mudguard.template.yml")
    FileUtils.cp(template_file, policy_file)
  end

  read_yml(policy_file)
end