Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2022-08-25 09:07:50 +0300
committerAsh McKenzie <amckenzie@gitlab.com>2022-08-25 09:07:50 +0300
commitba80807b4251f86c2595b5f1443904a3a50041fb (patch)
tree2c659e24b972e3247705860c14190d282bb161f3
parent2d0daaaa361cc224e2c4676929d839cdf861865a (diff)
Prefix color codes with TaskHelpers
-rw-r--r--lib/tasks/build_site.rake12
-rw-r--r--lib/tasks/redirects.rake16
-rw-r--r--lib/tasks/release.rake8
3 files changed, 18 insertions, 18 deletions
diff --git a/lib/tasks/build_site.rake b/lib/tasks/build_site.rake
index af235dbe..7c4296ff 100644
--- a/lib/tasks/build_site.rake
+++ b/lib/tasks/build_site.rake
@@ -9,7 +9,7 @@ task_helpers = TaskHelpers.new
task default: [:clone_repositories, :generate_feature_flags]
task :setup_git do
- puts "\n#{COLOR_CODE_GREEN}INFO: Setting up dummy user and email in Git..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Setting up dummy user and email in Git..#{TaskHelpers::COLOR_CODE_RESET}"
`git config --global user.name "Sidney Jones"`
`git config --global user.email "sidneyjones@example.com"`
@@ -30,12 +30,12 @@ task :clone_repositories do
&& branch == ENV['CI_DEFAULT_BRANCH'] \
&& ENV["CI_PIPELINE_SOURCE"] == 'pipeline'
- puts "\n#{COLOR_CODE_GREEN}INFO: Cloning #{product['repo']}..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Cloning #{product['repo']}..#{TaskHelpers::COLOR_CODE_RESET}"
`git clone --branch #{branch} --single-branch #{product['repo']} --depth 1 #{product['project_dir']}`
# Print the latest commit from each project so that we can see which commit we're building from.
- puts "\n#{COLOR_CODE_GREEN}INFO: Latest commit: #{`git -C #{product['project_dir']} log --oneline -n 1`}#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Latest commit: #{`git -C #{product['project_dir']} log --oneline -n 1`}#{TaskHelpers::COLOR_CODE_RESET}"
end
end
@@ -44,8 +44,8 @@ task :generate_feature_flags do
feature_flags_dir = Pathname.new('..').join('gitlab', 'config', 'feature_flags').expand_path
feature_flags_ee_dir = Pathname.new('..').join('gitlab', 'ee', 'config', 'feature_flags').expand_path
- abort("\n#{COLOR_CODE_RED}ERROR: The feature flags directory #{feature_flags_dir} does not exist.#{COLOR_CODE_RESET}") unless feature_flags_dir.exist?
- abort("\n#{COLOR_CODE_RED}ERROR: The feature flags EE directory #{feature_flags_ee_dir} does not exist.#{COLOR_CODE_RESET}") unless feature_flags_ee_dir.exist?
+ abort("\n#{TaskHelpers::COLOR_CODE_RED}ERROR: The feature flags directory #{feature_flags_dir} does not exist.#{TaskHelpers::COLOR_CODE_RESET}") unless feature_flags_dir.exist?
+ abort("\n#{TaskHelpers::COLOR_CODE_RED}ERROR: The feature flags EE directory #{feature_flags_ee_dir} does not exist.#{TaskHelpers::COLOR_CODE_RESET}") unless feature_flags_ee_dir.exist?
paths = {
'GitLab Community Edition and Enterprise Edition' => feature_flags_dir.join('**', '*.yml'),
@@ -66,6 +66,6 @@ task :generate_feature_flags do
feature_flags_yaml = File.join('content', '_data', 'feature_flags.yaml')
- puts "\n#{COLOR_CODE_GREEN}INFO: Generating #{feature_flags_yaml}..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Generating #{feature_flags_yaml}..#{TaskHelpers::COLOR_CODE_RESET}"
File.write(feature_flags_yaml, feature_flags.to_yaml)
end
diff --git a/lib/tasks/redirects.rake b/lib/tasks/redirects.rake
index 9d1b094b..b3fc6a69 100644
--- a/lib/tasks/redirects.rake
+++ b/lib/tasks/redirects.rake
@@ -41,9 +41,9 @@ namespace :docs do
ENV['LEFTHOOK'] = '0'
# Check jq is available
- abort("\n#{COLOR_CODE_RED}ERROR: jq not found. Install jq and run task again.#{COLOR_CODE_RESET}") if `which jq`.empty?
+ abort("\n#{TaskHelpers::COLOR_CODE_RED}ERROR: jq not found. Install jq and run task again.#{TaskHelpers::COLOR_CODE_RESET}") if `which jq`.empty?
- puts "\n#{COLOR_CODE_GREEN}INFO: (gitlab-docs): Stashing changes of gitlab-docs and syncing with upstream default branch..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: (gitlab-docs): Stashing changes of gitlab-docs and syncing with upstream default branch..#{TaskHelpers::COLOR_CODE_RESET}"
system("git stash --quiet -u") if git_workdir_dirty?
system("git checkout --quiet main")
system("git fetch --quiet origin main")
@@ -86,7 +86,7 @@ namespace :docs do
counter = 0
Dir.chdir(content_dir)
- puts "\n#{COLOR_CODE_GREEN}INFO: (#{slug}): Stashing changes of #{slug} and syncing with upstream default branch..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: (#{slug}): Stashing changes of #{slug} and syncing with upstream default branch..#{TaskHelpers::COLOR_CODE_RESET}"
system("git", "stash", "--quiet", "-u") if task_helpers.git_workdir_dirty?
system("git", "checkout", "--quiet", default_branch)
system("git", "fetch", "--quiet", "origin", default_branch)
@@ -161,13 +161,13 @@ namespace :docs do
# 4. Commit and push the branch to create the MR
#
- puts "\n#{COLOR_CODE_GREEN}INFO: (#{slug}): Found #{counter} redirect(s).#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: (#{slug}): Found #{counter} redirect(s).#{TaskHelpers::COLOR_CODE_RESET}"
next unless counter.positive?
Dir.chdir(content_dir)
- puts "\n#{COLOR_CODE_GREEN}INFO: (#{slug}): Creating a new branch for the redirects MR..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: (#{slug}): Creating a new branch for the redirects MR..#{TaskHelpers::COLOR_CODE_RESET}"
system("git", "checkout", "--quiet", "-b", redirects_branch, origin_default_branch)
- puts "\n#{COLOR_CODE_GREEN}INFO: (#{slug}): Committing and pushing to create a merge request..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: (#{slug}): Committing and pushing to create a merge request..#{TaskHelpers::COLOR_CODE_RESET}"
system("git", "add", ".")
system("git", "commit", "--quiet", "-m", commit_message)
@@ -185,9 +185,9 @@ namespace :docs do
# 2. Add the changed files
# 3. Commit and push the branch to create the MR
#
- puts "\n#{COLOR_CODE_GREEN}INFO: (gitlab-docs): Creating a new branch for the redirects MR..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: (gitlab-docs): Creating a new branch for the redirects MR..#{TaskHelpers::COLOR_CODE_RESET}"
system("git", "checkout", "--quiet", "-b", redirects_branch, "origin/main")
- puts "\n#{COLOR_CODE_GREEN}INFO: (gitlab-docs): Committing and pushing to create a merge request..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: (gitlab-docs): Committing and pushing to create a merge request..#{TaskHelpers::COLOR_CODE_RESET}"
system("git", "add", redirects_yaml)
system("git", "commit", "--quiet", "-m", commit_message)
diff --git a/lib/tasks/release.rake b/lib/tasks/release.rake
index 0d629503..0be8ab1f 100644
--- a/lib/tasks/release.rake
+++ b/lib/tasks/release.rake
@@ -19,12 +19,12 @@ namespace :release do
raise 'You need to specify a version, like 10.1' unless version.match?(%r{\A\d+\.\d+\z})
# Check if local branch exists
- abort("\n#{COLOR_CODE_RED}ERROR: Rake aborted! The branch already exists. Delete it with `git branch -D #{version}` and rerun the task.#{COLOR_CODE_RESET}") \
+ abort("\n#{TaskHelpers::COLOR_CODE_RED}ERROR: Rake aborted! The branch already exists. Delete it with `git branch -D #{version}` and rerun the task.#{TaskHelpers::COLOR_CODE_RESET}") \
if task_helpers.local_branch_exist?(version)
# Stash modified and untracked files so we have "clean" environment
# without accidentally deleting data
- puts "\n#{COLOR_CODE_GREEN}INFO: Stashing changes..#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Stashing changes..#{TaskHelpers::COLOR_CODE_RESET}"
`git stash -u` if task_helpers.git_workdir_dirty?
# Sync with upstream default branch
@@ -66,8 +66,8 @@ namespace :release do
`git add .gitlab-ci.yml #{version}.Dockerfile`
`git commit -m 'Release cut #{version}'`
- puts "\n#{COLOR_CODE_GREEN}INFO: Created new Dockerfile:#{COLOR_CODE_RESET} #{dockerfile}."
- puts "#{COLOR_CODE_GREEN}INFO: Pushing the new branch. Don't create a merge request!#{COLOR_CODE_RESET}"
+ puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Created new Dockerfile:#{TaskHelpers::COLOR_CODE_RESET} #{dockerfile}."
+ puts "#{TaskHelpers::COLOR_CODE_GREEN}INFO: Pushing the new branch. Don't create a merge request!#{TaskHelpers::COLOR_CODE_RESET}"
`git push origin #{version}`
end