Skip to content

Commit

Permalink
Import docs from wiki.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Oct 26, 2014
1 parent cd528e7 commit 19d12ae
Show file tree
Hide file tree
Showing 51 changed files with 3,023 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
!/bin
/bin/*
!/bin/brew
!/share/doc/homebrew
!/share/man/man1/brew.1
.DS_Store
/Library/Homebrew/doc
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Reporting Bugs
--------------
First, please run `brew update` and `brew doctor`.

Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/homebrew/wiki/troubleshooting).
Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Troubleshooting.md).

**If you don't read these it will take us far longer to help you with your problem.**

Expand All @@ -18,9 +18,9 @@ Contributing
Please read:

* [Code of Conduct](https://github.com/Homebrew/homebrew/blob/master/CODEOFCONDUCT.md)
* [Formula Cookbook](https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook)
* [Acceptable Formulae](https://github.com/Homebrew/homebrew/wiki/Acceptable-Formulae)
* [Formula Cookbook](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md)
* [Acceptable Formulae](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Acceptable-Formulae.md)
* [Ruby Style Guide](https://github.com/styleguide/ruby)
* [How To Open a Homebrew Pull Request (and get it merged)](https://github.com/Homebrew/homebrew/wiki/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged))
* [How To Open a Homebrew Pull Request (and get it merged)](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md)

Thanks!
9 changes: 4 additions & 5 deletions Library/Contributions/example-formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This is a non-functional example formula to showcase all features and
# therefore, it's overly complex and dupes stuff just to comment on it.
# You may want to use `brew create` to start your own new formula!
# Documentation: https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md

## Naming -- Every Homebrew formula is a class of the type `Formula`.
# Ruby classes have to start Upper case and dashes are not allowed.
Expand Down Expand Up @@ -87,8 +87,7 @@ class ExampleFormula < Formula

# Bottles are pre-built and added by the Homebrew maintainers for you.
# If you maintain your own repository, you can add your own bottle links.
# Read in the wiki about how to provide bottles:
# <https://github.com/Homebrew/homebrew/wiki/Bottles>
# https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Bottles.md
bottle do
root_url "http://mikemcquaid.com" # Optional root to calculate bottle URLs
prefix "/opt/homebrew" # Optional HOMEBREW_PREFIX in which the bottles were built.
Expand Down Expand Up @@ -413,8 +412,8 @@ def plist; nil; end

__END__
# Room for a patch after the `__END__`
# Read in the wiki about how to get a patch in here:
# https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook
# Read about how to get a patch in here:
# https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# In short, `brew install --interactive --git <formula>` and make your edits.
# Then `git diff >> path/to/your/formula.rb`
# Note, that HOMEBREW_PREFIX will be replaced in the path before it is
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def generate!
def template; <<-EOS.undent
require "formula"
# Documentation: https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# #{HOMEBREW_CONTRIB}/example-formula.rb
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Brewing:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
open https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook
open https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
Further help:
man brew
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/cmd/tap-readme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def tap_readme
Docs
----
`brew help`, `man brew`, or the Homebrew [wiki][].
`brew help`, `man brew`, or the Homebrew [docs][].
[wiki]:http://wiki.github.com/Homebrew/homebrew
[docs]:https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/README.md#readme
EOS

puts template if ARGV.verbose?
Expand Down
10 changes: 5 additions & 5 deletions Library/Homebrew/manpages/brew.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ Note that these flags should only appear after a command.
Pass `--all` to get information on all formulae, or `--installed` to get
information on all installed formulae.

See the wiki for examples of using the JSON:
<https://github.com/Homebrew/homebrew/wiki/Querying-Brew>
See the docs for examples of using the JSON:
<https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Querying-Brew.md>

* `install [--debug] [--env=<std|super>] [--ignore-dependencies] [--only-dependencies] [--cc=<compiler>] [--build-from-source] [--devel|--HEAD]` <formula>:
Install <formula>.
Expand Down Expand Up @@ -441,8 +441,8 @@ by default:
$ ls $(brew --repository)/Library/Contributions/cmd

Documentation for the included external commands as well as instructions for
creating your own can be found on the wiki:
<http://wiki.github.com/Homebrew/homebrew/External-Commands>
creating your own can be found in the docs:
<https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/External-Commands.md>

## SPECIFYING FORMULAE

Expand Down Expand Up @@ -598,7 +598,7 @@ If your proxy requires authentication:

## SEE ALSO

Homebrew Wiki: <http://wiki.github.com/Homebrew/homebrew/>
Homebrew Documentation: <https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/>

`git`(1), `git-log`(1)

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.linux?
end

if OS.mac?
ISSUES_URL = "https://github.com/Homebrew/homebrew/wiki/troubleshooting"
ISSUES_URL = "https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting"
PATH_OPEN = "/usr/bin/open"
elsif OS.linux?
ISSUES_URL = "https://github.com/Homebrew/linuxbrew/wiki/troubleshooting"
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/xcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def uncached_version
when 2327..2333 then "3.2.5"
when 2335
# this build number applies to 3.2.6, 4.0 and 4.1
# https://github.com/Homebrew/homebrew/wiki/Xcode
# https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Xcode.md
"4.0"
else
case (MacOS.clang_version.to_f * 10).to_i
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ What Packages Are Available?

More Documentation
------------------
`brew help` or `man brew` or check our [wiki][].
`brew help` or `man brew` or check our [documentation][].

Troubleshooting
---------------
First, please run `brew update` and `brew doctor`.

Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/homebrew/wiki/troubleshooting).
Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Troubleshooting.md).

**If you don't read these it will take us far longer to help you with your problem.**

Expand All @@ -42,7 +42,7 @@ We accept tips through [Gittip][tip].
[![Gittip](https://img.shields.io/gittip/Homebrew.svg?style=flat)](https://www.gittip.com/Homebrew/)

[home]:http://brew.sh
[wiki]:https://github.com/Homebrew/homebrew/wiki
[documentation]:https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/
[mistydemeo]:https://github.com/mistydemeo
[adamv]:https://github.com/adamv
[jacknagel]:https://github.com/jacknagel
Expand Down
114 changes: 114 additions & 0 deletions share/doc/homebrew/Acceptable-Formulae.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Acceptable Formulae
Some formulae should not go in
[Homebrew/homebrew](https://github.com/Homebrew/homebrew). But there are
additional [Interesting Taps & Branches](Interesting-Taps-&-Branches.md) and anyone can start his/her
own!

### We try hard to avoid dupes in Homebrew/homebrew
Stuff that comes with OS X or is a library that is provided by
[RubyGems, CPAN or PyPi](http://github.com/Homebrew/homebrew/wiki/Gems,-Eggs-and-Perl-Modules)
should not be duplicated. There are good reasons for this:

* Duplicate libraries regularly break builds
* Subtle bugs emerge with duplicate libraries, and to a lesser extent,
duplicate tools
* We want our formulae to work with what comes with OS X

There are exceptions:

* Programs that a user will regularly interact with directly, like editors and
language runtimes
* Libraries that provide functionality or contain security updates not found in
the system version
* Things that are **designed to be installed in parallel to earlier versions of
themselves**

#### Examples

Formula | Reason
--- | ---
ruby, python | People want newer versions
bash | OS X's bash is stuck at 3.2 because newer versions are licensed under GPLv3
zsh | This was a mistake, but it’s too late to remove it
emacs, vim | [Too popular to move to dupes](https://github.com/Homebrew/homebrew/pull/21594#issuecomment-21968819)
subversion | Originally added for 10.5, but people want the latest version
libcurl | Some formulae require a newer version than OS X provides
openssl | OS X's openssl is deprecated
libxml2 | Historically, OS X's libxml2 has been buggy

We also maintain [a tap](https://github.com/Homebrew/homebrew-dueps) that
contains many duplicates not otherwise found in Homebrew.

### We don’t like tools that upgrade themselves
Software that can upgrade itself does not integrate well with Homebrew's own
upgrade functionality.

### We don’t like install-scripts that download things
Because that circumvents our hash-checks, makes finding/fixing bugs
harder, often breaks patches and disables the caching. Almost always you
can add a resource to the formula file to handle the
separate download and then the installer script will not attempt to load
that stuff on demand. Or there is a command line switch where you can
point it to the downloaded archive in order to avoid loading.

### We don’t like binary formulae
Our policy is that formulae in the core repository
([Homebrew/homebrew](https://github.com/Homebrew/homebrew)) must be built
from source. Binary-only formulae should go to
[Homebrew/homebrew-binary](https://github.com/Homebrew/homebrew-binary).

### Stable versions
Formulae in the core repository should have a stable version tagged by
the upstream project. Tarballs are preferred to git checkouts, and
tarballs should include the version in the filename whenever possible.

Software that does not provide a stable, tagged version, or had guidance to
always install the most recent version, should be put in
[Homebrew/homebrew-headonly](https://github.com/Homebrew/homebrew-headonly).

### Bindings
First check that there is not already a binding available via
[`gem`](http://rubygems.org/) or [`pip`](http://www.pip-installer.org/)
etc..

If not, then put bindings in the formula they bind to. This is more
useful to people. Just install the stuff! Having to faff around with
foo-ruby foo-perl etc. sucks.

### Niche (or self-submitted) Stuff<a name="Niche_Stuff"></a>
The software in question must be
* maintained
* known
* stable
* used
* have a homepage

We will reject formulae that seem too obscure, partly because they won’t
get maintained and partly because we have to draw the line somewhere.

We frown on authors submitting their own work unless it is very popular.

Don’t forget Homebrew is all git underneath! Maintain your own fork or
tap if you have to!

### Stuff that builds a .app
Don’t make your formula build an `.app` (native OS X Application), we
don’t want those things in Homebrew. Make it build a command line tool
or a library. However, we have a few exceptions to that, e.g. when the
App is just additional to CLI or if the GUI-application is non-native
for OS X and/or hard to get in binary elsewhere (example: font forge).
Check out the [homebrew-cask](https://github.com/phinze/homebrew-cask)
project if you’d like to brew native OS X Applications.

### Building under “superenv” is best
The “superenv” is code Homebrew uses to try to minimize finding
undeclared dependencies accidentally. Some formulae will only work under
the original “standard env” which is selected in a formula by adding
`env :std`. The preference for new formulae is that they be made to
work under superenv (which is the default) whenever possible.

### Sometimes there are exceptions
Even if all criteria are met we may not accept the formula.
Documentation tends to lag behind current decision-making. Although some
rejections may seem arbitrary or strange they are based from years of
experience making Homebrew work acceptably for our users.
74 changes: 74 additions & 0 deletions share/doc/homebrew/Bottles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Bottles
Bottles are Homebrew's binary packages. They are produced by installing a formula with `brew install --build-bottle $FORMULA` and then bottling it with `brew bottle $FORMULA`. This outputs the bottle DSL which should be inserted into the formula file.

## Bottle Usage
If a bottle is available and usable it will be downloaded and poured automatically when you `brew install <formula>`. If you wish to disable this you can do it by specifying `--build-from-source` or set `export HOMEBREW_BUILD_FROM_SOURCE=1` environment variable.

Bottles will not be used if the user requests it (see above), if the formula requests it (with `pour_bottle?`), if any options are specified on installation (bottles are all compiled with default options), if the bottle is not up to date (e.g. lacking a checksum) or the bottle's `cellar` is not `:any` or equal to the current `HOMEBREW_CELLAR`.

### Local Bottle Usage
Bottles can also be cached locally and installed by path e.g. `brew install /Library/Caches/Homebrew/qt-4.8.4.mountain_lion.bottle.1.tar.gz`.

## Bottle Creation
Bottles are currently created using the [Brew Test Bot](Brew-Test-Bot.md). We will be slowly adding them to all formulae.

By default, bottles will be built for the oldest CPU supported by the OS/architecture you're building for. (That's Core 2 for 64-bit OSs, Core for 32-bit.) This ensures that bottles are compatible with all computers you might distribute them to. If you *really* want your bottles to be optimized for something else, you can pass the `--bottle-arch=` option to build for another architecture - for example, `brew install foo --bottle-arch=penyrn`. Just remember that if you build for a newer architecture some of your users might get binaries they can't run and that would be sad!

## Bottle Format
Bottles are simple gzipped tarballs of compiled binaries. Any metadata is stored in a formula's bottle DSL and in the bottle filename (i.e. MacOS version, revision).

## Bottle DSL (Domain Specific Language)
Bottles have a DSL to be used in formulae which is contained in the `bottle do ... end` block.

A simple (and typical) example:
```ruby
bottle do
sha1 'd3d13fe6f42416765207503a946db01378131d7b' => :mountain_lion
sha1 'cdc48e79de2dee796bb4ba1ad987f6b35ce1c1ee' => :lion
sha1 'a19b544c8c645d7daad1d39a070a0eb86dfe9b9c' => :snow_leopard
end
```

A full example:
```ruby
bottle do
root_url 'http://mikemcquaid.com'
prefix '/opt/homebrew'
cellar '/opt/homebrew/Cellar'
revision 4
sha1 'd3d13fe6f42416765207503a946db01378131d7b' => :mountain_lion
sha1 'cdc48e79de2dee796bb4ba1ad987f6b35ce1c1ee' => :lion
sha1 'a19b544c8c645d7daad1d39a070a0eb86dfe9b9c' => :snow_leopard
sha1 '583dc9d98604c56983e17d66cfca2076fc56312b' => :snow_leopard_32
sha1 '2ef5f57afae319a3e7618d5723059eae568276fa' => :leopard
end
```

### `root_url`
Optionally contains the URL root used to calculate bottle URLs.
By default this is omitted and the Homebrew default bottle URL root is used. This may be useful for taps which wish to provide bottles for their formulae or to cater for a non-default `HOMEBREW_CELLAR`.

### `cellar`
Optionally contains the value of `HOMEBREW_CELLAR` in which the bottles were built.
Most compiled software contains references to its compiled location so cannot be simply relocated anywhere on disk. If this value is `:any` this means that the bottle can be safely installed in any Cellar as it did not contain any references to its installation Cellar. This can be omitted if a bottle is compiled (as all default Homebrew ones are) for the default `HOMEBREW_CELLAR` of `/usr/local/Cellar`

### `prefix`
Optionally contains the value of `HOMEBREW_PREFIX` in which the bottles were built.
See description of `cellar`. When `cellar` is `:any` prefix should be omitted.

### `revision`
Optionally contains the revision of the bottle.
Sometimes bottles may need be updated without bumping the version of the formula e.g. a new patch was applied. In that case the revision will have a value of 1 or more.

### `sha1`
Contains the SHA-1 of bottle for a particular version of OS X.

## Formula DSL
Additionally there is a method available in the formula DSL.

### `pour_bottle?`
Optionally returns a boolean to decide whether a bottle should be used for this formula.
For example a bottle may break if another formula has been compiled with non-default options so this method could check for that case and return `false`.

## Planned Improvements
Most bottle features have been (and planned improvements will be) implemented by @mikemcquaid. Contact him directly with questions.
40 changes: 40 additions & 0 deletions share/doc/homebrew/Brew-Test-Bot-For-Core-Contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Brew Test Bot For Core Contributors
If a build has run and passed on `brew test-bot` then it can be used to quickly bottle formulae.

There are three types of Jenkins jobs:

## Homebrew
This job automatically builds anything committed to the master branch. On
failure it sends an email to `brew-test-bot@googlegroups.com`. It tests rather than builds bottles.

## Homebrew Pull Requests

This job automatically builds any pull requests submitted to Homebrew/homebrew. On
success or failure it updates the pull request status (see more details on the
[main Brew Test Bot wiki page](Brew-Test-Bot)). On a successful build it automatically uploads bottles.

## Homebrew Testing

This job is manually triggered to run
[`brew-test-bot.rb`](https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/cmd/brew-test-bot.rb)
on with user-specified parameters. On a successful build it automatically uploads bottles.

You can manually start this job with parameters to run [`brew-test-bot`](https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/cmd/brew-test-bot.rb) with the same parameters. It's often useful to pass a pull request URL, a commit URL, a commit SHA-1 and/or formula names to have `brew-test-bot` test them, report the results and produce bottles.

## Bottling
To pull and bottle a pull request with `brew pull`:

1. Ensure the job has already completed successfully.
2. Run `brew pull --bottle 12345` where `12345` is the pull request number (or URL). If it complains about a missing URL with `BrewTestBot` in it then the bottles have not finished uploading yet; wait and try again later.
3. Run `brew fetch --force-bottle $FORMULAE` to check the SHA-1 in the bottled formulae match the uploaded files.
4. Run `git push` to push the commits.

To bottle a test build or pull request without `brew pull`:

1. Ensure the job has already completed successfully.
2. For testing builds note the job number (e.g. `123`). For pull request builds note the pull request number (e.g. `45678`).
3. Run `git fetch --tags https://github.com/BrewTestBot/homebrew.git`
4. For testing builds run `git merge testing-123` (where `123` is the testing job number). For pull requests builds run `git merge pr-45678` (where `45678` is the pull request number).
5. Run `git rebase origin/master` to get rid of any nasty merge commits.
6. Run `brew fetch --force-bottle $FORMULAE` to check the SHA-1 in the bottled formulae match the uploaded files.
7. Run `git push` to push the commits.
Loading

0 comments on commit 19d12ae

Please sign in to comment.