Update and add checks

This commit is contained in:
Riyad Preukschas 2012-12-13 12:11:41 +01:00
parent 71266ad28f
commit c3b9774f4b
2 changed files with 912 additions and 79 deletions

File diff suppressed because it is too large Load diff

View file

@ -84,7 +84,13 @@ namespace :gitlab do
# Helper methods # Helper methods
# Runs the given command and matches the output agains the given RegExp # 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) def run_and_match(command, regexp)
run(command).try(:match, regexp) run(command).try(:match, regexp)
end end
@ -93,6 +99,8 @@ namespace :gitlab do
# #
# Returns nil if the command was not found # Returns nil if the command was not found
# Returns the output of the command otherwise # Returns the output of the command otherwise
#
# see also #run_and_match
def run(command) def run(command)
unless `#{command} 2>/dev/null`.blank? unless `#{command} 2>/dev/null`.blank?
`#{command}` `#{command}`