summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/task_helpers.rake
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2013-01-12 00:44:40 +0100
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2013-01-12 01:25:01 +0100
commiteb626edd3fe2602321080e231cf748afc86d4700 (patch)
tree4a12fa34cb4302289047c0dbfb79ea50d057ec7d /lib/tasks/gitlab/task_helpers.rake
parent4d0af232da7df8c4a33b9f2e44933f1f3d2527bc (diff)
downloadgitlab-ce-eb626edd3fe2602321080e231cf748afc86d4700.tar.gz
Replace all stat command line calls with ruby equivalents
Diffstat (limited to 'lib/tasks/gitlab/task_helpers.rake')
-rw-r--r--lib/tasks/gitlab/task_helpers.rake9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/task_helpers.rake b/lib/tasks/gitlab/task_helpers.rake
index 5b5c3c30ba2..5dd97fa2f92 100644
--- a/lib/tasks/gitlab/task_helpers.rake
+++ b/lib/tasks/gitlab/task_helpers.rake
@@ -45,6 +45,15 @@ namespace :gitlab do
end
end
+ def uid_for(user_name)
+ run("id -u #{user_name}").chomp.to_i
+ end
+
+ def gid_for(group_name)
+ group_line = File.read("/etc/group").lines.select{|l| l.start_with?("#{group_name}:")}.first
+ group_line.split(":")[2].to_i
+ end
+
def warn_user_is_not_gitlab
unless @warned_user_not_gitlab
current_user = run("whoami").chomp