From 52aef98bd24df7e9850f5bdd48f03e3a5c02619c Mon Sep 17 00:00:00 2001
From: Jacob Vosmaer <jacob@gitlab.com>
Date: Wed, 2 Nov 2016 15:53:58 +0100
Subject: [PATCH 1/2] Improve "GDK_ROOT not found" message

---
 gem/bin/gdk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gem/bin/gdk b/gem/bin/gdk
index e12786e..a84c067 100755
--- a/gem/bin/gdk
+++ b/gem/bin/gdk
@@ -37,7 +37,13 @@ module GDK
     else
       $gdk_root = find_root(Dir.pwd)
       if $gdk_root.nil?
-        puts "Could not find GDK_ROOT in the current directory or any of its parents."
+        puts <<-EOS.gsub(/^\s+\|/, '')
+          |
+          |The current working directory is not inside a gitlab-development-kit
+          |installation. Use 'cd' to go to your gitlab-development-kit or create
+          |a new one with 'gdk init'.
+          |
+        EOS
         return false
       end
       puts "(in #{$gdk_root})"
-- 
GitLab


From 495ff8153fd1f391fac255b6756e0a6c96ad8034 Mon Sep 17 00:00:00 2001
From: Jacob Vosmaer <jacob@gitlab.com>
Date: Fri, 4 Nov 2016 16:43:24 +0100
Subject: [PATCH 2/2] Show usage for gdk init when root not found

---
 gem/bin/gdk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gem/bin/gdk b/gem/bin/gdk
index a84c067..176bf63 100755
--- a/gem/bin/gdk
+++ b/gem/bin/gdk
@@ -14,6 +14,7 @@ module GDK
   DOTFILE = File.expand_path('~/.gdk.yml')
   TRUSTED_KEY = 'trusted_directories'
   ROOT_CHECK_FILE = '.gdk-install-root'
+  DEFAULT_INIT_DIRECTORY = File.join(Dir.pwd, 'gitlab-development-kit')
 
   def self.launcher_main
     case ARGV.first
@@ -25,7 +26,7 @@ module GDK
         puts "Usage: gdk init [DIR]"
         return false
       end
-      directory = ARGV.count == 2 ? ARGV[1] : 'gitlab-development-kit' 
+      directory = ARGV.count == 2 ? ARGV[1] : DEFAULT_INIT_DIRECTORY
       cmd = %W(git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git #{directory})
       system(*cmd) && trust!(directory) && remember!(directory)
     when 'trust'
@@ -43,6 +44,8 @@ module GDK
           |installation. Use 'cd' to go to your gitlab-development-kit or create
           |a new one with 'gdk init'.
           |
+          |gdk init [DIRECTORY] # Default: #{DEFAULT_INIT_DIRECTORY}
+          |
         EOS
         return false
       end
-- 
GitLab