diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-12-15 21:25:23 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-12-15 21:25:23 +0000 |
commit | 223cb3788a744f9b1b92959d3337000358db108b (patch) | |
tree | 77858e7ec0e2a731ddb7791f99d75ef4c23b4b54 /lib/tasks | |
parent | b3606cff38b9defc764706ed6529a9e27dcf4847 (diff) | |
parent | a1a323392d4f0cb59eab2e215fa4010b84fc122d (diff) | |
download | gitlab-ce-41117-empty-state.tar.gz |
Merge branch 'master' into 41117-empty-state41117-empty-state
* master: (71 commits)
Update CHANGELOG.md for 10.2.5
Change CI config to use new base image
fix issue #39843 Incorrect guidance stating blocked users will be removed from groups and projects as members
Add changelog entry
Update tests for toggle design change
Update toggle styles to use icons
Use icons instead of string labels for toggles
Fix Rubocop offense in QA project specs
Add SAST docs
Fix UX issues in system info page
Update svg package version
Make sure user email is read only when synced with LDAP
Add note about automatic pipelines when enabling Auto DevOps
Backport changes from EE
Docs update documentation guidelines
Don't use Markdown cache for stubbed settings in specs
Fix remaining calls to GitLab QA factories
Rename QA scenarios to make factory concept explicit
Export JS classes as modules
Make rubocop happy
...
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gettext.rake | 1 | ||||
-rw-r--r-- | lib/tasks/gitlab/task_helpers.rb | 17 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index 35ba729c156..247d7be7d78 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -23,6 +23,7 @@ namespace :gettext do desc 'Lint all po files in `locale/' task lint: :environment do require 'simple_po_parser' + require 'gitlab/utils' FastGettext.silence_errors files = Dir.glob(Rails.root.join('locale/*/gitlab.po')) diff --git a/lib/tasks/gitlab/task_helpers.rb b/lib/tasks/gitlab/task_helpers.rb index 8a63f486fa3..6723662703c 100644 --- a/lib/tasks/gitlab/task_helpers.rb +++ b/lib/tasks/gitlab/task_helpers.rb @@ -1,10 +1,13 @@ require 'rainbow/ext/string' +require 'gitlab/utils/strong_memoize' module Gitlab TaskFailedError = Class.new(StandardError) TaskAbortedByUserError = Class.new(StandardError) module TaskHelpers + include Gitlab::Utils::StrongMemoize + extend self # Ask if the user wants to continue @@ -105,16 +108,16 @@ module Gitlab end def 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 + strong_memoize(:is_gitlab_user) do + current_user = run_command(%w(whoami)).chomp + current_user == gitlab_user + end end def warn_user_is_not_gitlab - return if @warned_user_not_gitlab + return if gitlab_user? - unless gitlab_user? + strong_memoize(:warned_user_not_gitlab) do current_user = run_command(%w(whoami)).chomp puts " Warning ".color(:black).background(:yellow) @@ -122,8 +125,6 @@ module Gitlab puts " Things may work\/fail for the wrong reasons." puts " For correct results you should run this as user #{gitlab_user.color(:magenta)}." puts "" - - @warned_user_not_gitlab = true end end |