From 68d011e541d4e24aeb4f0e80fb5b67ee5e6c8a70 Mon Sep 17 00:00:00 2001 From: TSUYUSATO Kitsune Date: Thu, 15 Dec 2016 17:32:31 +0900 Subject: [PATCH] Check whether inside git repository then display warning --- src/compiler/crystal/tools/doc/generator.cr | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/crystal/tools/doc/generator.cr b/src/compiler/crystal/tools/doc/generator.cr index bacaa69562a5..1c268580e765 100644 --- a/src/compiler/crystal/tools/doc/generator.cr +++ b/src/compiler/crystal/tools/doc/generator.cr @@ -20,6 +20,9 @@ class Crystal::Doc::Generator @types = {} of Crystal::Type => Doc::Type @repo_name = "" compute_repository + if @repo_name == "" + puts "WARNING there is not inside git repository. some features are not available." + end @is_crystal_repo = @repo_name == "github.com/crystal-lang/crystal" end @@ -278,6 +281,10 @@ class Crystal::Doc::Generator end def compute_repository + # check whether inside git work-tree + `git rev-parse --is-inside-work-tree >/dev/null 2>&1` + return unless $?.success? + remotes = `git remote -v` return unless $?.success?