mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

`brew doctor` will return exit code 1 if using Xcode_10.2 ```==> brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks! Warning: Your Xcode (10.2) is outdated. Please update to Xcode 10.2.1 (or delete it). Xcode can be updated from the App Store. ==> FAILED ```
83 lines
2.0 KiB
Ruby
83 lines
2.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "tap"
|
|
require "cli/parser"
|
|
|
|
module Homebrew
|
|
module_function
|
|
|
|
def tap_new_args
|
|
Homebrew::CLI::Parser.new do
|
|
usage_banner <<~EOS
|
|
`tap-new` <user>`/`<repo>
|
|
|
|
Generate the template files for a new tap.
|
|
EOS
|
|
switch :verbose
|
|
switch :debug
|
|
end
|
|
end
|
|
|
|
def tap_new
|
|
tap_new_args.parse
|
|
|
|
raise "A tap argument is required" if ARGV.named.empty?
|
|
|
|
tap = Tap.fetch(ARGV.named.first)
|
|
titleized_user = tap.user.dup
|
|
titleized_repo = tap.repo.dup
|
|
titleized_user[0] = titleized_user[0].upcase
|
|
titleized_repo[0] = titleized_repo[0].upcase
|
|
|
|
(tap.path/"Formula").mkpath
|
|
|
|
readme = <<~MARKDOWN
|
|
# #{titleized_user} #{titleized_repo}
|
|
|
|
## How do I install these formulae?
|
|
`brew install #{tap}/<formula>`
|
|
|
|
Or `brew tap #{tap}` and then `brew install <formula>`.
|
|
|
|
Or install via URL (which will not receive updates):
|
|
|
|
```
|
|
brew install https://raw.githubusercontent.com/#{tap.user}/homebrew-#{tap.repo}/master/Formula/<formula>.rb
|
|
```
|
|
|
|
## Documentation
|
|
`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh).
|
|
MARKDOWN
|
|
write_path(tap, "README.md", readme)
|
|
|
|
azure = <<~YAML
|
|
jobs:
|
|
- job: macOS
|
|
pool:
|
|
vmImage: macOS-10.14
|
|
steps:
|
|
- bash: |
|
|
set -e
|
|
sudo xcode-select --switch /Applications/Xcode_10.2.1.app/Contents/Developer
|
|
brew update
|
|
HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap.full_name}"
|
|
mkdir -p "$HOMEBREW_TAP_DIR"
|
|
rm -rf "$HOMEBREW_TAP_DIR"
|
|
ln -s "$PWD" "$HOMEBREW_TAP_DIR"
|
|
brew test-bot
|
|
displayName: Run brew test-bot
|
|
YAML
|
|
write_path(tap, "azure-pipelines.yml", azure)
|
|
ohai "Created #{tap}"
|
|
puts tap.path.to_s
|
|
end
|
|
|
|
def write_path(tap, filename, content)
|
|
path = tap.path/filename
|
|
tap.path.mkpath
|
|
raise "#{path} already exists" if path.exist?
|
|
|
|
path.write content
|
|
end
|
|
end
|