Class: CocoapodsSourceFix::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-source-fix/runner.rb

Overview

执行替换:收集目标文件 → 逐文件替换 → 幂等写回 → 日志输出

Instance Method Summary collapse

Constructor Details

#initialize(context, config, podfile_dir: nil) ⇒ Runner

Returns a new instance of Runner.



7
8
9
10
11
# File 'lib/cocoapods-source-fix/runner.rb', line 7

def initialize(context, config, podfile_dir: nil)
  @context = context
  @config = config
  @podfile_dir = podfile_dir || default_podfile_dir
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cocoapods-source-fix/runner.rb', line 13

def run
  Logger.info "patching source files..."
  fixed_total = 0
  skipped_total = 0
  @config.rules.each do |rule|
    next unless rule.enabled?

    files = collect_files(rule)
    fixed, skipped = process_rule(rule, files)
    fixed_total += fixed
    skipped_total += skipped
  end
  Logger.info "finished patching source files (#{fixed_total} fixed, #{skipped_total} skipped)"
end