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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
d219f9a6
Commit
d219f9a6
authored
May 31, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix BasicExecutor specs
parent
23f9e95e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
31 deletions
+11
-31
lib/system_check/helpers.rb
lib/system_check/helpers.rb
+0
-11
lib/tasks/gitlab/task_helpers.rb
lib/tasks/gitlab/task_helpers.rb
+11
-16
spec/lib/system_check_spec.rb
spec/lib/system_check_spec.rb
+0
-4
No files found.
lib/system_check/helpers.rb
View file @
d219f9a6
...
@@ -68,19 +68,8 @@ module SystemCheck
...
@@ -68,19 +68,8 @@ module SystemCheck
Dir
.
pwd
==
'/opt/gitlab/embedded/service/gitlab-rails'
Dir
.
pwd
==
'/opt/gitlab/embedded/service/gitlab-rails'
end
end
def
gitlab_user
Gitlab
.
config
.
gitlab
.
user
end
def
sudo_gitlab
(
command
)
def
sudo_gitlab
(
command
)
"sudo -u
#{
gitlab_user
}
-H
#{
command
}
"
"sudo -u
#{
gitlab_user
}
-H
#{
command
}
"
end
end
def
is_gitlab_user?
return
@is_gitlab_user
unless
@is_gitlab_user
.
nil?
current_user
=
run_command
(
%w(whoami)
).
chomp
@is_gitlab_user
=
current_user
==
gitlab_user
end
end
end
end
end
lib/tasks/gitlab/task_helpers.rb
View file @
d219f9a6
...
@@ -98,6 +98,17 @@ module Gitlab
...
@@ -98,6 +98,17 @@ module Gitlab
end
end
end
end
def
gitlab_user
Gitlab
.
config
.
gitlab
.
user
end
def
is_gitlab_user?
return
@is_gitlab_user
unless
@is_gitlab_user
.
nil?
current_user
=
run_command
(
%w(whoami)
).
chomp
@is_gitlab_user
=
current_user
==
gitlab_user
end
def
warn_user_is_not_gitlab
def
warn_user_is_not_gitlab
return
if
@warned_user_not_gitlab
return
if
@warned_user_not_gitlab
...
@@ -114,22 +125,6 @@ module Gitlab
...
@@ -114,22 +125,6 @@ module Gitlab
end
end
end
end
# Tries to configure git itself
#
# Returns true if all subcommands were successfull (according to their exit code)
# Returns false if any or all subcommands failed.
def
auto_fix_git_config
(
options
)
if
!
@warned_user_not_gitlab
command_success
=
options
.
map
do
|
name
,
value
|
system
(
*
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
config --global
#{
name
}
#{
value
}
)
)
end
command_success
.
all?
else
false
end
end
def
all_repos
def
all_repos
Gitlab
.
config
.
repositories
.
storages
.
each_value
do
|
repository_storage
|
Gitlab
.
config
.
repositories
.
storages
.
each_value
do
|
repository_storage
|
IO
.
popen
(
%W(find
#{
repository_storage
[
'path'
]
}
-mindepth 2 -maxdepth 2 -type d -name *.git)
)
do
|
find
|
IO
.
popen
(
%W(find
#{
repository_storage
[
'path'
]
}
-mindepth 2 -maxdepth 2 -type d -name *.git)
)
do
|
find
|
...
...
spec/lib/system_check_spec.rb
View file @
d219f9a6
...
@@ -9,10 +9,6 @@ describe SystemCheck, lib: true do
...
@@ -9,10 +9,6 @@ describe SystemCheck, lib: true do
end
end
describe
'.run'
do
describe
'.run'
do
it
'requires custom executor to be a BasicExecutor'
do
expect
{
subject
.
run
(
'Component'
,
[],
SystemCheck
::
SimpleExecutor
)
}.
not_to
raise_error
end
context
'custom matcher'
do
context
'custom matcher'
do
class
SimpleCheck
<
SystemCheck
::
BaseCheck
class
SimpleCheck
<
SystemCheck
::
BaseCheck
def
check?
def
check?
...
...
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