Commit 1a3e687f authored by Nick Thomas's avatar Nick Thomas

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.
parent 9ba79e43
#!/usr/bin/env ruby
require_relative '../lib/gitlab_init'
#
# GitLab shell, invoked from ~/.ssh/authorized_keys
#
# Load ROOT_PATH and access the minimum necessary config file
require_relative '../support/go_build'
require_relative '../support/gitlab_config'
config = GitlabConfig.new
key_dir = File.dirname("#{config.auth_file}")
......
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
......@@ -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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment