From f47043ee390dc608df12bbae1c1dfd4ae623d1f0 Mon Sep 17 00:00:00 2001
From: Gabriel Mazetto <gabriel@gitlab.com>
Date: Thu, 11 Apr 2024 19:28:27 +0200
Subject: [PATCH] Reorganize dependency loading to fix rails autoloading issue

---
 gems/gitlab-backup-cli/lib/gitlab/backup/cli.rb               | 3 ---
 gems/gitlab-backup-cli/lib/gitlab/backup/cli/output.rb        | 4 +++-
 .../lib/gitlab/backup/cli/targets/database.rb                 | 2 --
 gems/gitlab-backup-cli/spec/spec_helper.rb                    | 2 +-
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli.rb
index 9ceb0236632c9..7f5b06ee37610 100644
--- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli.rb
+++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli.rb
@@ -1,8 +1,5 @@
 # frozen_string_literal: true
 
-require 'active_support/all'
-require 'rainbow/refinement'
-
 module Gitlab
   module Backup
     # GitLab Backup CLI
diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/output.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/output.rb
index 2b0e0ebe78d1f..9e45719b031af 100644
--- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/output.rb
+++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/output.rb
@@ -1,5 +1,7 @@
 # frozen_string_literal: true
 
+require 'rainbow/refinement'
+
 module Gitlab
   module Backup
     module Cli
@@ -98,7 +100,7 @@ def flush!(stderr: false)
           private
 
           def timestamp_format(content)
-            "[#{Time.current}] #{content}"
+            "[#{Time.now.utc}] #{content}"
           end
         end
       end
diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/targets/database.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/targets/database.rb
index c1f24c2f956f2..8efb3e89149e4 100644
--- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/targets/database.rb
+++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/targets/database.rb
@@ -1,7 +1,5 @@
 # frozen_string_literal: true
 
-require 'yaml'
-
 module Gitlab
   module Backup
     module Cli
diff --git a/gems/gitlab-backup-cli/spec/spec_helper.rb b/gems/gitlab-backup-cli/spec/spec_helper.rb
index b6fff2ed1b937..02246b5a4dd6d 100644
--- a/gems/gitlab-backup-cli/spec/spec_helper.rb
+++ b/gems/gitlab-backup-cli/spec/spec_helper.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
-require 'thor'
 require "gitlab/backup/cli"
+require 'active_support/all'
 require 'tmpdir'
 require 'fileutils'
 require 'factory_bot'
-- 
GitLab