brew/Library/Homebrew/cmd/tap-readme.rb

33 lines
934 B
Ruby
Raw Normal View History

module Homebrew
def tap_readme
name = ARGV.first
raise "A name is required" if name.nil?
2014-12-27 11:05:11 +00:00
titleized_name = name.dup
titleized_name[0] = titleized_name[0].upcase
template = <<-EOS.undent
2014-12-27 11:05:11 +00:00
# Homebrew #{titleized_name}
2014-12-27 11:05:11 +00:00
## How do I install these formulae?
`brew install homebrew/#{name}/<formula>`
2014-12-27 11:05:11 +00:00
Or `brew tap homebrew/#{name}` and then `brew install <formula>`.
2014-12-27 11:05:11 +00:00
Or install via URL (which will not receive updates):
```
brew install https://raw.githubusercontent.com/Homebrew/homebrew-#{name}/master/<formula>.rb
```
2014-12-27 11:05:11 +00:00
## Documentation
`brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/homebrew/tree/master/share/doc/homebrew#readme).
EOS
puts template if ARGV.verbose?
2015-09-06 13:20:06 +01:00
path = HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-#{name}/README.md"
raise "#{path} already exists" if path.exist?
path.write template
end
end