From 7823fb7ea72ecbc00c02e9e8e17fd2bff880c9a0 Mon Sep 17 00:00:00 2001 From: punkymaniac Date: Wed, 24 Feb 2021 19:52:01 +0100 Subject: [PATCH] Add clean exit if no git user configuration is set If the 'user.name' and 'user.email' are not configured, the commit of the generated documentation fail. In this case, the options ['author'] and ['committer'] argument of the Rugged::Commit.create(..), contain a nil content but a string was expected. --- lib/docurium.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/docurium.rb b/lib/docurium.rb index 0bf86a2a3..69bd961fa 100644 --- a/lib/docurium.rb +++ b/lib/docurium.rb @@ -162,6 +162,11 @@ def generate_docs versions = vers end + if (@repo.config['user.name'].nil? || @repo.config['user.email'].nil?) + puts "ERROR: 'user.name' or 'user.email' is not configured. Docurium will not be able to commit the documentation" + exit(false) + end + process_project(versions) do |i, version, result| data, examples = result sha = @repo.write(data.to_json, :blob)