<commit_before>command :build do |c|
  c.syntax = 'magnum build [OPTIONS]'
  c.summary = 'Build & publish a release.'
  c.description = 'Build a release. For AdHoc or Enterprise builds against `master`, publish to TestFlight.'

  c.option '-c', '--configuration CONFIGURATION', 'Configuration used to build. One of AdHoc, AppStore, or Enterprise. Defaults to AdHoc.'

  c.action do |args, options|
    options.default :configuration => 'AdHoc'

    workspaces = Dir["*.xcworkspace"].grep(/^(.*)\.xcworkspace$/){$1}
    say_error "No Xcode workspace found" and abort if workspaces.empty?
    say_error "There can be only one workspace" and abort if workspaces.length > 1
    name = workspaces.first
    keychain_file = "#{ENV['HOME']}/Library/Keychains/#{options.configuration.snake_case}.keychain"

    if File.exists?(keychain_file)
      say "Using #{options.configuration.snake_case}.keychain"
      args = [
        keychain_file,
        "/Library/Keychains/System.keychain"
      ]
      `security list-keychains -s #{args.join(" ")}`
      `security default-keychain -s #{keychain_file}`
      `security unlock-keychain -p #{ENV['CI_KEYCHAIN_PASSWORD']} #{keychain_file}`
    end

    short_sha1 = `git rev-parse --short #{ENV['JANKY_SHA1'] || 'HEAD'}`
    log `/usr/libexec/PlistBuddy -c "Set :CFBundleVersion #{short_sha1}" "#{name}/#{name}-Info.plist"`
    log `bin/ipa build --trace -c #{options.configuration} -s #{name}`
  end
end
<commit_msg>alias `cibuild` to `build` for janky convenience<commit_after>command :build do |c|
  c.syntax = 'magnum build [OPTIONS]'
  c.summary = 'Build & publish a release.'
  c.description = 'Build a release. For AdHoc or Enterprise builds against `master`, publish to TestFlight.'

  c.option '-c', '--configuration CONFIGURATION', 'Configuration used to build. One of AdHoc, AppStore, or Enterprise. Defaults to AdHoc.'

  c.action do |args, options|
    options.default :configuration => 'AdHoc'

    workspaces = Dir["*.xcworkspace"].grep(/^(.*)\.xcworkspace$/){$1}
    say_error "No Xcode workspace found" and abort if workspaces.empty?
    say_error "There can be only one workspace" and abort if workspaces.length > 1
    name = workspaces.first
    keychain_file = "#{ENV['HOME']}/Library/Keychains/#{options.configuration.snake_case}.keychain"

    if File.exists?(keychain_file)
      say "Using #{options.configuration.snake_case}.keychain"
      args = [
        keychain_file,
        "/Library/Keychains/System.keychain"
      ]
      `security list-keychains -s #{args.join(" ")}`
      `security default-keychain -s #{keychain_file}`
      `security unlock-keychain -p #{ENV['CI_KEYCHAIN_PASSWORD']} #{keychain_file}`
    end

    short_sha1 = `git rev-parse --short #{ENV['JANKY_SHA1'] || 'HEAD'}`
    log `/usr/libexec/PlistBuddy -c "Set :CFBundleVersion #{short_sha1}" "#{name}/#{name}-Info.plist"`
    log `bin/ipa build --trace -c #{options.configuration} -s #{name}`
  end
end
alias_command :cibuild, :build

{'fraction_non_alphanumeric': 0.14674278038952318, 'fraction_numerical': 0.0033579583613163196, 'mean_word_length': 3.6839622641509435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1662261', 'n_tokens_mistral': 992, 'n_tokens_neox': 963, 'n_words': 255}