Class: WifiWand::Platforms::Mac::Helper::GitSkipWorktree

Inherits:
Object
  • Object
show all
Defined in:
lib/wifi_wand/platforms/mac/helper/git_skip_worktree.rb

Overview

Local development helper for the generated macOS helper files.

The compiled helper executable and signing metadata are intentionally tracked because packaged gem builds need to ship a prebuilt, signed helper. During helper development, though, swift:compile_helper rewrites those generated files and the source attestation manifest frequently. Those generated edits are easy to stage accidentally with git add ., which makes ordinary Ruby or Swift source commits carry a large helper artifact update.

.gitignore cannot solve that problem because these files are already tracked. This utility toggles Git's local skip-worktree bit for the generated helper artifacts only. Template/input files inside the app bundle, such as Info.plist, stay visible to Git because edits to them are source changes, not local build churn. The flag is stored in the developer's local index, is not committed, and should be cleared before preparing a real helper artifact release. The Swift source stays unskipped so source changes remain visible to normal staging and review.

Defined Under Namespace

Classes: Error, Result, StatusEntry

Constant Summary collapse

DEFAULT_PATHS =
[
  'libexec/macos/wifiwand-helper.app/Contents/CodeResources',
  'libexec/macos/wifiwand-helper.app/Contents/MacOS/wifiwand-helper',
  'libexec/macos/wifiwand-helper.app/Contents/_CodeSignature/CodeResources',
  'libexec/macos/wifiwand-helper.source-manifest.json',
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(repo_root: default_repo_root, paths: DEFAULT_PATHS, out_stream: $stdout) ⇒ GitSkipWorktree

Returns a new instance of GitSkipWorktree.



47
48
49
50
51
# File 'lib/wifi_wand/platforms/mac/helper/git_skip_worktree.rb', line 47

def initialize(repo_root: default_repo_root, paths: DEFAULT_PATHS, out_stream: $stdout)
  @repo_root = repo_root
  @paths = paths
  @out_stream = out_stream
end

Instance Method Details



73
74
75
76
77
# File 'lib/wifi_wand/platforms/mac/helper/git_skip_worktree.rb', line 73

def print_status
  result = status
  print_result('Helper artifact skip-worktree status', result)
  result
end

#start(print_result: true) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/wifi_wand/platforms/mac/helper/git_skip_worktree.rb', line 53

def start(print_result: true)
  tracked_paths = tracked_files
  update_index('--skip-worktree', tracked_paths)
  result = status
  print_result('Started helper artifact skip-worktree', result) if print_result
  result
end

#statusObject



69
70
71
# File 'lib/wifi_wand/platforms/mac/helper/git_skip_worktree.rb', line 69

def status
  Result.new(paths: paths, tracked_entries: status_entries)
end

#stop(print_result: true) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/wifi_wand/platforms/mac/helper/git_skip_worktree.rb', line 61

def stop(print_result: true)
  tracked_paths = tracked_files
  update_index('--no-skip-worktree', tracked_paths)
  result = status
  print_result('Stopped helper artifact skip-worktree', result) if print_result
  result
end