Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
19eb6374
Commit
19eb6374
authored
Dec 15, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update uses of Gitolite.config.foo settings
parent
b2e46f44
Changes
33
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
95 additions
and
95 deletions
+95
-95
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-1
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+1
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+2
-2
app/mailers/notify.rb
app/mailers/notify.rb
+4
-4
app/models/namespace.rb
app/models/namespace.rb
+4
-4
app/models/project.rb
app/models/project.rb
+1
-1
app/roles/push_observer.rb
app/roles/push_observer.rb
+1
-1
app/roles/repository.rb
app/roles/repository.rb
+2
-2
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+1
-1
app/views/errors/gitolite.html.haml
app/views/errors/gitolite.html.haml
+2
-2
app/views/profiles/account.html.haml
app/views/profiles/account.html.haml
+1
-1
app/views/profiles/show.html.haml
app/views/profiles/show.html.haml
+1
-1
app/views/shared/_clone_panel.html.haml
app/views/shared/_clone_panel.html.haml
+1
-1
app/workers/post_receive.rb
app/workers/post_receive.rb
+2
-2
config/initializers/3_grit_ext.rb
config/initializers/3_grit_ext.rb
+2
-2
config/initializers/devise.rb
config/initializers/devise.rb
+1
-1
config/routes.rb
config/routes.rb
+4
-4
features/support/env.rb
features/support/env.rb
+3
-3
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+1
-1
lib/gitlab/backend/gitolite.rb
lib/gitlab/backend/gitolite.rb
+1
-1
lib/gitlab/backend/gitolite_config.rb
lib/gitlab/backend/gitolite_config.rb
+3
-3
lib/gitlab/project_mover.rb
lib/gitlab/project_mover.rb
+2
-2
lib/tasks/gitlab/activate_namespaces.rake
lib/tasks/gitlab/activate_namespaces.rake
+1
-1
lib/tasks/gitlab/backup.rake
lib/tasks/gitlab/backup.rake
+11
-11
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+21
-21
lib/tasks/gitlab/import.rake
lib/tasks/gitlab/import.rake
+1
-1
lib/tasks/gitlab/info.rake
lib/tasks/gitlab/info.rake
+11
-11
spec/lib/gitolite_spec.rb
spec/lib/gitolite_spec.rb
+1
-1
spec/lib/project_mover_spec.rb
spec/lib/project_mover_spec.rb
+1
-1
spec/models/project_hooks_spec.rb
spec/models/project_hooks_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-2
spec/spec_helper.rb
spec/spec_helper.rb
+3
-3
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+1
-1
No files found.
app/controllers/admin/users_controller.rb
View file @
19eb6374
...
...
@@ -30,7 +30,7 @@ class Admin::UsersController < AdminController
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
def
edit
...
...
app/controllers/omniauth_callbacks_controller.rb
View file @
19eb6374
class
OmniauthCallbacksController
<
Devise
::
OmniauthCallbacksController
Gitlab
.
config
.
omniauth
_
providers
.
each
do
|
provider
|
Gitlab
.
config
.
omniauth
.
providers
.
each
do
|
provider
|
define_method
provider
[
'name'
]
do
handle_omniauth
end
...
...
app/helpers/application_helper.rb
View file @
19eb6374
...
...
@@ -37,7 +37,7 @@ module ApplicationHelper
if
Gitlab
.
config
.
disable_gravatar?
||
user_email
.
blank?
'no_avatar.png'
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!
sprintf
(
gravatar_url
,
{
:hash
=>
Digest
::
MD5
.
hexdigest
(
user_email
.
downcase
),
:email
=>
URI
.
escape
(
user_email
),
:size
=>
size
})
end
...
...
@@ -48,7 +48,7 @@ module ApplicationHelper
end
def
web_app_url
"
#{
request_protocol
}
://
#{
Gitlab
.
config
.
web_
host
}
/"
"
#{
request_protocol
}
://
#{
Gitlab
.
config
.
gitlab
.
host
}
/"
end
def
last_commit
(
project
)
...
...
app/mailers/notify.rb
View file @
19eb6374
...
...
@@ -3,11 +3,11 @@ class Notify < ActionMailer::Base
add_template_helper
ApplicationHelper
add_template_helper
GitlabMarkdownHelper
default_url_options
[
:host
]
=
Gitlab
.
config
.
web_
host
default_url_options
[
:protocol
]
=
Gitlab
.
config
.
web_
protocol
default_url_options
[
:port
]
=
Gitlab
.
config
.
web_port
if
Gitlab
.
config
.
web_custom
_port?
default_url_options
[
:host
]
=
Gitlab
.
config
.
gitlab
.
host
default_url_options
[
:protocol
]
=
Gitlab
.
config
.
gitlab
.
protocol
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
...
...
app/models/namespace.rb
View file @
19eb6374
...
...
@@ -48,14 +48,14 @@ class Namespace < ActiveRecord::Base
end
def
ensure_dir_exist
namespace_dir_path
=
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
path
)
namespace_dir_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
path
)
system
(
"mkdir -m 770
#{
namespace_dir_path
}
"
)
unless
File
.
exists?
(
namespace_dir_path
)
end
def
move_dir
if
path_changed?
old_path
=
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
path_was
)
new_path
=
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
path
)
old_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
path_was
)
new_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
path
)
if
File
.
exists?
(
new_path
)
raise
"Already exists"
end
...
...
@@ -64,7 +64,7 @@ class Namespace < ActiveRecord::Base
end
def
rm_dir
dir_path
=
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
path
)
dir_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
path
)
system
(
"rm -rf
#{
dir_path
}
"
)
end
end
app/models/project.rb
View file @
19eb6374
...
...
@@ -195,7 +195,7 @@ class Project < ActiveRecord::Base
end
def
web_url
[
Gitlab
.
config
.
url
,
path_with_namespace
].
join
(
"/"
)
[
Gitlab
.
config
.
gitlab
.
url
,
path_with_namespace
].
join
(
"/"
)
end
def
common_notes
...
...
app/roles/push_observer.rb
View file @
19eb6374
...
...
@@ -114,7 +114,7 @@ module PushObserver
id:
commit
.
id
,
message:
commit
.
safe_message
,
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:
{
name:
commit
.
author_name
,
email:
commit
.
author_email
...
...
app/roles/repository.rb
View file @
19eb6374
...
...
@@ -97,7 +97,7 @@ module Repository
end
def
path_to_repo
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
"
#{
path_with_namespace
}
.git"
)
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
"
#{
path_with_namespace
}
.git"
)
end
def
namespace_dir
...
...
@@ -199,7 +199,7 @@ module Repository
end
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
# Check if current branch name is marked as protected in the system
...
...
app/views/admin/groups/show.html.haml
View file @
19eb6374
...
...
@@ -22,7 +22,7 @@
%b
Path:
%td
%span
.monospace
=
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
@group
.
path
)
%span
.monospace
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
@group
.
path
)
%tr
%td
%b
...
...
app/views/errors/gitolite.html.haml
View file @
19eb6374
...
...
@@ -21,5 +21,5 @@
Permissions:
%pre
=
preserve
do
sudo chown -R git:git
#{
Gitlab
.
config
.
git
_base
_path
}
sudo chmod -R ug+rwXs
#{
Gitlab
.
config
.
git
_base
_path
}
sudo chown -R git:git
#{
Gitlab
.
config
.
git
olite
.
repos
_path
}
sudo chmod -R ug+rwXs
#{
Gitlab
.
config
.
git
olite
.
repos
_path
}
app/views/profiles/account.html.haml
View file @
19eb6374
-
if
Gitlab
.
config
.
omniauth
_enabled?
-
if
Gitlab
.
config
.
omniauth
.
enabled
%fieldset
%legend
Social Accounts
.oauth_select_holder
...
...
app/views/profiles/show.html.haml
View file @
19eb6374
...
...
@@ -37,7 +37,7 @@
%li
%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
%p
You can login through
#{
@user
.
provider
.
titleize
}
!
...
...
app/views/shared/_clone_panel.html.haml
View file @
19eb6374
.input-prepend.project_clone_holder
%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"
app/workers/post_receive.rb
View file @
19eb6374
...
...
@@ -2,7 +2,7 @@ class PostReceive
@queue
=
:post_receive
def
self
.
perform
(
repo_path
,
oldrev
,
newrev
,
ref
,
identifier
)
repo_path
.
gsub!
(
Gitlab
.
config
.
git
_base
_path
.
to_s
,
""
)
repo_path
.
gsub!
(
Gitlab
.
config
.
git
olite
.
repos
_path
.
to_s
,
""
)
repo_path
.
gsub!
(
/.git$/
,
""
)
repo_path
.
gsub!
(
/^\//
,
""
)
...
...
@@ -10,7 +10,7 @@ class PostReceive
return
false
if
project
.
nil?
# 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
User
.
find_by_email
(
email
)
if
email
elsif
/^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/
.
match
(
identifier
)
...
...
config/initializers/3_grit_ext.rb
View file @
19eb6374
require
'grit'
require
'pygments'
Grit
::
Git
.
git_timeout
=
Gitlab
.
config
.
git
_
timeout
Grit
::
Git
.
git_max_size
=
Gitlab
.
config
.
git
_
max_size
Grit
::
Git
.
git_timeout
=
Gitlab
.
config
.
git
.
timeout
Grit
::
Git
.
git_max_size
=
Gitlab
.
config
.
git
.
max_size
Grit
::
Blob
.
class_eval
do
include
Linguist
::
BlobHelper
...
...
config/initializers/devise.rb
View file @
19eb6374
...
...
@@ -4,7 +4,7 @@ Devise.setup do |config|
# ==> Mailer Configuration
# 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.
config
.
mailer_sender
=
Gitlab
.
config
.
email_from
config
.
mailer_sender
=
Gitlab
.
config
.
gitlab
.
email_from
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
...
...
config/routes.rb
View file @
19eb6374
...
...
@@ -14,10 +14,10 @@ Gitlab::Application.routes.draw do
# Enable Grack support
mount
Grack
::
Bundle
.
new
({
git_path:
Gitlab
.
config
.
git
_
bin_path
,
project_root:
Gitlab
.
config
.
git
_base
_path
,
upload_pack:
Gitlab
.
config
.
git
_
upload_pack
,
receive_pack:
Gitlab
.
config
.
git
_
receive_pack
git_path:
Gitlab
.
config
.
git
.
bin_path
,
project_root:
Gitlab
.
config
.
git
olite
.
repos
_path
,
upload_pack:
Gitlab
.
config
.
git
olite
.
upload_pack
,
receive_pack:
Gitlab
.
config
.
git
olite
.
receive_pack
}),
at:
'/:path'
,
constraints:
{
path:
/[-\/\w\.-]+\.git/
}
#
...
...
features/support/env.rb
View file @
19eb6374
...
...
@@ -33,9 +33,9 @@ DatabaseCleaner.strategy = :truncation
Spinach
.
hooks
.
before_scenario
do
# Use tmp dir for FS manipulations
Gitlab
.
config
.
stub
(
git_base
_path:
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
))
FileUtils
.
rm_rf
Gitlab
.
config
.
git
_base
_path
FileUtils
.
mkdir_p
Gitlab
.
config
.
git
_base
_path
Gitlab
.
config
.
gitolite
.
stub
(
repos
_path:
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
))
FileUtils
.
rm_rf
Gitlab
.
config
.
git
olite
.
repos
_path
FileUtils
.
mkdir_p
Gitlab
.
config
.
git
olite
.
repos
_path
end
Spinach
.
hooks
.
after_scenario
do
...
...
lib/gitlab/auth.rb
View file @
19eb6374
...
...
@@ -38,7 +38,7 @@ module Gitlab
email:
email
,
password:
password
,
password_confirmation:
password
,
projects_limit:
Gitlab
.
config
.
default_projects_limit
,
projects_limit:
Gitlab
.
config
.
gitlab
.
default_projects_limit
,
},
as: :admin
)
if
Gitlab
.
config
.
omniauth
[
'block_auto_created_users'
]
&&
!
ldap
@user
.
blocked
=
true
...
...
lib/gitlab/backend/gitolite.rb
View file @
19eb6374
...
...
@@ -38,7 +38,7 @@ module Gitlab
end
def
url_to_repo
path
Gitlab
.
config
.
ssh_path
+
"
#{
path
}
.git"
Gitlab
.
config
.
gitolite
.
ssh_path_prefix
+
"
#{
path
}
.git"
end
def
enable_automerge
...
...
lib/gitlab/backend/gitolite_config.rb
View file @
19eb6374
...
...
@@ -16,7 +16,7 @@ module Gitlab
def
ga_repo
@ga_repo
||=
::
Gitolite
::
GitoliteAdmin
.
new
(
File
.
join
(
config_tmp_dir
,
'gitolite'
),
conf:
Gitlab
.
config
.
gitolite
_
config_file
conf:
Gitlab
.
config
.
gitolite
.
config_file
)
end
...
...
@@ -167,7 +167,7 @@ module Gitlab
# Enable access to all repos for gitolite admin.
# We use it for accept merge request feature
def
admin_all_repo
owner_name
=
Gitlab
.
config
.
gitolite
_
admin_key
owner_name
=
Gitlab
.
config
.
gitolite
.
admin_key
# @ALL repos premission for gitolite owner
repo_name
=
"@all"
...
...
@@ -189,7 +189,7 @@ module Gitlab
def
pull
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'
))
raise
PullError
,
"unable to clone gitolite-admin repo"
...
...
lib/gitlab/project_mover.rb
View file @
19eb6374
...
...
@@ -15,10 +15,10 @@ module Gitlab
def
execute
# Create new dir if missing
new_dir_path
=
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
new_dir
)
new_dir_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
new_dir
)
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
.
git
olite
.
repos
_path
,
old_dir
,
"
#{
project
.
path
}
.git"
)
new_path
=
File
.
join
(
new_dir_path
,
"
#{
project
.
path
}
.git"
)
if
File
.
exists?
new_path
...
...
lib/tasks/gitlab/activate_namespaces.rake
View file @
19eb6374
...
...
@@ -27,7 +27,7 @@ namespace :gitlab do
end
print
"
\n\n
Move projects from groups under groups dirs:"
.
yellow
git_path
=
Gitlab
.
config
.
git
_base
_path
git_path
=
Gitlab
.
config
.
git
olite
.
repos
_path
Project
.
where
(
'namespace_id IS NOT NULL'
).
find_each
(
batch_size:
500
)
do
|
project
|
next
unless
project
.
group
...
...
lib/tasks/gitlab/backup.rake
View file @
19eb6374
...
...
@@ -8,7 +8,7 @@ namespace :gitlab do
Rake
::
Task
[
"gitlab:app:db_dump"
].
invoke
Rake
::
Task
[
"gitlab:app:repo_dump"
].
invoke
Dir
.
chdir
(
Gitlab
.
config
.
backup
_
path
)
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
# saving additional informations
s
=
{}
...
...
@@ -17,7 +17,7 @@ namespace :gitlab do
s
[
:gitlab_version
]
=
%x{git rev-parse HEAD}
.
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/
,
''
)
end
...
...
@@ -39,10 +39,10 @@ namespace :gitlab do
# delete 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
.
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}
end
end
...
...
@@ -55,7 +55,7 @@ namespace :gitlab do
# Restore backup of GitLab system
desc
"GITLAB | Restore a previously created backup"
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
file_list
=
Dir
.
glob
(
"*_gitlab_backup.tar"
).
each
.
map
{
|
f
|
f
.
split
(
/_/
).
first
.
to_i
}
...
...
@@ -111,7 +111,7 @@ namespace :gitlab do
################################# REPOSITORIES #################################
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
)
puts
"Dumping repositories:"
project
=
Project
.
all
.
map
{
|
n
|
[
n
.
path
,
n
.
path_to_repo
]
}
...
...
@@ -127,7 +127,7 @@ namespace :gitlab do
end
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:"
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"
)]
...
...
@@ -136,8 +136,8 @@ namespace :gitlab do
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"
)
permission_commands
=
[
"sudo chmod -R g+rwX
#{
Gitlab
.
config
.
git
_base
_path
}
"
,
"sudo chown -R
#{
Gitlab
.
config
.
ssh_user
}
:
#{
Gitlab
.
config
.
ssh_user
}
#{
Gitlab
.
config
.
git_base
_path
}
"
"sudo chmod -R g+rwX
#{
Gitlab
.
config
.
git
olite
.
repos
_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
)
}
puts
"[DONE]"
.
green
...
...
@@ -150,7 +150,7 @@ namespace :gitlab do
###################################### DB ######################################
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
)
puts
"Dumping database tables:"
...
...
@@ -170,7 +170,7 @@ namespace :gitlab do
end
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:"
Rake
::
Task
[
"db:reset"
].
invoke
...
...
lib/tasks/gitlab/check.rake
View file @
19eb6374
...
...
@@ -268,7 +268,7 @@ namespace :gitlab do
options
=
{
"user.name"
=>
"GitLab"
,
"user.email"
=>
Gitlab
.
config
.
email_from
"user.email"
=>
Gitlab
.
config
.
gitlab
.
email_from
}
correct_options
=
options
.
map
do
|
name
,
value
|
run
(
"git config --global --get
#{
name
}
"
).
try
(
:squish
)
==
value
...
...
@@ -290,7 +290,7 @@ namespace :gitlab do
end
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? ... "
if
run_and_match
(
"id -rnG"
,
/\Wgit\W/
)
...
...
@@ -309,10 +309,10 @@ namespace :gitlab do
# see https://github.com/gitlabhq/gitlabhq/issues/1059
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 ... "
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/
puts
"yes"
.
green
...
...
@@ -414,7 +414,7 @@ namespace :gitlab do
test_path
=
"/tmp/gitlab_gitolite_admin_test"
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?
puts
"yes"
.
green
...
...
@@ -423,7 +423,7 @@ namespace :gitlab do
try_fixing_it
(
"Make sure the
\"
admin_uri
\"
is set correctly in config/gitlab.yml"
,
"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."
)
for_more_information
(
...
...
@@ -452,7 +452,7 @@ namespace :gitlab do
puts
"no"
.
red
try_fixing_it
(
"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"
,
" git add foo"
,
" git commit -m
\"
foo
\"
"
,
...
...
@@ -469,7 +469,7 @@ namespace :gitlab do
def
check_dot_gitolite_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
)
puts
"yes"
.
green
...
...
@@ -490,7 +490,7 @@ namespace :gitlab do
def
check_dot_gitolite_permissions
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
)
puts
"can't check because of previous errors"
.
magenta
return
...
...
@@ -512,7 +512,7 @@ namespace :gitlab do
end
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
}
... "
gitolite_config_path
=
File
.
expand_path
(
"~
#{
gitolite_ssh_user
}
/.gitolite"
)
...
...
@@ -615,9 +615,9 @@ namespace :gitlab do
print
"post-receive hook exists? ... "
hook_file
=
"post-receive"
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git
_
hooks_path
,
"common"
)
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
hooks_path
,
"common"
)
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
)
...
...
@@ -639,10 +639,10 @@ namespace :gitlab do
print
"post-receive hook up-to-date? ... "
hook_file
=
"post-receive"
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git
_
hooks_path
,
"common"
)
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
hooks_path
,
"common"
)
gitolite_hook_file
=
File
.
join
(
gitolite_hooks_path
,
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
)
puts
"can't check because of previous errors"
.
magenta
...
...
@@ -669,7 +669,7 @@ namespace :gitlab do
def
check_repo_base_exists
print
"Repo base directory exists? ... "
repo_base_path
=
Gitlab
.
config
.
git
_base
_path
repo_base_path
=
Gitlab
.
config
.
git
olite
.
repos
_path
if
File
.
exists?
(
repo_base_path
)
puts
"yes"
.
green
...
...
@@ -691,7 +691,7 @@ namespace :gitlab do
def
check_repo_base_permissions
print
"Repo base access is drwsrws---? ... "
repo_base_path
=
Gitlab
.
config
.
git
_base
_path
repo_base_path
=
Gitlab
.
config
.
git
olite
.
repos
_path
unless
File
.
exists?
(
repo_base_path
)
puts
"can't check because of previous errors"
.
magenta
return
...
...
@@ -713,10 +713,10 @@ namespace :gitlab do
end
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
}
? ... "
repo_base_path
=
Gitlab
.
config
.
git
_base
_path
repo_base_path
=
Gitlab
.
config
.
git
olite
.
repos
_path
unless
File
.
exists?
(
repo_base_path
)
puts
"can't check because of previous errors"
.
magenta
return
...
...
@@ -777,9 +777,9 @@ namespace :gitlab do
print
"post-receive hooks in repos are links: ... "
hook_file
=
"post-receive"
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git
_
hooks_path
,
"common"
)
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git
olite
.
hooks_path
,
"common"
)
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
)
puts
"can't check because of previous errors"
.
magenta
...
...
@@ -828,7 +828,7 @@ namespace :gitlab do
########################
def
gitolite_home
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
ssh_user
}
"
)
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
gitolite
.
ssh_user
}
"
)
end
def
gitolite_version
...
...
lib/tasks/gitlab/import.rake
View file @
19eb6374
...
...
@@ -12,7 +12,7 @@ namespace :gitlab do
desc
"GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
task
:repos
=>
:environment
do
git_base_path
=
Gitlab
.
config
.
git
_base
_path
git_base_path
=
Gitlab
.
config
.
git
olite
.
repos
_path
repos_to_import
=
Dir
.
glob
(
git_base_path
+
'/*'
)
repos_to_import
.
each
do
|
repo_path
|
...
...
lib/tasks/gitlab/info.rake
View file @
19eb6374
...
...
@@ -46,7 +46,7 @@ namespace :gitlab do
http_clone_url
=
project
.
http_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'
]
}
puts
""
...
...
@@ -55,17 +55,17 @@ namespace :gitlab do
puts
"Revision:
\t
#{
Gitlab
::
Revision
}
"
puts
"Directory:
\t
#{
Rails
.
root
}
"
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
"SSH Clone URL:
\t
#{
ssh_clone_url
}
"
puts
"Using LDAP:
\t
#{
Gitlab
.
config
.
ldap
_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
"Using LDAP:
\t
#{
Gitlab
.
config
.
ldap
.
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
# check Gitolite version
gitolite_version_file
=
"
#{
Gitlab
.
config
.
git
_base
_path
}
/../gitolite/src/VERSION"
gitolite_version_file
=
"
#{
Gitlab
.
config
.
git
olite
.
repos
_path
}
/../gitolite/src/VERSION"
if
File
.
exists?
(
gitolite_version_file
)
&&
File
.
readable?
(
gitolite_version_file
)
gitolite_version
=
File
.
read
(
gitolite_version_file
)
end
...
...
@@ -73,11 +73,11 @@ namespace :gitlab do
puts
""
puts
"Gitolite information"
.
yellow
puts
"Version:
\t
#{
gitolite_version
||
"unknown"
.
red
}
"
puts
"Admin URI:
\t
#{
Gitlab
.
config
.
gitolite
_
admin_uri
}
"
puts
"Admin Key:
\t
#{
Gitlab
.
config
.
gitolite
_
admin_key
}
"
puts
"Repositories:
\t
#{
Gitlab
.
config
.
git
_base
_path
}
"
puts
"Hooks:
\t\t
#{
Gitlab
.
config
.
git
_
hooks_path
}
"
puts
"Git:
\t\t
#{
Gitlab
.
config
.
git
.
path
}
"
puts
"Admin URI:
\t
#{
Gitlab
.
config
.
gitolite
.
admin_uri
}
"
puts
"Admin Key:
\t
#{
Gitlab
.
config
.
gitolite
.
admin_key
}
"
puts
"Repositories:
\t
#{
Gitlab
.
config
.
git
olite
.
repos
_path
}
"
puts
"Hooks:
\t\t
#{
Gitlab
.
config
.
git
olite
.
hooks_path
}
"
puts
"Git:
\t\t
#{
Gitlab
.
config
.
git
.
bin_
path
}
"
end
...
...
spec/lib/gitolite_spec.rb
View file @
19eb6374
...
...
@@ -16,7 +16,7 @@ describe Gitlab::Gitolite do
it
{
should
respond_to
:create_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
gitolite_config
.
should_receive
(
:update_project!
)
...
...
spec/lib/project_mover_spec.rb
View file @
19eb6374
...
...
@@ -6,7 +6,7 @@ describe Gitlab::ProjectMover do
before
do
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
)
end
...
...
spec/models/project_hooks_spec.rb
View file @
19eb6374
...
...
@@ -108,7 +108,7 @@ describe Project, "Hooks" do
it
{
should
include
(
id:
@commit
.
id
)
}
it
{
should
include
(
message:
@commit
.
safe_message
)
}
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
subject
{
@data
[
:commits
].
first
[
:author
]
}
...
...
spec/models/project_spec.rb
View file @
19eb6374
...
...
@@ -148,7 +148,7 @@ describe Project do
it
"should return valid url to repo"
do
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
it
"should return path to repo"
do
...
...
@@ -158,7 +158,7 @@ describe Project do
it
"returns the full web URL for this repo"
do
project
=
Project
.
new
(
path:
"somewhere"
)
project
.
web_url
.
should
==
"
#{
Gitlab
.
config
.
url
}
/somewhere"
project
.
web_url
.
should
==
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/somewhere"
end
describe
"last_activity methods"
do
...
...
spec/spec_helper.rb
View file @
19eb6374
...
...
@@ -42,8 +42,8 @@ RSpec.configure do |config|
# ActiveRecord::Base.observers.enable(:all)
# Use tmp dir for FS manipulations
Gitlab
.
config
.
stub
(
git_base
_path:
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
))
FileUtils
.
rm_rf
Gitlab
.
config
.
git
_base
_path
FileUtils
.
mkdir_p
Gitlab
.
config
.
git
_base
_path
Gitlab
.
config
.
gitolite
.
stub
(
repos
_path:
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
))
FileUtils
.
rm_rf
Gitlab
.
config
.
git
olite
.
repos
_path
FileUtils
.
mkdir_p
Gitlab
.
config
.
git
olite
.
repos
_path
end
end
spec/workers/post_receive_spec.rb
View file @
19eb6374
...
...
@@ -39,6 +39,6 @@ describe PostReceive do
end
def
pwd
(
project
)
File
.
join
(
Gitlab
.
config
.
git
_base
_path
,
project
.
path_with_namespace
)
File
.
join
(
Gitlab
.
config
.
git
olite
.
repos
_path
,
project
.
path_with_namespace
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment