diff options
author | Victor Zagorodny <vzagorodny@gitlab.com> | 2019-08-20 18:57:19 +0000 |
---|---|---|
committer | Victor Zagorodny <vzagorodny@gitlab.com> | 2019-08-20 18:57:19 +0000 |
commit | ea912b7d9306525f603bfea3bce7dbb4fb655d03 (patch) | |
tree | bfff29be659b7fead4a3b5e94ea59e84d1e49372 | |
parent | 27ac932878d117d1cbffc0d190ed179f3353886c (diff) | |
download | gitlab-shell-vzagorodny-master-patch-03209.tar.gz |
Refactor "go build" path constantsvzagorodny-master-patch-03209
-rwxr-xr-x | bin/compile | 9 | ||||
-rw-r--r-- | support/go_build.rb | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/bin/compile b/bin/compile index 229b8fd..e6eacca 100755 --- a/bin/compile +++ b/bin/compile @@ -5,13 +5,16 @@ require 'fileutils' require_relative '../support/go_build' include GoBuild +BUILD_BIN_GLOB = File.join(BUILD_DIR, 'bin', '*') +ROOT_BIN = File.join(ROOT_PATH, 'bin') + def main ensure_build_dir_exists - run!(GO_ENV, %W[go install ./cmd/...], chdir: File.join(ROOT_PATH, GO_DIR)) - executables = Dir[File.join(BUILD_DIR, 'bin', '*')] + run!(GO_ENV, %W[go install ./cmd/...], chdir: GO_DIR) + executables = Dir[BUILD_BIN_GLOB] FileUtils.chmod(0755, executables) - FileUtils.cp(executables, File.join(ROOT_PATH, 'bin')) + FileUtils.cp(executables, ROOT_BIN) end main diff --git a/support/go_build.rb b/support/go_build.rb index 1ef2e17..42e207a 100644 --- a/support/go_build.rb +++ b/support/go_build.rb @@ -6,7 +6,7 @@ require 'fileutils' require_relative '../lib/gitlab_init' module GoBuild - GO_DIR = 'go'.freeze + GO_DIR = File.join(ROOT_PATH, 'go') BUILD_DIR = File.join(ROOT_PATH, 'go_build') GO_ENV = { |