Commit f1c82bc56c9391abac5ba9b70e406d899cf26495
1 parent
c0f6a932
Exists in
master
and in
4 other branches
Add gitlab-shell#path option in config
Before this commit gitlab-shell but me placed directly in home dir. Ex: /home/git/gitlab-shell After this change you can place gitlab-shell in custom location. Ex: /Users/developer/gitlab/gitlab-shell Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
21 additions
and
14 deletions
Show diff stats
config/gitlab.yml.example
@@ -174,6 +174,8 @@ production: &base | @@ -174,6 +174,8 @@ production: &base | ||
174 | 174 | ||
175 | ## GitLab Shell settings | 175 | ## GitLab Shell settings |
176 | gitlab_shell: | 176 | gitlab_shell: |
177 | + path: /home/git/gitlab-shell/ | ||
178 | + | ||
177 | # REPOS_PATH MUST NOT BE A SYMLINK!!! | 179 | # REPOS_PATH MUST NOT BE A SYMLINK!!! |
178 | repos_path: /home/git/repositories/ | 180 | repos_path: /home/git/repositories/ |
179 | hooks_path: /home/git/gitlab-shell/hooks/ | 181 | hooks_path: /home/git/gitlab-shell/hooks/ |
config/initializers/1_settings.rb
@@ -114,6 +114,7 @@ Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}? | @@ -114,6 +114,7 @@ Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}? | ||
114 | # GitLab Shell | 114 | # GitLab Shell |
115 | # | 115 | # |
116 | Settings['gitlab_shell'] ||= Settingslogic.new({}) | 116 | Settings['gitlab_shell'] ||= Settingslogic.new({}) |
117 | +Settings.gitlab_shell['path'] ||= Settings.gitlab['user_home'] + '/gitlab-shell/' | ||
117 | Settings.gitlab_shell['hooks_path'] ||= Settings.gitlab['user_home'] + '/gitlab-shell/hooks/' | 118 | Settings.gitlab_shell['hooks_path'] ||= Settings.gitlab['user_home'] + '/gitlab-shell/hooks/' |
118 | Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil? | 119 | Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil? |
119 | Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil? | 120 | Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil? |
lib/gitlab/backend/shell.rb
@@ -10,7 +10,7 @@ module Gitlab | @@ -10,7 +10,7 @@ module Gitlab | ||
10 | # add_repository("gitlab/gitlab-ci") | 10 | # add_repository("gitlab/gitlab-ci") |
11 | # | 11 | # |
12 | def add_repository(name) | 12 | def add_repository(name) |
13 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", "#{name}.git" | 13 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "add-project", "#{name}.git" |
14 | end | 14 | end |
15 | 15 | ||
16 | # Import repository | 16 | # Import repository |
@@ -21,7 +21,7 @@ module Gitlab | @@ -21,7 +21,7 @@ module Gitlab | ||
21 | # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") | 21 | # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") |
22 | # | 22 | # |
23 | def import_repository(name, url) | 23 | def import_repository(name, url) |
24 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", "#{name}.git", url | 24 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "import-project", "#{name}.git", url |
25 | end | 25 | end |
26 | 26 | ||
27 | # Move repository | 27 | # Move repository |
@@ -33,7 +33,7 @@ module Gitlab | @@ -33,7 +33,7 @@ module Gitlab | ||
33 | # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") | 33 | # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") |
34 | # | 34 | # |
35 | def mv_repository(path, new_path) | 35 | def mv_repository(path, new_path) |
36 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", "#{path}.git", "#{new_path}.git" | 36 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "mv-project", "#{path}.git", "#{new_path}.git" |
37 | end | 37 | end |
38 | 38 | ||
39 | # Update HEAD for repository | 39 | # Update HEAD for repository |
@@ -45,7 +45,7 @@ module Gitlab | @@ -45,7 +45,7 @@ module Gitlab | ||
45 | # update_repository_head("gitlab/gitlab-ci", "3-1-stable") | 45 | # update_repository_head("gitlab/gitlab-ci", "3-1-stable") |
46 | # | 46 | # |
47 | def update_repository_head(path, branch) | 47 | def update_repository_head(path, branch) |
48 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", "#{path}.git", branch | 48 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "update-head", "#{path}.git", branch |
49 | end | 49 | end |
50 | 50 | ||
51 | # Fork repository to new namespace | 51 | # Fork repository to new namespace |
@@ -57,7 +57,7 @@ module Gitlab | @@ -57,7 +57,7 @@ module Gitlab | ||
57 | # fork_repository("gitlab/gitlab-ci", "randx") | 57 | # fork_repository("gitlab/gitlab-ci", "randx") |
58 | # | 58 | # |
59 | def fork_repository(path, fork_namespace) | 59 | def fork_repository(path, fork_namespace) |
60 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", "#{path}.git", fork_namespace | 60 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "fork-project", "#{path}.git", fork_namespace |
61 | end | 61 | end |
62 | 62 | ||
63 | # Remove repository from file system | 63 | # Remove repository from file system |
@@ -68,7 +68,7 @@ module Gitlab | @@ -68,7 +68,7 @@ module Gitlab | ||
68 | # remove_repository("gitlab/gitlab-ci") | 68 | # remove_repository("gitlab/gitlab-ci") |
69 | # | 69 | # |
70 | def remove_repository(name) | 70 | def remove_repository(name) |
71 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", "#{name}.git" | 71 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "rm-project", "#{name}.git" |
72 | end | 72 | end |
73 | 73 | ||
74 | # Add repository branch from passed ref | 74 | # Add repository branch from passed ref |
@@ -81,7 +81,7 @@ module Gitlab | @@ -81,7 +81,7 @@ module Gitlab | ||
81 | # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") | 81 | # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") |
82 | # | 82 | # |
83 | def add_branch(path, branch_name, ref) | 83 | def add_branch(path, branch_name, ref) |
84 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", "#{path}.git", branch_name, ref | 84 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "create-branch", "#{path}.git", branch_name, ref |
85 | end | 85 | end |
86 | 86 | ||
87 | # Remove repository branch | 87 | # Remove repository branch |
@@ -93,7 +93,7 @@ module Gitlab | @@ -93,7 +93,7 @@ module Gitlab | ||
93 | # rm_branch("gitlab/gitlab-ci", "4-0-stable") | 93 | # rm_branch("gitlab/gitlab-ci", "4-0-stable") |
94 | # | 94 | # |
95 | def rm_branch(path, branch_name) | 95 | def rm_branch(path, branch_name) |
96 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", "#{path}.git", branch_name | 96 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "rm-branch", "#{path}.git", branch_name |
97 | end | 97 | end |
98 | 98 | ||
99 | # Add repository tag from passed ref | 99 | # Add repository tag from passed ref |
@@ -106,7 +106,7 @@ module Gitlab | @@ -106,7 +106,7 @@ module Gitlab | ||
106 | # add_tag("gitlab/gitlab-ci", "v4.0", "master") | 106 | # add_tag("gitlab/gitlab-ci", "v4.0", "master") |
107 | # | 107 | # |
108 | def add_tag(path, tag_name, ref) | 108 | def add_tag(path, tag_name, ref) |
109 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", "#{path}.git", tag_name, ref | 109 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "create-tag", "#{path}.git", tag_name, ref |
110 | end | 110 | end |
111 | 111 | ||
112 | # Remove repository tag | 112 | # Remove repository tag |
@@ -118,7 +118,7 @@ module Gitlab | @@ -118,7 +118,7 @@ module Gitlab | ||
118 | # rm_tag("gitlab/gitlab-ci", "v4.0") | 118 | # rm_tag("gitlab/gitlab-ci", "v4.0") |
119 | # | 119 | # |
120 | def rm_tag(path, tag_name) | 120 | def rm_tag(path, tag_name) |
121 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", "#{path}.git", tag_name | 121 | + system "#{gitlab_shell_path}/bin/gitlab-projects", "rm-tag", "#{path}.git", tag_name |
122 | end | 122 | end |
123 | 123 | ||
124 | # Add new key to gitlab-shell | 124 | # Add new key to gitlab-shell |
@@ -127,7 +127,7 @@ module Gitlab | @@ -127,7 +127,7 @@ module Gitlab | ||
127 | # add_key("key-42", "sha-rsa ...") | 127 | # add_key("key-42", "sha-rsa ...") |
128 | # | 128 | # |
129 | def add_key(key_id, key_content) | 129 | def add_key(key_id, key_content) |
130 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", key_id, key_content | 130 | + system "#{gitlab_shell_path}/bin/gitlab-keys", "add-key", key_id, key_content |
131 | end | 131 | end |
132 | 132 | ||
133 | # Remove ssh key from gitlab shell | 133 | # Remove ssh key from gitlab shell |
@@ -136,7 +136,7 @@ module Gitlab | @@ -136,7 +136,7 @@ module Gitlab | ||
136 | # remove_key("key-342", "sha-rsa ...") | 136 | # remove_key("key-342", "sha-rsa ...") |
137 | # | 137 | # |
138 | def remove_key(key_id, key_content) | 138 | def remove_key(key_id, key_content) |
139 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", key_id, key_content | 139 | + system "#{gitlab_shell_path}/bin/gitlab-keys", "rm-key", key_id, key_content |
140 | end | 140 | end |
141 | 141 | ||
142 | # Remove all ssh keys from gitlab shell | 142 | # Remove all ssh keys from gitlab shell |
@@ -145,7 +145,7 @@ module Gitlab | @@ -145,7 +145,7 @@ module Gitlab | ||
145 | # remove_all_keys | 145 | # remove_all_keys |
146 | # | 146 | # |
147 | def remove_all_keys | 147 | def remove_all_keys |
148 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "clear" | 148 | + system "#{gitlab_shell_path}/bin/gitlab-keys", "clear" |
149 | end | 149 | end |
150 | 150 | ||
151 | # Add empty directory for storing repositories | 151 | # Add empty directory for storing repositories |
@@ -198,7 +198,7 @@ module Gitlab | @@ -198,7 +198,7 @@ module Gitlab | ||
198 | 198 | ||
199 | # Return GitLab shell version | 199 | # Return GitLab shell version |
200 | def version | 200 | def version |
201 | - gitlab_shell_version_file = "#{gitlab_shell_user_home}/gitlab-shell/VERSION" | 201 | + gitlab_shell_version_file = "#{gitlab_shell_path}/VERSION" |
202 | 202 | ||
203 | if File.readable?(gitlab_shell_version_file) | 203 | if File.readable?(gitlab_shell_version_file) |
204 | File.read(gitlab_shell_version_file) | 204 | File.read(gitlab_shell_version_file) |
@@ -207,6 +207,10 @@ module Gitlab | @@ -207,6 +207,10 @@ module Gitlab | ||
207 | 207 | ||
208 | protected | 208 | protected |
209 | 209 | ||
210 | + def gitlab_shell_path | ||
211 | + Gitlab.config.gitlab_shell.path | ||
212 | + end | ||
213 | + | ||
210 | def gitlab_shell_user_home | 214 | def gitlab_shell_user_home |
211 | File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}") | 215 | File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}") |
212 | end | 216 | end |