Class: Tasks::Gitlab::AuditEventTypes::CompileDocsTask

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/gitlab/audit_event_types/compile_docs_task.rb

Instance Method Summary collapse

Constructor Details

#initialize(docs_dir, docs_path, template_erb_path) ⇒ CompileDocsTask

Returns a new instance of CompileDocsTask.



7
8
9
10
11
# File 'lib/tasks/gitlab/audit_event_types/compile_docs_task.rb', line 7

def initialize(docs_dir, docs_path, template_erb_path)
  @event_types_dir = docs_dir
  @audit_event_types_doc_file = docs_path
  @event_type_erb_template = ERB.new(File.read(template_erb_path), trim_mode: '<>')
end

Instance Method Details

#runObject



13
14
15
16
17
18
# File 'lib/tasks/gitlab/audit_event_types/compile_docs_task.rb', line 13

def run
  FileUtils.mkdir_p(@event_types_dir)
  File.write(@audit_event_types_doc_file, @event_type_erb_template.result)

  puts "Documentation compiled."
end