2016-09-08 09:05:00 +01:00
|
|
|
#: * `tap_readme` [`-v`] <name>:
|
|
|
|
#: Generate the README.md file for a new tap.
|
|
|
|
|
2014-09-20 14:38:56 +01:00
|
|
|
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
|
2016-01-20 13:57:57 +01:00
|
|
|
titleized_name[0..0] = titleized_name[0..0].upcase
|
2014-12-27 11:05:11 +00:00
|
|
|
|
2014-12-13 23:52:32 +08:00
|
|
|
template = <<-EOS.undent
|
2014-12-27 11:05:11 +00:00
|
|
|
# Homebrew #{titleized_name}
|
2014-09-20 14:38:56 +01:00
|
|
|
|
2014-12-27 11:05:11 +00:00
|
|
|
## How do I install these formulae?
|
|
|
|
`brew install homebrew/#{name}/<formula>`
|
2014-09-20 14:38:56 +01:00
|
|
|
|
2014-12-27 11:05:11 +00:00
|
|
|
Or `brew tap homebrew/#{name}` and then `brew install <formula>`.
|
2014-09-20 14:38:56 +01:00
|
|
|
|
2014-12-27 11:05:11 +00:00
|
|
|
Or install via URL (which will not receive updates):
|
2014-09-20 14:38:56 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
brew install https://raw.githubusercontent.com/Homebrew/homebrew-#{name}/master/<formula>.rb
|
|
|
|
```
|
|
|
|
|
2014-12-27 11:05:11 +00:00
|
|
|
## Documentation
|
2016-04-03 14:03:33 +01:00
|
|
|
`brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/brew/tree/master/share/doc/homebrew#readme).
|
2014-09-20 14:38:56 +01:00
|
|
|
EOS
|
|
|
|
|
|
|
|
puts template if ARGV.verbose?
|
2015-09-06 13:20:06 +01:00
|
|
|
path = HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-#{name}/README.md"
|
2014-09-20 14:38:56 +01:00
|
|
|
raise "#{path} already exists" if path.exist?
|
|
|
|
path.write template
|
|
|
|
end
|
|
|
|
end
|