Class: Pindo::Command::Utils::Gitconfig

Inherits:
Pindo::Command::Utils show all
Defined in:
lib/pindo/command/utils/gitconfig.rb

Constant Summary collapse

GLOBAL_CONFIGS =

需要统一设置的全局 Git 配置(按团队约定)value: 目标值 / desc: 中文含义(用于日志输出)

{
  'core.ignorecase' => { value: 'false',     desc: '禁止大小写' },
  'pull.rebase'     => { value: 'false',     desc: '禁止自动rebase' },
  'http.postBuffer' => { value: '157286400', desc: 'git缓存内存大小' },
}.freeze

Constants inherited from Pindo::Command

DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS

Instance Attribute Summary

Attributes inherited from Pindo::Command

#args_help_flag

Instance Method Summary collapse

Methods inherited from Pindo::Command

command_name, #initialize, #initialize_options, options, run, use_cache?

Methods included from Funlog::Mixin

#pindo_log_instance

Methods included from Pindoconfig::Mixin

#pindo_single_config

Methods included from HelpValidator

#validate!

Constructor Details

This class inherits a constructor from Pindo::Command

Instance Method Details

#runObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/pindo/command/utils/gitconfig.rb', line 67

def run
  # --verbose 通过 ENV 向下传递到 GitHookHelper(helper 没有 CLAide 上下文)
  ENV['PINDO_DEBUG'] ||= '1' if pindo_verbose?

  if pindo_verbose?
    puts ""
    puts "==> pindo utils gitconfig:配置本机全局 Git 环境"
    puts "    共 5 个步骤:用户身份 → Git 配置 → git-lfs 安装 → LFS filter → 全局 hook"
  end

  # 汇总 5 项全局 Git 配置,step [1/5] 和 [2/5] 处理完后统一打印
  @final_configs = []

  step_header(1, "设置 Git 用户身份 (user.name / user.email)")
  setup_git_user_identity

  step_header(2, "设置全局 Git 配置")
  apply_global_git_configs

  print_global_configs_summary

  step_header(3, "检查并安装 git-lfs")
  ensure_git_lfs_installed

  step_header(4, "配置 git-lfs 全局 filter")
  setup_git_lfs_filters

  step_header(5, "安装全局 Git hook")
  Pindo::GitHookHelper.share_instance.install_global_commit_stats_hook

  puts "" if pindo_verbose?
  Funlog.instance.fancyinfo_success("pindo utils gitconfig 全部完成 ✓")
end