Allow Ruby upgrades to not impact the gdk command line tool
Overview
I'd really like to remove the gitlab-development-kit gem, for the following reasons:
- Every time a Ruby update occurs, the
gdktool ceases to work. - Users very rarely
gem update gitlab-development-kitso it's really hard to get needed updates onto user's systems. - The main logic within the gem is tasked with the following and can easily be moved into the
lib/gdk.rbor such:- Initialising a new GDK instance - I'd like to eventually/shortly replace with a good old
git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git - Trusting the new install - I feel we can gain 'trust' by inspecting the current working directory and looking for the
.gdk-install-rootrather than having to maintain another file, outside of theGDK.root - Remembering that an install took place - This logic can easily be moved into
gdk install.
- Initialising a new GDK instance - I'd like to eventually/shortly replace with a good old
Proposal
Instead of gdk being a Ruby shim, we should make it a Shell script, that lives within /usr/local/bin that is installed/kept up-to-date via a gdk install/update and mostly serves to forward execution over to the GDK in the current working directory.
We'd need to be careful of the situation where most users will then have /usr/local/bin/gdk and a gdk Ruby shim. We should handle this as part of the management of /usr/local/bin/gdk to ask the user to uninstall the gitlab-development-kit Ruby gem.
Once the use of /usr/local/bin/gdk is widely rolled out, we should publish a final gitlab-development-kit Ruby gem that advises the gem is no longer required and change it's logic to simply exec('/usr/local/bin/gdk').
#!/bin/sh
if [ -f ./lib/gdk.rb ]; then
/usr/bin/env ruby ./lib/gdk.rb $*
else
echo "ERROR: The current working directory is not inside a gitlab-development-kit installation" >&2
exit 1
fi