Skip to content

Commit

Permalink
Check whether inside git repository then display warning
Browse files Browse the repository at this point in the history
  • Loading branch information
makenowjust committed Dec 15, 2016
1 parent a8fbc2d commit 68d011e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/compiler/crystal/tools/doc/generator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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?

Expand Down

0 comments on commit 68d011e

Please sign in to comment.