Commit ae498b6c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'use-load-path' into 'master'

Use load path, set ROOT_PATH via ENV

Uses load path instead of require_relative, adds an environment variable to set gitlab-shell ROOT_PATH variable (Fixes #30)

See merge request !28
parents 79fdf65c 96f08459
#!/usr/bin/env ruby #!/usr/bin/env ruby
require_relative '../lib/gitlab_init' $:.unshift File.expand_path('../lib', __FILE__)
require_relative '../lib/gitlab_net' require 'gitlab_init'
require 'gitlab_net'
# #
# GitLab shell check task # GitLab shell check task
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
# #
# This script is used when restoring a GitLab backup. # This script is used when restoring a GitLab backup.
require_relative '../lib/gitlab_init' $:.unshift File.expand_path('../lib', __FILE__)
require File.join(ROOT_PATH, 'lib', 'gitlab_projects') require 'gitlab_init'
require 'gitlab_projects'
Dir["#{GitlabConfig.new.repos_path}/*/*.git"].each do |repo| Dir["#{GitlabConfig.new.repos_path}/*/*.git"].each do |repo|
begin begin
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
require_relative '../lib/gitlab_init' $:.unshift File.expand_path('../lib', __FILE__)
require 'gitlab_init'
# #
# GitLab Keys shell. Add/remove keys from ~/.ssh/authorized_keys # GitLab Keys shell. Add/remove keys from ~/.ssh/authorized_keys
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
require_relative '../lib/gitlab_init' $:.unshift File.expand_path('../lib', __FILE__)
require 'gitlab_init'
# #
# GitLab Projects shell. Add/remove projects from /home/git/repositories # GitLab Projects shell. Add/remove projects from /home/git/repositories
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
require_relative '../lib/gitlab_init' $:.unshift File.expand_path('../lib', __FILE__)
require 'gitlab_init'
# #
# GitLab shell, invoked from ~/.ssh/authorized_keys # GitLab shell, invoked from ~/.ssh/authorized_keys
......
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..")) if ENV['SHELL_ROOT_PATH'].nil? || ENV['SHELL_ROOT_PATH'].empty?
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), ".."))
else
ROOT_PATH = ENV['SHELL_ROOT_PATH']
end
require_relative 'gitlab_config' require_relative 'gitlab_config'
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