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
Kazuhiko Shiozaki
gitlab-ce
Commits
224da711
Commit
224da711
authored
Dec 23, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract task helper methods
parent
9655350c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
63 deletions
+39
-63
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+0
-37
lib/tasks/gitlab/info.rake
lib/tasks/gitlab/info.rake
+0
-26
lib/tasks/gitlab/task_helpers.rake
lib/tasks/gitlab/task_helpers.rake
+39
-0
No files found.
lib/tasks/gitlab/check.rake
View file @
224da711
...
...
@@ -908,29 +908,6 @@ namespace :gitlab do
puts
""
end
# Runs the given command
#
# Returns nil if the command was not found
# Returns the output of the command otherwise
#
# see also #run_and_match
def
run
(
command
)
unless
`
#{
command
}
2>/dev/null`
.
blank?
`
#{
command
}
`
end
end
# Runs the given command and matches the output agains the given pattern
#
# Returns nil if nothing matched
# Retunrs the MatchData if the pattern matched
#
# see also #run
# see also String#match
def
run_and_match
(
command
,
pattern
)
run
(
command
).
try
(
:match
,
pattern
)
end
def
see_database_guide
"doc/install/databases.md"
end
...
...
@@ -952,18 +929,4 @@ namespace :gitlab do
puts
"
#{
step
}
"
end
end
def
warn_user_is_not_gitlab
unless
@warned_user_not_gitlab
current_user
=
run
(
"whoami"
).
chomp
unless
current_user
==
"gitlab"
puts
"
#{
Colored
.
color
(
:black
)
+
Colored
.
color
(
:on_yellow
)
}
Warning
#{
Colored
.
extra
(
:clear
)
}
"
puts
" You are running as user
#{
current_user
.
magenta
}
, we hope you know what you are doing."
puts
" Some tests may pass
\/
fail for the wrong reason."
puts
" For meaningful results you should run this as user
#{
"gitlab"
.
magenta
}
."
puts
""
end
@warned_user_not_gitlab
=
true
end
end
end
lib/tasks/gitlab/info.rake
View file @
224da711
...
...
@@ -80,31 +80,5 @@ namespace :gitlab do
puts
"Git:
\t\t
#{
Gitlab
.
config
.
git
.
bin_path
}
"
end
# Helper methods
# Runs the given command and matches the output agains the given pattern
#
# Returns nil if nothing matched
# Retunrs the MatchData if the pattern matched
#
# see also #run
# see also String#match
def
run_and_match
(
command
,
regexp
)
run
(
command
).
try
(
:match
,
regexp
)
end
# Runs the given command
#
# Returns nil if the command was not found
# Returns the output of the command otherwise
#
# see also #run_and_match
def
run
(
command
)
unless
`
#{
command
}
2>/dev/null`
.
blank?
`
#{
command
}
`
end
end
end
end
lib/tasks/gitlab/task_helpers.rake
0 → 100644
View file @
224da711
namespace
:gitlab
do
# Runs the given command and matches the output agains the given pattern
#
# Returns nil if nothing matched
# Retunrs the MatchData if the pattern matched
#
# see also #run
# see also String#match
def
run_and_match
(
command
,
regexp
)
run
(
command
).
try
(
:match
,
regexp
)
end
# Runs the given command
#
# Returns nil if the command was not found
# Returns the output of the command otherwise
#
# see also #run_and_match
def
run
(
command
)
unless
`
#{
command
}
2>/dev/null`
.
blank?
`
#{
command
}
`
end
end
def
warn_user_is_not_gitlab
unless
@warned_user_not_gitlab
current_user
=
run
(
"whoami"
).
chomp
unless
current_user
==
"gitlab"
puts
"
#{
Colored
.
color
(
:black
)
+
Colored
.
color
(
:on_yellow
)
}
Warning
#{
Colored
.
extra
(
:clear
)
}
"
puts
" You are running as user
#{
current_user
.
magenta
}
, we hope you know what you are doing."
puts
" Things may work
\/
fail for the wrong reasons."
puts
" For correct results you should run this as user
#{
"gitlab"
.
magenta
}
."
puts
""
end
@warned_user_not_gitlab
=
true
end
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