Merge pull request #2247 from riyad/update-settings
Reorganize settings
This commit is contained in:
commit
1dcf19c924
|
@ -30,7 +30,7 @@ class Admin::UsersController < AdminController
|
||||||
|
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@admin_user = User.new({ projects_limit: Gitlab.config.default_projects_limit }, as: :admin)
|
@admin_user = User.new({ projects_limit: Gitlab.config.gitlab.default_projects_limit }, as: :admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||||
Gitlab.config.omniauth_providers.each do |provider|
|
Gitlab.config.omniauth.providers.each do |provider|
|
||||||
define_method provider['name'] do
|
define_method provider['name'] do
|
||||||
handle_omniauth
|
handle_omniauth
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,10 +34,10 @@ module ApplicationHelper
|
||||||
def gravatar_icon(user_email = '', size = nil)
|
def gravatar_icon(user_email = '', size = nil)
|
||||||
size = 40 if size.nil? || size <= 0
|
size = 40 if size.nil? || size <= 0
|
||||||
|
|
||||||
if Gitlab.config.disable_gravatar? || user_email.blank?
|
if !Gitlab.config.gravatar.enabled || user_email.blank?
|
||||||
'no_avatar.png'
|
'no_avatar.png'
|
||||||
else
|
else
|
||||||
gravatar_url = request.ssl? ? Gitlab.config.gravatar_ssl_url : Gitlab.config.gravatar_url
|
gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
|
||||||
user_email.strip!
|
user_email.strip!
|
||||||
sprintf(gravatar_url, {:hash => Digest::MD5.hexdigest(user_email.downcase), :email => URI.escape(user_email), :size => size})
|
sprintf(gravatar_url, {:hash => Digest::MD5.hexdigest(user_email.downcase), :email => URI.escape(user_email), :size => size})
|
||||||
end
|
end
|
||||||
|
@ -48,7 +48,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def web_app_url
|
def web_app_url
|
||||||
"#{request_protocol}://#{Gitlab.config.web_host}/"
|
"#{request_protocol}://#{Gitlab.config.gitlab.host}/"
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_commit(project)
|
def last_commit(project)
|
||||||
|
|
|
@ -3,11 +3,11 @@ class Notify < ActionMailer::Base
|
||||||
add_template_helper ApplicationHelper
|
add_template_helper ApplicationHelper
|
||||||
add_template_helper GitlabMarkdownHelper
|
add_template_helper GitlabMarkdownHelper
|
||||||
|
|
||||||
default_url_options[:host] = Gitlab.config.web_host
|
default_url_options[:host] = Gitlab.config.gitlab.host
|
||||||
default_url_options[:protocol] = Gitlab.config.web_protocol
|
default_url_options[:protocol] = Gitlab.config.gitlab.protocol
|
||||||
default_url_options[:port] = Gitlab.config.web_port if Gitlab.config.web_custom_port?
|
default_url_options[:port] = Gitlab.config.gitlab.port if Gitlab.config.gitlab_on_non_standard_port?
|
||||||
|
|
||||||
default from: Gitlab.config.email_from
|
default from: Gitlab.config.gitlab.email_from
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,14 +48,14 @@ class Namespace < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_dir_exist
|
def ensure_dir_exist
|
||||||
namespace_dir_path = File.join(Gitlab.config.git_base_path, path)
|
namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
|
||||||
system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path)
|
system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_dir
|
def move_dir
|
||||||
if path_changed?
|
if path_changed?
|
||||||
old_path = File.join(Gitlab.config.git_base_path, path_was)
|
old_path = File.join(Gitlab.config.gitolite.repos_path, path_was)
|
||||||
new_path = File.join(Gitlab.config.git_base_path, path)
|
new_path = File.join(Gitlab.config.gitolite.repos_path, path)
|
||||||
if File.exists?(new_path)
|
if File.exists?(new_path)
|
||||||
raise "Already exists"
|
raise "Already exists"
|
||||||
end
|
end
|
||||||
|
@ -64,7 +64,7 @@ class Namespace < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def rm_dir
|
def rm_dir
|
||||||
dir_path = File.join(Gitlab.config.git_base_path, path)
|
dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
|
||||||
system("rm -rf #{dir_path}")
|
system("rm -rf #{dir_path}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -195,7 +195,7 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def web_url
|
def web_url
|
||||||
[Gitlab.config.url, path_with_namespace].join("/")
|
[Gitlab.config.gitlab.url, path_with_namespace].join("/")
|
||||||
end
|
end
|
||||||
|
|
||||||
def common_notes
|
def common_notes
|
||||||
|
|
|
@ -114,7 +114,7 @@ module PushObserver
|
||||||
id: commit.id,
|
id: commit.id,
|
||||||
message: commit.safe_message,
|
message: commit.safe_message,
|
||||||
timestamp: commit.date.xmlschema,
|
timestamp: commit.date.xmlschema,
|
||||||
url: "#{Gitlab.config.url}/#{path_with_namespace}/commit/#{commit.id}",
|
url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{commit.id}",
|
||||||
author: {
|
author: {
|
||||||
name: commit.author_name,
|
name: commit.author_name,
|
||||||
email: commit.author_email
|
email: commit.author_email
|
||||||
|
|
|
@ -97,7 +97,7 @@ module Repository
|
||||||
end
|
end
|
||||||
|
|
||||||
def path_to_repo
|
def path_to_repo
|
||||||
File.join(Gitlab.config.git_base_path, "#{path_with_namespace}.git")
|
File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git")
|
||||||
end
|
end
|
||||||
|
|
||||||
def namespace_dir
|
def namespace_dir
|
||||||
|
@ -199,7 +199,7 @@ module Repository
|
||||||
end
|
end
|
||||||
|
|
||||||
def http_url_to_repo
|
def http_url_to_repo
|
||||||
http_url = [Gitlab.config.url, "/", path_with_namespace, ".git"].join('')
|
http_url = [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if current branch name is marked as protected in the system
|
# Check if current branch name is marked as protected in the system
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
%b
|
%b
|
||||||
Path:
|
Path:
|
||||||
%td
|
%td
|
||||||
%span.monospace= File.join(Gitlab.config.git_base_path, @group.path)
|
%span.monospace= File.join(Gitlab.config.gitolite.repos_path, @group.path)
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%b
|
%b
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
Permissions:
|
Permissions:
|
||||||
%pre
|
%pre
|
||||||
= preserve do
|
= preserve do
|
||||||
sudo chown -R git:git #{Gitlab.config.git_base_path}
|
sudo chown -R git:git #{Gitlab.config.gitolite.repos_path}
|
||||||
sudo chmod -R ug+rwXs #{Gitlab.config.git_base_path}
|
sudo chmod -R ug+rwXs #{Gitlab.config.gitolite.repos_path}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- if Gitlab.config.omniauth_enabled?
|
- if Gitlab.config.omniauth.enabled
|
||||||
%fieldset
|
%fieldset
|
||||||
%legend Social Accounts
|
%legend Social Accounts
|
||||||
.oauth_select_holder
|
.oauth_select_holder
|
||||||
|
|
|
@ -33,11 +33,11 @@
|
||||||
%ul
|
%ul
|
||||||
%li
|
%li
|
||||||
%p You can change your password on Account page
|
%p You can change your password on Account page
|
||||||
-unless Gitlab.config.disable_gravatar?
|
- if Gitlab.config.gravatar.enabled
|
||||||
%li
|
%li
|
||||||
%p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"}
|
%p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"}
|
||||||
|
|
||||||
- if Gitlab.config.omniauth_enabled? && @user.provider?
|
- if Gitlab.config.omniauth.enabled && @user.provider?
|
||||||
%li
|
%li
|
||||||
%p
|
%p
|
||||||
You can login through #{@user.provider.titleize}!
|
You can login through #{@user.provider.titleize}!
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.input-prepend.project_clone_holder
|
.input-prepend.project_clone_holder
|
||||||
%button{class: "btn active", :"data-clone" => @project.ssh_url_to_repo} SSH
|
%button{class: "btn active", :"data-clone" => @project.ssh_url_to_repo} SSH
|
||||||
%button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase
|
%button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.gitlab.protocol.upcase
|
||||||
= text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select input-xxlarge"
|
= text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select input-xxlarge"
|
||||||
|
|
|
@ -2,7 +2,7 @@ class PostReceive
|
||||||
@queue = :post_receive
|
@queue = :post_receive
|
||||||
|
|
||||||
def self.perform(repo_path, oldrev, newrev, ref, identifier)
|
def self.perform(repo_path, oldrev, newrev, ref, identifier)
|
||||||
repo_path.gsub!(Gitlab.config.git_base_path.to_s, "")
|
repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
|
||||||
repo_path.gsub!(/.git$/, "")
|
repo_path.gsub!(/.git$/, "")
|
||||||
repo_path.gsub!(/^\//, "")
|
repo_path.gsub!(/^\//, "")
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class PostReceive
|
||||||
return false if project.nil?
|
return false if project.nil?
|
||||||
|
|
||||||
# Ignore push from non-gitlab users
|
# Ignore push from non-gitlab users
|
||||||
user = if identifier.eql? Gitlab.config.gitolite_admin_key
|
user = if identifier.eql? Gitlab.config.gitolite.admin_key
|
||||||
email = project.commit(newrev).author.email rescue nil
|
email = project.commit(newrev).author.email rescue nil
|
||||||
User.find_by_email(email) if email
|
User.find_by_email(email) if email
|
||||||
elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
|
elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
|
||||||
|
|
|
@ -1,57 +1,62 @@
|
||||||
# # # # # # # # # # # # # # # # # #
|
|
||||||
# Gitlab application config file #
|
|
||||||
# # # # # # # # # # # # # # # # # #
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 1. Common settings
|
# 1. GitLab app settings
|
||||||
# ==========================
|
# ==========================
|
||||||
|
|
||||||
# Web application specific settings
|
## GitLab settings
|
||||||
web:
|
gitlab:
|
||||||
|
## Web server settings
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 80
|
port: 80
|
||||||
https: false
|
https: false
|
||||||
|
|
||||||
# Email used for notification
|
## Email settings
|
||||||
# about new issues, comments
|
# Email address used in the "From" field in mails sent by GitLab
|
||||||
email:
|
email_from: gitlab@localhost
|
||||||
from: notify@localhost
|
|
||||||
|
|
||||||
# Application specific settings
|
## Project settings
|
||||||
# Like default project limit for user etc
|
|
||||||
app:
|
|
||||||
default_projects_limit: 10
|
default_projects_limit: 10
|
||||||
# backup_path: "/vol/backups" # default: Rails.root + backups/
|
|
||||||
# backup_keep_time: 604800 # default: 0 (forever) (in seconds)
|
## Gravatar
|
||||||
# disable_gravatar: true # default: false - Disable user avatars from Gravatar.com
|
gravatar:
|
||||||
# gravatar_url: "http://" # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm
|
enabled: true # Use user avatar images from Gravatar.com (default: true)
|
||||||
# gravatar_ssl_url: "https://" # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm
|
# plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm
|
||||||
|
# ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 2. Auth settings
|
# 2. Auth settings
|
||||||
# ==========================
|
# ==========================
|
||||||
|
|
||||||
|
## LDAP settings
|
||||||
ldap:
|
ldap:
|
||||||
enabled: false
|
enabled: false
|
||||||
host: '_your_ldap_server'
|
host: '_your_ldap_server'
|
||||||
base: '_the_base_where_you_search_for_users'
|
base: '_the_base_where_you_search_for_users'
|
||||||
port: 636
|
port: 636
|
||||||
uid: 'sAMAccountName'
|
uid: 'sAMAccountName'
|
||||||
method: 'ssl' # plain
|
method: 'ssl' # "ssl" or "plain"
|
||||||
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
|
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
|
||||||
password: '_the_password_of_the_bind_user'
|
password: '_the_password_of_the_bind_user'
|
||||||
|
|
||||||
|
## Omniauth settings
|
||||||
omniauth:
|
omniauth:
|
||||||
# Enable ability for users
|
# Enable ability for users
|
||||||
# to login via twitter, google ..
|
# Allow logging in via Twitter, Google, etc. using Omniauth providers
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
# IMPORTANT!
|
# CAUTION!
|
||||||
# It allows user to login without having user account
|
# This allows users to login without having a user account first (default: false)
|
||||||
|
# User accounts will be created automatically when authentication was successful.
|
||||||
allow_single_sign_on: false
|
allow_single_sign_on: false
|
||||||
|
# Locks down those users until they have been cleared by the admin (default: true)
|
||||||
block_auto_created_users: true
|
block_auto_created_users: true
|
||||||
|
|
||||||
# Auth providers
|
## Auth providers
|
||||||
|
# Uncomment the lines and fill in the data of the auth provider you want to use
|
||||||
|
# If your favorite auth provider is not listed you can user others:
|
||||||
|
# see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers
|
||||||
providers:
|
providers:
|
||||||
# - { name: 'google_oauth2', app_id: 'YOUR APP ID',
|
# - { name: 'google_oauth2', app_id: 'YOUR APP ID',
|
||||||
# app_secret: 'YOUR APP SECRET',
|
# app_secret: 'YOUR APP SECRET',
|
||||||
|
@ -62,29 +67,36 @@ omniauth:
|
||||||
# app_secret: 'YOUR APP SECRET' }
|
# app_secret: 'YOUR APP SECRET' }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 3. Advanced settings:
|
# 3. Advanced settings
|
||||||
# ==========================
|
# ==========================
|
||||||
|
|
||||||
# Git Hosting configuration
|
## Backup settings
|
||||||
git_host:
|
backup:
|
||||||
|
path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
|
||||||
|
# keep_time: 604800 # default: 0 (forever) (in seconds)
|
||||||
|
|
||||||
|
## Gitolite settings
|
||||||
|
gitolite:
|
||||||
admin_uri: git@localhost:gitolite-admin
|
admin_uri: git@localhost:gitolite-admin
|
||||||
base_path: /home/git/repositories/
|
repos_path: /home/git/repositories/
|
||||||
hooks_path: /home/git/.gitolite/hooks/
|
hooks_path: /home/git/.gitolite/hooks/
|
||||||
gitolite_admin_key: gitlab
|
admin_key: gitlab
|
||||||
git_user: git
|
|
||||||
upload_pack: true
|
upload_pack: true
|
||||||
receive_pack: true
|
receive_pack: true
|
||||||
# host: localhost
|
ssh_user: git
|
||||||
|
ssh_host: localhost
|
||||||
|
# ssh_port: 22
|
||||||
# config_file: gitolite.conf
|
# config_file: gitolite.conf
|
||||||
# port: 22
|
|
||||||
|
|
||||||
# Git settings
|
## Git settings
|
||||||
# Use default values unless you understand it
|
# CAUTION!
|
||||||
|
# Use the default values unless you really know what you are doing
|
||||||
git:
|
git:
|
||||||
path: /usr/bin/git
|
bin_path: /usr/bin/git
|
||||||
# Max size of git object like commit, in bytes
|
# Max size of git object like commit, in bytes
|
||||||
# This value can be increased if you have a very large commits
|
# This value can be increased if you have a very large commits
|
||||||
git_max_size: 5242880 # 5.megabytes
|
max_size: 5242880 # 5.megabytes
|
||||||
# Git timeout to read commit, in seconds
|
# Git timeout to read commit, in seconds
|
||||||
git_timeout: 10
|
timeout: 10
|
||||||
|
|
|
@ -2,23 +2,43 @@ class Settings < Settingslogic
|
||||||
source "#{Rails.root}/config/gitlab.yml"
|
source "#{Rails.root}/config/gitlab.yml"
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def web_protocol
|
def web_protocol
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.web_protocol is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitlab.protocol
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
self.web['protocol'] ||= web.https ? "https" : "http"
|
self.web['protocol'] ||= web.https ? "https" : "http"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def web_host
|
def web_host
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.web_host is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitlab.host
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
self.web['host'] ||= 'localhost'
|
self.web['host'] ||= 'localhost'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def email_from
|
def email_from
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.email_from is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitlab.email_from
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
self.email['from'] ||= ("notify@" + web_host)
|
self.email['from'] ||= ("notify@" + web_host)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def url
|
def url
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.url is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitlab.url
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
self['url'] ||= build_url
|
self['url'] ||= build_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def web_port
|
def web_port
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.web_port is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitlab.port.to_i
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
if web.https
|
if web.https
|
||||||
web['port'] = 443
|
web['port'] = 443
|
||||||
else
|
else
|
||||||
|
@ -26,11 +46,17 @@ class Settings < Settingslogic
|
||||||
end.to_i
|
end.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def web_custom_port?
|
def web_custom_port?
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.web_custom_port? is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitlab_on_non_standard_port?
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
![443, 80].include?(web_port)
|
![443, 80].include?(web_port)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def build_url
|
def build_url
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.build_url is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
if web_custom_port?
|
if web_custom_port?
|
||||||
custom_port = ":#{web_port}"
|
custom_port = ":#{web_port}"
|
||||||
else
|
else
|
||||||
|
@ -44,19 +70,35 @@ class Settings < Settingslogic
|
||||||
].join('')
|
].join('')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def ssh_port
|
def ssh_port
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.ssh_port is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.ssh_port
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['port'] || 22
|
git_host['port'] || 22
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def ssh_user
|
def ssh_user
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.ssh_user is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.ssh_user
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['git_user'] || 'git'
|
git_host['git_user'] || 'git'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def ssh_host
|
def ssh_host
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.ssh_host is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.ssh_host
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['host'] || web_host || 'localhost'
|
git_host['host'] || web_host || 'localhost'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def ssh_path
|
def ssh_path
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.ssh_path is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.ssh_path_prefix
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
if ssh_port != 22
|
if ssh_port != 22
|
||||||
"ssh://#{ssh_user}@#{ssh_host}:#{ssh_port}/"
|
"ssh://#{ssh_user}@#{ssh_host}:#{ssh_port}/"
|
||||||
else
|
else
|
||||||
|
@ -64,15 +106,27 @@ class Settings < Settingslogic
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def git_base_path
|
def git_base_path
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.git_base_path is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.repos_path
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['base_path'] || '/home/git/repositories/'
|
git_host['base_path'] || '/home/git/repositories/'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def git_hooks_path
|
def git_hooks_path
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.git_hooks_path is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.hooks_path
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['hooks_path'] || '/home/git/share/gitolite/hooks/'
|
git_host['hooks_path'] || '/home/git/share/gitolite/hooks/'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def git_upload_pack
|
def git_upload_pack
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.git_upload_pack is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.upload_pack
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
if git_host['upload_pack'] != false
|
if git_host['upload_pack'] != false
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
@ -80,7 +134,11 @@ class Settings < Settingslogic
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def git_receive_pack
|
def git_receive_pack
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.git_receive_pack is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.receive_pack
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
if git_host['receive_pack'] != false
|
if git_host['receive_pack'] != false
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
@ -88,71 +146,207 @@ class Settings < Settingslogic
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def git_bin_path
|
def git_bin_path
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.git_bin_path is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
git.bin_path
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git['path'] || '/usr/bin/git'
|
git['path'] || '/usr/bin/git'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def git_max_size
|
def git_max_size
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.git_max_size is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
git.max_size
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git['git_max_size'] || 5242880 # 5.megabytes
|
git['git_max_size'] || 5242880 # 5.megabytes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def git_timeout
|
def git_timeout
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.git_timeout is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
git.timeout
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git['git_timeout'] || 10
|
git['git_timeout'] || 10
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def gitolite_admin_uri
|
def gitolite_admin_uri
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.gitolite_admin_uri is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.admin_uri
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['admin_uri'] || 'git@localhost:gitolite-admin'
|
git_host['admin_uri'] || 'git@localhost:gitolite-admin'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def gitolite_config_file
|
def gitolite_config_file
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.gitolite_config_file is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.config_file
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['config_file'] || 'gitolite.conf'
|
git_host['config_file'] || 'gitolite.conf'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def gitolite_admin_key
|
def gitolite_admin_key
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.gitolite_admin_key is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitolite.admin_key
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
git_host['gitolite_admin_key'] || 'gitlab'
|
git_host['gitolite_admin_key'] || 'gitlab'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def default_projects_limit
|
def default_projects_limit
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.default_projects_limit is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gitlab.default_projects_limit
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
app['default_projects_limit'] || 10
|
app['default_projects_limit'] || 10
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def backup_path
|
def backup_path
|
||||||
t = app['backup_path'] || "backups/"
|
ActiveSupport::Deprecation.warn("Settings.backup_path is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
t = /^\//.match(t) ? t : Rails.root .join(t)
|
backup.path
|
||||||
t
|
rescue Settingslogic::MissingSetting
|
||||||
|
File.expand_path(app['backup_path'] || "backups/", Rails.root)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def backup_keep_time
|
def backup_keep_time
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.backup_keep_time is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
backup.keep_time
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
app['backup_keep_time'] || 0
|
app['backup_keep_time'] || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def ldap_enabled?
|
def ldap_enabled?
|
||||||
ldap && ldap['enabled']
|
ActiveSupport::Deprecation.warn("Settings.ldap_enabled? is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
ldap.enabled
|
||||||
rescue Settingslogic::MissingSetting
|
rescue Settingslogic::MissingSetting
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def omniauth_enabled?
|
def omniauth_enabled?
|
||||||
omniauth && omniauth['enabled']
|
ActiveSupport::Deprecation.warn("Settings.omniauth_enabled? is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
omniauth.enabled
|
||||||
rescue Settingslogic::MissingSetting
|
rescue Settingslogic::MissingSetting
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def omniauth_providers
|
def omniauth_providers
|
||||||
(omniauth_enabled? && omniauth['providers']) || []
|
ActiveSupport::Deprecation.warn("Settings.omniauth_providers is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
omniauth.providers
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def disable_gravatar?
|
def disable_gravatar?
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.disable_gravatar? is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
!gravatar.enabled
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
app['disable_gravatar'] || false
|
app['disable_gravatar'] || false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def gravatar_url
|
def gravatar_url
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.gravatar_url is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gravatar.plain_url
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
app['gravatar_url'] || 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
app['gravatar_url'] || 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
def gravatar_ssl_url
|
def gravatar_ssl_url
|
||||||
|
ActiveSupport::Deprecation.warn("Settings.gravatar_ssl_url is deprecated and will be removed from GitLab 4.1", caller)
|
||||||
|
gravatar.ssl_url
|
||||||
|
rescue Settingslogic::MissingSetting
|
||||||
app['gravatar_ssl_url'] || 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
app['gravatar_ssl_url'] || 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def gitlab_on_non_standard_port?
|
||||||
|
![443, 80].include?(gitlab.port.to_i)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def build_gitolite_ssh_path_prefix
|
||||||
|
if gitolite.ssh_port != 22
|
||||||
|
"ssh://#{gitolite.ssh_user}@#{gitolite.ssh_host}:#{gitolite.ssh_port}/"
|
||||||
|
else
|
||||||
|
"#{gitolite.ssh_user}@#{gitolite.ssh_host}:"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def build_gitlab_url
|
||||||
|
if gitlab_on_non_standard_port?
|
||||||
|
custom_port = ":#{gitlab.port}"
|
||||||
|
else
|
||||||
|
custom_port = nil
|
||||||
|
end
|
||||||
|
[ gitlab.protocol,
|
||||||
|
"://",
|
||||||
|
gitlab.host,
|
||||||
|
custom_port
|
||||||
|
].join('')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# Default settings
|
||||||
|
|
||||||
|
# FIXME: Deprecated: remove for 4.1
|
||||||
|
# all Settings.web ...
|
||||||
|
# all Settings.app ...
|
||||||
|
# all Settings.email ...
|
||||||
|
# all Settings.git_host ...
|
||||||
|
Settings['pre_40_config'] ||= Settings['web'].present?
|
||||||
|
|
||||||
|
Settings['ldap'] ||= Settingslogic.new({})
|
||||||
|
Settings.ldap['enabled'] ||= false
|
||||||
|
|
||||||
|
Settings['omniauth'] ||= Settingslogic.new({})
|
||||||
|
Settings.omniauth['enabled'] ||= false
|
||||||
|
Settings.omniauth['providers'] ||= []
|
||||||
|
|
||||||
|
Settings['gitlab'] ||= Settingslogic.new({})
|
||||||
|
Settings.gitlab['default_projects_limit'] ||= Settings.pre_40_config ? Settings.default_projects_limit : 10
|
||||||
|
Settings.gitlab['host'] ||= Settings.pre_40_config ? Settings.web_host : 'localhost'
|
||||||
|
Settings.gitlab['https'] ||= Settings.pre_40_config ? Settings.web.https : false
|
||||||
|
Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80
|
||||||
|
Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
|
||||||
|
Settings.gitlab['email_from'] ||= Settings.pre_40_config ? Settings.email_from : "gitlab@#{Settings.gitlab.host}"
|
||||||
|
Settings.gitlab['url'] ||= Settings.pre_40_config ? Settings.url : Settings.send(:build_gitlab_url)
|
||||||
|
|
||||||
|
Settings['gravatar'] ||= Settingslogic.new({})
|
||||||
|
Settings.gravatar['enabled'] ||= Settings.pre_40_config ? !Settings.disable_gravatar? : true
|
||||||
|
Settings.gravatar['plain_url'] ||= Settings.pre_40_config ? Settings.gravatar_url : 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
||||||
|
Settings.gravatar['ssl_url'] ||= Settings.pre_40_config ? Settings.gravatar_ssl_url : 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
||||||
|
|
||||||
|
Settings['gitolite'] ||= Settingslogic.new({})
|
||||||
|
Settings.gitolite['admin_key'] ||= Settings.pre_40_config ? Settings.gitolite_admin_key : 'gitlab'
|
||||||
|
Settings.gitolite['admin_uri'] ||= Settings.pre_40_config ? Settings.gitolite_admin_uri : 'git@localhost:gitolite-admin'
|
||||||
|
Settings.gitolite['config_file'] ||= Settings.pre_40_config ? Settings.gitolite_config_file : 'gitolite.conf'
|
||||||
|
Settings.gitolite['hooks_path'] ||= Settings.pre_40_config ? Settings.git_hooks_path : '/home/git/share/gitolite/hooks/'
|
||||||
|
Settings.gitolite['receive_pack'] ||= Settings.pre_40_config ? Settings.git_receive_pack : (Settings.gitolite['receive_pack'] != false)
|
||||||
|
Settings.gitolite['repos_path'] ||= Settings.pre_40_config ? Settings.git_base_path : '/home/git/repositories/'
|
||||||
|
Settings.gitolite['upload_pack'] ||= Settings.pre_40_config ? Settings.git_upload_pack : (Settings.gitolite['upload_pack'] != false)
|
||||||
|
Settings.gitolite['ssh_host'] ||= Settings.pre_40_config ? Settings.ssh_host : (Settings.gitlab.host || 'localhost')
|
||||||
|
Settings.gitolite['ssh_port'] ||= Settings.pre_40_config ? Settings.ssh_port : 22
|
||||||
|
Settings.gitolite['ssh_user'] ||= Settings.pre_40_config ? Settings.ssh_user : 'git'
|
||||||
|
Settings.gitolite['ssh_path_prefix'] ||= Settings.pre_40_config ? Settings.ssh_path : Settings.send(:build_gitolite_ssh_path_prefix)
|
||||||
|
|
||||||
|
Settings['backup'] ||= Settingslogic.new({})
|
||||||
|
Settings.backup['keep_time'] ||= Settings.pre_40_config ? Settings.backup_keep_time : 0
|
||||||
|
Settings.backup['path'] = Settings.pre_40_config ? Settings.backup_path : File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root)
|
||||||
|
|
||||||
|
Settings['git'] ||= Settingslogic.new({})
|
||||||
|
Settings.git['max_size'] ||= Settings.pre_40_config ? Settings.git_max_size : 5242880 # 5.megabytes
|
||||||
|
Settings.git['bin_path'] ||= Settings.pre_40_config ? Settings.git_bin_path : '/usr/bin/git'
|
||||||
|
Settings.git['timeout'] ||= Settings.pre_40_config ? Settings.git_timeout : 10
|
||||||
|
Settings.git['path'] ||= Settings.git.bin_path # FIXME: Deprecated: remove for 4.1
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require 'grit'
|
require 'grit'
|
||||||
require 'pygments'
|
require 'pygments'
|
||||||
|
|
||||||
Grit::Git.git_timeout = Gitlab.config.git_timeout
|
Grit::Git.git_timeout = Gitlab.config.git.timeout
|
||||||
Grit::Git.git_max_size = Gitlab.config.git_max_size
|
Grit::Git.git_max_size = Gitlab.config.git.max_size
|
||||||
|
|
||||||
Grit::Blob.class_eval do
|
Grit::Blob.class_eval do
|
||||||
include Linguist::BlobHelper
|
include Linguist::BlobHelper
|
||||||
|
|
|
@ -4,7 +4,7 @@ Devise.setup do |config|
|
||||||
# ==> Mailer Configuration
|
# ==> Mailer Configuration
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
||||||
config.mailer_sender = Gitlab.config.email_from
|
config.mailer_sender = Gitlab.config.gitlab.email_from
|
||||||
|
|
||||||
# Configure the class responsible to send e-mails.
|
# Configure the class responsible to send e-mails.
|
||||||
# config.mailer = "Devise::Mailer"
|
# config.mailer = "Devise::Mailer"
|
||||||
|
@ -205,20 +205,18 @@ Devise.setup do |config|
|
||||||
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
||||||
# end
|
# end
|
||||||
|
|
||||||
gl = Gitlab.config
|
if Gitlab.config.ldap.enabled
|
||||||
|
|
||||||
if gl.ldap_enabled?
|
|
||||||
config.omniauth :ldap,
|
config.omniauth :ldap,
|
||||||
:host => gl.ldap['host'],
|
:host => Gitlab.config.ldap['host'],
|
||||||
:base => gl.ldap['base'],
|
:base => Gitlab.config.ldap['base'],
|
||||||
:uid => gl.ldap['uid'],
|
:uid => Gitlab.config.ldap['uid'],
|
||||||
:port => gl.ldap['port'],
|
:port => Gitlab.config.ldap['port'],
|
||||||
:method => gl.ldap['method'],
|
:method => Gitlab.config.ldap['method'],
|
||||||
:bind_dn => gl.ldap['bind_dn'],
|
:bind_dn => Gitlab.config.ldap['bind_dn'],
|
||||||
:password => gl.ldap['password']
|
:password => Gitlab.config.ldap['password']
|
||||||
end
|
end
|
||||||
|
|
||||||
gl.omniauth_providers.each do |gl_provider|
|
Gitlab.config.omniauth.providers.each do |provider|
|
||||||
config.omniauth gl_provider['name'].to_sym, gl_provider['app_id'], gl_provider['app_secret']
|
config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,10 +14,10 @@ Gitlab::Application.routes.draw do
|
||||||
|
|
||||||
# Enable Grack support
|
# Enable Grack support
|
||||||
mount Grack::Bundle.new({
|
mount Grack::Bundle.new({
|
||||||
git_path: Gitlab.config.git_bin_path,
|
git_path: Gitlab.config.git.bin_path,
|
||||||
project_root: Gitlab.config.git_base_path,
|
project_root: Gitlab.config.gitolite.repos_path,
|
||||||
upload_pack: Gitlab.config.git_upload_pack,
|
upload_pack: Gitlab.config.gitolite.upload_pack,
|
||||||
receive_pack: Gitlab.config.git_receive_pack
|
receive_pack: Gitlab.config.gitolite.receive_pack
|
||||||
}), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ }
|
}), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ }
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -33,9 +33,9 @@ DatabaseCleaner.strategy = :truncation
|
||||||
|
|
||||||
Spinach.hooks.before_scenario do
|
Spinach.hooks.before_scenario do
|
||||||
# Use tmp dir for FS manipulations
|
# Use tmp dir for FS manipulations
|
||||||
Gitlab.config.stub(git_base_path: Rails.root.join('tmp', 'test-git-base-path'))
|
Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
|
||||||
FileUtils.rm_rf Gitlab.config.git_base_path
|
FileUtils.rm_rf Gitlab.config.gitolite.repos_path
|
||||||
FileUtils.mkdir_p Gitlab.config.git_base_path
|
FileUtils.mkdir_p Gitlab.config.gitolite.repos_path
|
||||||
end
|
end
|
||||||
|
|
||||||
Spinach.hooks.after_scenario do
|
Spinach.hooks.after_scenario do
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Gitlab
|
||||||
email: email,
|
email: email,
|
||||||
password: password,
|
password: password,
|
||||||
password_confirmation: password,
|
password_confirmation: password,
|
||||||
projects_limit: Gitlab.config.default_projects_limit,
|
projects_limit: Gitlab.config.gitlab.default_projects_limit,
|
||||||
}, as: :admin)
|
}, as: :admin)
|
||||||
if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
|
if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
|
||||||
@user.blocked = true
|
@user.blocked = true
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_to_repo path
|
def url_to_repo path
|
||||||
Gitlab.config.ssh_path + "#{path}.git"
|
Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git"
|
||||||
end
|
end
|
||||||
|
|
||||||
def enable_automerge
|
def enable_automerge
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Gitlab
|
||||||
def ga_repo
|
def ga_repo
|
||||||
@ga_repo ||= ::Gitolite::GitoliteAdmin.new(
|
@ga_repo ||= ::Gitolite::GitoliteAdmin.new(
|
||||||
File.join(config_tmp_dir,'gitolite'),
|
File.join(config_tmp_dir,'gitolite'),
|
||||||
conf: Gitlab.config.gitolite_config_file
|
conf: Gitlab.config.gitolite.config_file
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ module Gitlab
|
||||||
# Enable access to all repos for gitolite admin.
|
# Enable access to all repos for gitolite admin.
|
||||||
# We use it for accept merge request feature
|
# We use it for accept merge request feature
|
||||||
def admin_all_repo
|
def admin_all_repo
|
||||||
owner_name = Gitlab.config.gitolite_admin_key
|
owner_name = Gitlab.config.gitolite.admin_key
|
||||||
|
|
||||||
# @ALL repos premission for gitolite owner
|
# @ALL repos premission for gitolite owner
|
||||||
repo_name = "@all"
|
repo_name = "@all"
|
||||||
|
@ -189,7 +189,7 @@ module Gitlab
|
||||||
|
|
||||||
def pull tmp_dir
|
def pull tmp_dir
|
||||||
Dir.mkdir tmp_dir
|
Dir.mkdir tmp_dir
|
||||||
`git clone #{Gitlab.config.gitolite_admin_uri} #{tmp_dir}/gitolite`
|
`git clone #{Gitlab.config.gitolite.admin_uri} #{tmp_dir}/gitolite`
|
||||||
|
|
||||||
unless File.exists?(File.join(tmp_dir, 'gitolite', 'conf', 'gitolite.conf'))
|
unless File.exists?(File.join(tmp_dir, 'gitolite', 'conf', 'gitolite.conf'))
|
||||||
raise PullError, "unable to clone gitolite-admin repo"
|
raise PullError, "unable to clone gitolite-admin repo"
|
||||||
|
|
|
@ -15,10 +15,10 @@ module Gitlab
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
# Create new dir if missing
|
# Create new dir if missing
|
||||||
new_dir_path = File.join(Gitlab.config.git_base_path, new_dir)
|
new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir)
|
||||||
system("mkdir -m 770 #{new_dir_path}") unless File.exists?(new_dir_path)
|
system("mkdir -m 770 #{new_dir_path}") unless File.exists?(new_dir_path)
|
||||||
|
|
||||||
old_path = File.join(Gitlab.config.git_base_path, old_dir, "#{project.path}.git")
|
old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git")
|
||||||
new_path = File.join(new_dir_path, "#{project.path}.git")
|
new_path = File.join(new_dir_path, "#{project.path}.git")
|
||||||
|
|
||||||
if File.exists? new_path
|
if File.exists? new_path
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
print "\n\nMove projects from groups under groups dirs:".yellow
|
print "\n\nMove projects from groups under groups dirs:".yellow
|
||||||
git_path = Gitlab.config.git_base_path
|
git_path = Gitlab.config.gitolite.repos_path
|
||||||
|
|
||||||
Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
|
Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
|
||||||
next unless project.group
|
next unless project.group
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace :gitlab do
|
||||||
Rake::Task["gitlab:app:db_dump"].invoke
|
Rake::Task["gitlab:app:db_dump"].invoke
|
||||||
Rake::Task["gitlab:app:repo_dump"].invoke
|
Rake::Task["gitlab:app:repo_dump"].invoke
|
||||||
|
|
||||||
Dir.chdir(Gitlab.config.backup_path)
|
Dir.chdir(Gitlab.config.backup.path)
|
||||||
|
|
||||||
# saving additional informations
|
# saving additional informations
|
||||||
s = {}
|
s = {}
|
||||||
|
@ -17,7 +17,7 @@ namespace :gitlab do
|
||||||
s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"")
|
s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"")
|
||||||
s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"")
|
s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"")
|
||||||
|
|
||||||
File.open("#{Gitlab.config.backup_path}/backup_information.yml", "w+") do |file|
|
File.open("#{Gitlab.config.backup.path}/backup_information.yml", "w+") do |file|
|
||||||
file << s.to_yaml.gsub(/^---\n/,'')
|
file << s.to_yaml.gsub(/^---\n/,'')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@ namespace :gitlab do
|
||||||
|
|
||||||
# delete backups
|
# delete backups
|
||||||
print "Deleting old backups... "
|
print "Deleting old backups... "
|
||||||
if Gitlab.config.backup_keep_time > 0
|
if Gitlab.config.backup.keep_time > 0
|
||||||
file_list = Dir.glob("*_gitlab_backup.tar").map { |f| f.split(/_/).first.to_i }
|
file_list = Dir.glob("*_gitlab_backup.tar").map { |f| f.split(/_/).first.to_i }
|
||||||
file_list.sort.each do |timestamp|
|
file_list.sort.each do |timestamp|
|
||||||
if Time.at(timestamp) < (Time.now - Gitlab.config.backup_keep_time)
|
if Time.at(timestamp) < (Time.now - Gitlab.config.backup.keep_time)
|
||||||
%x{rm #{timestamp}_gitlab_backup.tar}
|
%x{rm #{timestamp}_gitlab_backup.tar}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -55,7 +55,7 @@ namespace :gitlab do
|
||||||
# Restore backup of GitLab system
|
# Restore backup of GitLab system
|
||||||
desc "GITLAB | Restore a previously created backup"
|
desc "GITLAB | Restore a previously created backup"
|
||||||
task :backup_restore => :environment do
|
task :backup_restore => :environment do
|
||||||
Dir.chdir(Gitlab.config.backup_path)
|
Dir.chdir(Gitlab.config.backup.path)
|
||||||
|
|
||||||
# check for existing backups in the backup dir
|
# check for existing backups in the backup dir
|
||||||
file_list = Dir.glob("*_gitlab_backup.tar").each.map { |f| f.split(/_/).first.to_i }
|
file_list = Dir.glob("*_gitlab_backup.tar").each.map { |f| f.split(/_/).first.to_i }
|
||||||
|
@ -111,7 +111,7 @@ namespace :gitlab do
|
||||||
################################# REPOSITORIES #################################
|
################################# REPOSITORIES #################################
|
||||||
|
|
||||||
task :repo_dump => :environment do
|
task :repo_dump => :environment do
|
||||||
backup_path_repo = File.join(Gitlab.config.backup_path, "repositories")
|
backup_path_repo = File.join(Gitlab.config.backup.path, "repositories")
|
||||||
FileUtils.mkdir_p(backup_path_repo) until Dir.exists?(backup_path_repo)
|
FileUtils.mkdir_p(backup_path_repo) until Dir.exists?(backup_path_repo)
|
||||||
puts "Dumping repositories:"
|
puts "Dumping repositories:"
|
||||||
project = Project.all.map { |n| [n.path, n.path_to_repo] }
|
project = Project.all.map { |n| [n.path, n.path_to_repo] }
|
||||||
|
@ -127,7 +127,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
task :repo_restore => :environment do
|
task :repo_restore => :environment do
|
||||||
backup_path_repo = File.join(Gitlab.config.backup_path, "repositories")
|
backup_path_repo = File.join(Gitlab.config.backup.path, "repositories")
|
||||||
puts "Restoring repositories:"
|
puts "Restoring repositories:"
|
||||||
project = Project.all.map { |n| [n.path, n.path_to_repo] }
|
project = Project.all.map { |n| [n.path, n.path_to_repo] }
|
||||||
project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")]
|
project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")]
|
||||||
|
@ -136,8 +136,8 @@ namespace :gitlab do
|
||||||
FileUtils.rm_rf(project.second) if File.dirname(project.second) # delete old stuff
|
FileUtils.rm_rf(project.second) if File.dirname(project.second) # delete old stuff
|
||||||
if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1")
|
if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1")
|
||||||
permission_commands = [
|
permission_commands = [
|
||||||
"sudo chmod -R g+rwX #{Gitlab.config.git_base_path}",
|
"sudo chmod -R g+rwX #{Gitlab.config.gitolite.repos_path}",
|
||||||
"sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}"
|
"sudo chown -R #{Gitlab.config.gitolite.ssh_user}:#{Gitlab.config.gitolite.ssh_user} #{Gitlab.config.gitolite.repos_path}"
|
||||||
]
|
]
|
||||||
permission_commands.each { |command| Kernel.system(command) }
|
permission_commands.each { |command| Kernel.system(command) }
|
||||||
puts "[DONE]".green
|
puts "[DONE]".green
|
||||||
|
@ -150,7 +150,7 @@ namespace :gitlab do
|
||||||
###################################### DB ######################################
|
###################################### DB ######################################
|
||||||
|
|
||||||
task :db_dump => :environment do
|
task :db_dump => :environment do
|
||||||
backup_path_db = File.join(Gitlab.config.backup_path, "db")
|
backup_path_db = File.join(Gitlab.config.backup.path, "db")
|
||||||
FileUtils.mkdir_p(backup_path_db) unless Dir.exists?(backup_path_db)
|
FileUtils.mkdir_p(backup_path_db) unless Dir.exists?(backup_path_db)
|
||||||
|
|
||||||
puts "Dumping database tables:"
|
puts "Dumping database tables:"
|
||||||
|
@ -170,7 +170,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
task :db_restore=> :environment do
|
task :db_restore=> :environment do
|
||||||
backup_path_db = File.join(Gitlab.config.backup_path, "db")
|
backup_path_db = File.join(Gitlab.config.backup.path, "db")
|
||||||
|
|
||||||
puts "Restoring database tables:"
|
puts "Restoring database tables:"
|
||||||
Rake::Task["db:reset"].invoke
|
Rake::Task["db:reset"].invoke
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_gitlab_config_not_outdated
|
def check_gitlab_config_not_outdated
|
||||||
print "GitLab config not outdated? ... "
|
print "GitLab config outdated? ... "
|
||||||
|
|
||||||
gitlab_config_file = Rails.root.join("config", "gitlab.yml")
|
gitlab_config_file = Rails.root.join("config", "gitlab.yml")
|
||||||
unless File.exists?(gitlab_config_file)
|
unless File.exists?(gitlab_config_file)
|
||||||
|
@ -98,11 +98,12 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
# omniauth or ldap could have been deleted from the file
|
# omniauth or ldap could have been deleted from the file
|
||||||
if File.read(gitlab_config_file) =~ /^web:/
|
unless Gitlab.config.pre_40_config
|
||||||
puts "yes".green
|
puts "no".green
|
||||||
else
|
else
|
||||||
puts "no".red
|
puts "yes".red
|
||||||
try_fixing_it(
|
try_fixing_it(
|
||||||
|
"Backup your config/gitlab.yml",
|
||||||
"Copy config/gitlab.yml.example to config/gitlab.yml",
|
"Copy config/gitlab.yml.example to config/gitlab.yml",
|
||||||
"Update config/gitlab.yml to match your setup"
|
"Update config/gitlab.yml to match your setup"
|
||||||
)
|
)
|
||||||
|
@ -268,7 +269,7 @@ namespace :gitlab do
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
"user.name" => "GitLab",
|
"user.name" => "GitLab",
|
||||||
"user.email" => Gitlab.config.email_from
|
"user.email" => Gitlab.config.gitlab.email_from
|
||||||
}
|
}
|
||||||
correct_options = options.map do |name, value|
|
correct_options = options.map do |name, value|
|
||||||
run("git config --global --get #{name}").try(:squish) == value
|
run("git config --global --get #{name}").try(:squish) == value
|
||||||
|
@ -290,7 +291,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_gitlab_in_git_group
|
def check_gitlab_in_git_group
|
||||||
gitolite_ssh_user = Gitlab.config.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
print "gitlab user is in #{gitolite_ssh_user} group? ... "
|
print "gitlab user is in #{gitolite_ssh_user} group? ... "
|
||||||
|
|
||||||
if run_and_match("id -rnG", /\Wgit\W/)
|
if run_and_match("id -rnG", /\Wgit\W/)
|
||||||
|
@ -309,10 +310,10 @@ namespace :gitlab do
|
||||||
|
|
||||||
# see https://github.com/gitlabhq/gitlabhq/issues/1059
|
# see https://github.com/gitlabhq/gitlabhq/issues/1059
|
||||||
def check_issue_1056_shell_profile_error
|
def check_issue_1056_shell_profile_error
|
||||||
gitolite_ssh_user = Gitlab.config.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
|
print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
|
||||||
|
|
||||||
profile_file = File.expand_path("~#{Gitlab.config.ssh_user}/.profile")
|
profile_file = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.profile")
|
||||||
|
|
||||||
unless File.read(profile_file) =~ /^-e PATH/
|
unless File.read(profile_file) =~ /^-e PATH/
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
|
@ -414,7 +415,7 @@ namespace :gitlab do
|
||||||
|
|
||||||
test_path = "/tmp/gitlab_gitolite_admin_test"
|
test_path = "/tmp/gitlab_gitolite_admin_test"
|
||||||
FileUtils.rm_rf(test_path)
|
FileUtils.rm_rf(test_path)
|
||||||
`git clone -q #{Gitlab.config.gitolite_admin_uri} #{test_path}`
|
`git clone -q #{Gitlab.config.gitolite.admin_uri} #{test_path}`
|
||||||
raise unless $?.success?
|
raise unless $?.success?
|
||||||
|
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
|
@ -423,7 +424,7 @@ namespace :gitlab do
|
||||||
try_fixing_it(
|
try_fixing_it(
|
||||||
"Make sure the \"admin_uri\" is set correctly in config/gitlab.yml",
|
"Make sure the \"admin_uri\" is set correctly in config/gitlab.yml",
|
||||||
"Try cloning it yourself with:",
|
"Try cloning it yourself with:",
|
||||||
" git clone -q #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite-admin",
|
" git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin",
|
||||||
"Make sure Gitolite is installed correctly."
|
"Make sure Gitolite is installed correctly."
|
||||||
)
|
)
|
||||||
for_more_information(
|
for_more_information(
|
||||||
|
@ -452,7 +453,7 @@ namespace :gitlab do
|
||||||
puts "no".red
|
puts "no".red
|
||||||
try_fixing_it(
|
try_fixing_it(
|
||||||
"Try committing to it yourself with:",
|
"Try committing to it yourself with:",
|
||||||
" git clone -q #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite-admin",
|
" git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin",
|
||||||
" touch foo",
|
" touch foo",
|
||||||
" git add foo",
|
" git add foo",
|
||||||
" git commit -m \"foo\"",
|
" git commit -m \"foo\"",
|
||||||
|
@ -469,7 +470,7 @@ namespace :gitlab do
|
||||||
def check_dot_gitolite_exists
|
def check_dot_gitolite_exists
|
||||||
print "Config directory exists? ... "
|
print "Config directory exists? ... "
|
||||||
|
|
||||||
gitolite_config_path = File.expand_path("~#{Gitlab.config.ssh_user}/.gitolite")
|
gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite")
|
||||||
|
|
||||||
if File.directory?(gitolite_config_path)
|
if File.directory?(gitolite_config_path)
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
|
@ -490,7 +491,7 @@ namespace :gitlab do
|
||||||
def check_dot_gitolite_permissions
|
def check_dot_gitolite_permissions
|
||||||
print "Config directory access is drwxr-x---? ... "
|
print "Config directory access is drwxr-x---? ... "
|
||||||
|
|
||||||
gitolite_config_path = File.expand_path("~#{Gitlab.config.ssh_user}/.gitolite")
|
gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite")
|
||||||
unless File.exists?(gitolite_config_path)
|
unless File.exists?(gitolite_config_path)
|
||||||
puts "can't check because of previous errors".magenta
|
puts "can't check because of previous errors".magenta
|
||||||
return
|
return
|
||||||
|
@ -512,7 +513,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_dot_gitolite_user_and_group
|
def check_dot_gitolite_user_and_group
|
||||||
gitolite_ssh_user = Gitlab.config.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_ssh_user} ... "
|
print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_ssh_user} ... "
|
||||||
|
|
||||||
gitolite_config_path = File.expand_path("~#{gitolite_ssh_user}/.gitolite")
|
gitolite_config_path = File.expand_path("~#{gitolite_ssh_user}/.gitolite")
|
||||||
|
@ -615,9 +616,9 @@ namespace :gitlab do
|
||||||
print "post-receive hook exists? ... "
|
print "post-receive hook exists? ... "
|
||||||
|
|
||||||
hook_file = "post-receive"
|
hook_file = "post-receive"
|
||||||
gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
|
gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
|
||||||
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
|
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
|
||||||
gitolite_ssh_user = Gitlab.config.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
|
|
||||||
gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)
|
gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)
|
||||||
|
|
||||||
|
@ -639,10 +640,10 @@ namespace :gitlab do
|
||||||
print "post-receive hook up-to-date? ... "
|
print "post-receive hook up-to-date? ... "
|
||||||
|
|
||||||
hook_file = "post-receive"
|
hook_file = "post-receive"
|
||||||
gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
|
gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
|
||||||
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
|
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
|
||||||
gitolite_hook_content = File.read(gitolite_hook_file)
|
gitolite_hook_content = File.read(gitolite_hook_file)
|
||||||
gitolite_ssh_user = Gitlab.config.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
|
|
||||||
unless File.exists?(gitolite_hook_file)
|
unless File.exists?(gitolite_hook_file)
|
||||||
puts "can't check because of previous errors".magenta
|
puts "can't check because of previous errors".magenta
|
||||||
|
@ -669,7 +670,7 @@ namespace :gitlab do
|
||||||
def check_repo_base_exists
|
def check_repo_base_exists
|
||||||
print "Repo base directory exists? ... "
|
print "Repo base directory exists? ... "
|
||||||
|
|
||||||
repo_base_path = Gitlab.config.git_base_path
|
repo_base_path = Gitlab.config.gitolite.repos_path
|
||||||
|
|
||||||
if File.exists?(repo_base_path)
|
if File.exists?(repo_base_path)
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
|
@ -691,7 +692,7 @@ namespace :gitlab do
|
||||||
def check_repo_base_permissions
|
def check_repo_base_permissions
|
||||||
print "Repo base access is drwsrws---? ... "
|
print "Repo base access is drwsrws---? ... "
|
||||||
|
|
||||||
repo_base_path = Gitlab.config.git_base_path
|
repo_base_path = Gitlab.config.gitolite.repos_path
|
||||||
unless File.exists?(repo_base_path)
|
unless File.exists?(repo_base_path)
|
||||||
puts "can't check because of previous errors".magenta
|
puts "can't check because of previous errors".magenta
|
||||||
return
|
return
|
||||||
|
@ -713,10 +714,10 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_repo_base_user_and_group
|
def check_repo_base_user_and_group
|
||||||
gitolite_ssh_user = Gitlab.config.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_ssh_user}? ... "
|
print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_ssh_user}? ... "
|
||||||
|
|
||||||
repo_base_path = Gitlab.config.git_base_path
|
repo_base_path = Gitlab.config.gitolite.repos_path
|
||||||
unless File.exists?(repo_base_path)
|
unless File.exists?(repo_base_path)
|
||||||
puts "can't check because of previous errors".magenta
|
puts "can't check because of previous errors".magenta
|
||||||
return
|
return
|
||||||
|
@ -777,9 +778,9 @@ namespace :gitlab do
|
||||||
print "post-receive hooks in repos are links: ... "
|
print "post-receive hooks in repos are links: ... "
|
||||||
|
|
||||||
hook_file = "post-receive"
|
hook_file = "post-receive"
|
||||||
gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
|
gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
|
||||||
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
|
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
|
||||||
gitolite_ssh_user = Gitlab.config.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
|
|
||||||
unless File.exists?(gitolite_hook_file)
|
unless File.exists?(gitolite_hook_file)
|
||||||
puts "can't check because of previous errors".magenta
|
puts "can't check because of previous errors".magenta
|
||||||
|
@ -828,7 +829,7 @@ namespace :gitlab do
|
||||||
########################
|
########################
|
||||||
|
|
||||||
def gitolite_home
|
def gitolite_home
|
||||||
File.expand_path("~#{Gitlab.config.ssh_user}")
|
File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def gitolite_version
|
def gitolite_version
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace :gitlab do
|
||||||
desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
|
desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
|
||||||
task :repos => :environment do
|
task :repos => :environment do
|
||||||
|
|
||||||
git_base_path = Gitlab.config.git_base_path
|
git_base_path = Gitlab.config.gitolite.repos_path
|
||||||
repos_to_import = Dir.glob(git_base_path + '/*')
|
repos_to_import = Dir.glob(git_base_path + '/*')
|
||||||
|
|
||||||
repos_to_import.each do |repo_path|
|
repos_to_import.each do |repo_path|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace :gitlab do
|
||||||
http_clone_url = project.http_url_to_repo
|
http_clone_url = project.http_url_to_repo
|
||||||
ssh_clone_url = project.ssh_url_to_repo
|
ssh_clone_url = project.ssh_url_to_repo
|
||||||
|
|
||||||
omniauth_providers = Gitlab.config.omniauth_providers
|
omniauth_providers = Gitlab.config.omniauth.providers
|
||||||
omniauth_providers.map! { |provider| provider['name'] }
|
omniauth_providers.map! { |provider| provider['name'] }
|
||||||
|
|
||||||
puts ""
|
puts ""
|
||||||
|
@ -55,17 +55,17 @@ namespace :gitlab do
|
||||||
puts "Revision:\t#{Gitlab::Revision}"
|
puts "Revision:\t#{Gitlab::Revision}"
|
||||||
puts "Directory:\t#{Rails.root}"
|
puts "Directory:\t#{Rails.root}"
|
||||||
puts "DB Adapter:\t#{database_adapter}"
|
puts "DB Adapter:\t#{database_adapter}"
|
||||||
puts "URL:\t\t#{Gitlab.config.url}"
|
puts "URL:\t\t#{Gitlab.config.gitlab.url}"
|
||||||
puts "HTTP Clone URL:\t#{http_clone_url}"
|
puts "HTTP Clone URL:\t#{http_clone_url}"
|
||||||
puts "SSH Clone URL:\t#{ssh_clone_url}"
|
puts "SSH Clone URL:\t#{ssh_clone_url}"
|
||||||
puts "Using LDAP:\t#{Gitlab.config.ldap_enabled? ? "yes".green : "no"}"
|
puts "Using LDAP:\t#{Gitlab.config.ldap.enabled ? "yes".green : "no"}"
|
||||||
puts "Using Omniauth:\t#{Gitlab.config.omniauth_enabled? ? "yes".green : "no"}"
|
puts "Using Omniauth:\t#{Gitlab.config.omniauth.enabled ? "yes".green : "no"}"
|
||||||
puts "Omniauth Providers: #{omniauth_providers.map(&:magenta).join(', ')}" if Gitlab.config.omniauth_enabled?
|
puts "Omniauth Providers: #{omniauth_providers.map(&:magenta).join(', ')}" if Gitlab.config.omniauth.enabled
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# check Gitolite version
|
# check Gitolite version
|
||||||
gitolite_version_file = "#{Gitlab.config.git_base_path}/../gitolite/src/VERSION"
|
gitolite_version_file = "#{Gitlab.config.gitolite.repos_path}/../gitolite/src/VERSION"
|
||||||
if File.exists?(gitolite_version_file) && File.readable?(gitolite_version_file)
|
if File.exists?(gitolite_version_file) && File.readable?(gitolite_version_file)
|
||||||
gitolite_version = File.read(gitolite_version_file)
|
gitolite_version = File.read(gitolite_version_file)
|
||||||
end
|
end
|
||||||
|
@ -73,11 +73,11 @@ namespace :gitlab do
|
||||||
puts ""
|
puts ""
|
||||||
puts "Gitolite information".yellow
|
puts "Gitolite information".yellow
|
||||||
puts "Version:\t#{gitolite_version || "unknown".red}"
|
puts "Version:\t#{gitolite_version || "unknown".red}"
|
||||||
puts "Admin URI:\t#{Gitlab.config.gitolite_admin_uri}"
|
puts "Admin URI:\t#{Gitlab.config.gitolite.admin_uri}"
|
||||||
puts "Admin Key:\t#{Gitlab.config.gitolite_admin_key}"
|
puts "Admin Key:\t#{Gitlab.config.gitolite.admin_key}"
|
||||||
puts "Repositories:\t#{Gitlab.config.git_base_path}"
|
puts "Repositories:\t#{Gitlab.config.gitolite.repos_path}"
|
||||||
puts "Hooks:\t\t#{Gitlab.config.git_hooks_path}"
|
puts "Hooks:\t\t#{Gitlab.config.gitolite.hooks_path}"
|
||||||
puts "Git:\t\t#{Gitlab.config.git.path}"
|
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe ApplicationHelper do
|
||||||
let(:user_email) { 'user@email.com' }
|
let(:user_email) { 'user@email.com' }
|
||||||
|
|
||||||
it "should return a generic avatar path when Gravatar is disabled" do
|
it "should return a generic avatar path when Gravatar is disabled" do
|
||||||
Gitlab.config.stub(:disable_gravatar?).and_return(true)
|
Gitlab.config.gravatar.stub(:enabled).and_return(false)
|
||||||
gravatar_icon(user_email).should == 'no_avatar.png'
|
gravatar_icon(user_email).should == 'no_avatar.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ describe ApplicationHelper do
|
||||||
|
|
||||||
it "should return custom gravatar path when gravatar_url is set" do
|
it "should return custom gravatar path when gravatar_url is set" do
|
||||||
stub!(:request).and_return(double(:ssl? => false))
|
stub!(:request).and_return(double(:ssl? => false))
|
||||||
Gitlab.config.stub(:gravatar_url).and_return('http://example.local/?s=%{size}&hash=%{hash}')
|
Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}')
|
||||||
gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
|
gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe Gitlab::Gitolite do
|
||||||
it { should respond_to :create_repository }
|
it { should respond_to :create_repository }
|
||||||
it { should respond_to :remove_repository }
|
it { should respond_to :remove_repository }
|
||||||
|
|
||||||
it { gitolite.url_to_repo('diaspora').should == Gitlab.config.ssh_path + "diaspora.git" }
|
it { gitolite.url_to_repo('diaspora').should == Gitlab.config.gitolite.ssh_path_prefix + "diaspora.git" }
|
||||||
|
|
||||||
it "should call config update" do
|
it "should call config update" do
|
||||||
gitolite_config.should_receive(:update_project!)
|
gitolite_config.should_receive(:update_project!)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe Gitlab::ProjectMover do
|
||||||
before do
|
before do
|
||||||
FileUtils.rm_rf base_path if File.exists? base_path
|
FileUtils.rm_rf base_path if File.exists? base_path
|
||||||
|
|
||||||
Gitlab.config.stub(git_base_path: base_path)
|
Gitlab.config.gitolite.stub(repos_path: base_path)
|
||||||
|
|
||||||
@project = create(:project)
|
@project = create(:project)
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,7 +108,7 @@ describe Project, "Hooks" do
|
||||||
it { should include(id: @commit.id) }
|
it { should include(id: @commit.id) }
|
||||||
it { should include(message: @commit.safe_message) }
|
it { should include(message: @commit.safe_message) }
|
||||||
it { should include(timestamp: @commit.date.xmlschema) }
|
it { should include(timestamp: @commit.date.xmlschema) }
|
||||||
it { should include(url: "#{Gitlab.config.url}/#{project.code}/commit/#{@commit.id}") }
|
it { should include(url: "#{Gitlab.config.gitlab.url}/#{project.code}/commit/#{@commit.id}") }
|
||||||
|
|
||||||
context "with a author" do
|
context "with a author" do
|
||||||
subject { @data[:commits].first[:author] }
|
subject { @data[:commits].first[:author] }
|
||||||
|
|
|
@ -148,7 +148,7 @@ describe Project do
|
||||||
|
|
||||||
it "should return valid url to repo" do
|
it "should return valid url to repo" do
|
||||||
project = Project.new(path: "somewhere")
|
project = Project.new(path: "somewhere")
|
||||||
project.url_to_repo.should == Gitlab.config.ssh_path + "somewhere.git"
|
project.url_to_repo.should == Gitlab.config.gitolite.ssh_path_prefix + "somewhere.git"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return path to repo" do
|
it "should return path to repo" do
|
||||||
|
@ -158,7 +158,7 @@ describe Project do
|
||||||
|
|
||||||
it "returns the full web URL for this repo" do
|
it "returns the full web URL for this repo" do
|
||||||
project = Project.new(path: "somewhere")
|
project = Project.new(path: "somewhere")
|
||||||
project.web_url.should == "#{Gitlab.config.url}/somewhere"
|
project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "last_activity methods" do
|
describe "last_activity methods" do
|
||||||
|
|
|
@ -42,8 +42,8 @@ RSpec.configure do |config|
|
||||||
# ActiveRecord::Base.observers.enable(:all)
|
# ActiveRecord::Base.observers.enable(:all)
|
||||||
|
|
||||||
# Use tmp dir for FS manipulations
|
# Use tmp dir for FS manipulations
|
||||||
Gitlab.config.stub(git_base_path: Rails.root.join('tmp', 'test-git-base-path'))
|
Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
|
||||||
FileUtils.rm_rf Gitlab.config.git_base_path
|
FileUtils.rm_rf Gitlab.config.gitolite.repos_path
|
||||||
FileUtils.mkdir_p Gitlab.config.git_base_path
|
FileUtils.mkdir_p Gitlab.config.gitolite.repos_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,6 +39,6 @@ describe PostReceive do
|
||||||
end
|
end
|
||||||
|
|
||||||
def pwd(project)
|
def pwd(project)
|
||||||
File.join(Gitlab.config.git_base_path, project.path_with_namespace)
|
File.join(Gitlab.config.gitolite.repos_path, project.path_with_namespace)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue