diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-06-29 13:58:20 -0400 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-06-29 13:58:20 -0400 |
commit | 18b4d39ac7172cb02cec63e7bf1cc21807a9b3f0 (patch) | |
tree | 810dd76a8b3bea1048e5951cefd4d1eeee5aaefd /bin | |
parent | 5a6d71d143a6ea5f9747b25304aafa902ed381d0 (diff) | |
download | gitlab-shell-18b4d39ac7172cb02cec63e7bf1cc21807a9b3f0.tar.gz |
Refactor repository paths handling to allow multiple git mount pointsshards
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/check | 17 | ||||
-rwxr-xr-x | bin/create-hooks | 14 | ||||
-rwxr-xr-x | bin/install | 8 |
3 files changed, 22 insertions, 17 deletions
@@ -23,18 +23,15 @@ end puts "\nCheck directories and files: " config = GitlabConfig.new -dirs = [config.repos_path, config.auth_file] -dirs.each do |dir| - abort("ERROR: missing option in config.yml") unless dir - print "\t#{dir}: " - if File.exists?(dir) - print 'OK' - else - abort "FAILED" - end - puts "\n" +abort("ERROR: missing option in config.yml") unless config.auth_file +print "\t#{config.auth_file}: " +if File.exists?(config.auth_file) + print 'OK' +else + abort "FAILED" end +puts "\n" print "Send ping to redis server: " abort unless GitlabNet.new.redis_client.ping diff --git a/bin/create-hooks b/bin/create-hooks index 4efa650..241e10b 100755 --- a/bin/create-hooks +++ b/bin/create-hooks @@ -7,10 +7,14 @@ require_relative '../lib/gitlab_init' require File.join(ROOT_PATH, 'lib', 'gitlab_projects') -Dir["#{GitlabConfig.new.repos_path}/*/*.git"].each do |repo| - begin - GitlabProjects.create_hooks(repo) - rescue Errno::ENOENT - # The user must have deleted their repository. Ignore. +repository_storage_paths = ARGV + +repository_storage_paths.each do |repo_path| + Dir["#{repo_path.chomp('/')}/*/*.git"].each do |repo| + begin + GitlabProjects.create_hooks(repo) + rescue Errno::ENOENT + # The user must have deleted their repository. Ignore. + end end end diff --git a/bin/install b/bin/install index 9847ae1..73ac592 100755 --- a/bin/install +++ b/bin/install @@ -8,16 +8,20 @@ require_relative '../lib/gitlab_init' config = GitlabConfig.new key_dir = File.dirname("#{config.auth_file}") +repository_storage_paths = ARGV commands = [ - %W(mkdir -p #{config.repos_path}), %W(mkdir -p #{key_dir}), %W(chmod 700 #{key_dir}), %W(touch #{config.auth_file}), %W(chmod 600 #{config.auth_file}), - %W(chmod ug+rwX,o-rwx #{config.repos_path}), ] +repository_storage_paths.each do |repository_storage_path| + commands << %W(mkdir -p #{repository_storage_path}) + commands << %W(chmod ug+rwX,o-rwx #{repository_storage_path}) +end + commands.each do |cmd| print "#{cmd.join(' ')}: " if system(*cmd) |