From 1a3e687f772047988b9bcaeb471d94d6f49a853e Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 3 Oct 2019 12:26:20 +0100 Subject: Decouple bin/compile and bin/install from lib/ This commit duplicates a small amount of Ruby code that is run at build or install time. Over time, it would be nice to remove the dependency on Ruby for these steps, but the focus right now is on run-time. We'll be removing lib/* from gitlab-shell very soon, and these commands need to keep working when we do. --- support/gitlab_config.rb | 13 +++++++++++++ support/go_build.rb | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 support/gitlab_config.rb (limited to 'support') diff --git a/support/gitlab_config.rb b/support/gitlab_config.rb new file mode 100644 index 0000000..1416488 --- /dev/null +++ b/support/gitlab_config.rb @@ -0,0 +1,13 @@ +require 'yaml' + +class GitlabConfig + attr_reader :config + + def initialize + @config = YAML.load_file(File.join(ROOT_PATH, 'config.yml')) + end + + def auth_file + @config['auth_file'] ||= File.join(Dir.home, '.ssh/authorized_keys') + end +end diff --git a/support/go_build.rb b/support/go_build.rb index 42e207a..6f4c92b 100644 --- a/support/go_build.rb +++ b/support/go_build.rb @@ -2,8 +2,8 @@ require 'fileutils' -# This will set the ROOT_PATH variable -require_relative '../lib/gitlab_init' +# Determine the root of the gitlab-shell directory +ROOT_PATH = ENV.fetch('GITLAB_SHELL_DIR', File.expand_path('..', __dir__)) module GoBuild GO_DIR = File.join(ROOT_PATH, 'go') -- cgit v1.2.1