cut v0.58.0
[Homebrew/homebrew-cask-versions.git] / CONTRIBUTING.md
blob8362bab32fa3fd1da2f6a2de8b31e83d00f60b81
1 # How To Contribute
3 So you want to contribute to the project. **THIS IS GREAT NEWS!**  Seriously. We're all pretty happy about this. Here’s how to get started:
5 * [Getting Set Up To Contribute](#getting-set-up-to-contribute)
6 * [Adding a Cask](#adding-a-cask)
7 * [Testing Your New Cask](#testing-your-new-cask)
8 * [Finding a Home For Your Cask](#finding-a-home-for-your-cask)
9 * [Submitting Your Changes](#submitting-your-changes)
10 * [Cleaning up](#cleaning-up)
11 * [Reporting Bugs](README.md#reporting-bugs)
13 ## Getting Set Up To Contribute
15 1. Fork the repository in GitHub with the `Fork` button.
17 2. Add your GitHub fork as a remote for your homebrew-cask Tap:
19 ```bash
20 $ github_user='<my-github-username>'
21 $ cd "$(brew --repository)"/Library/Taps/caskroom/homebrew-cask
22 $ git remote add "$github_user" "https://github.com/$github_user/homebrew-cask"
23 ```
25 ## Adding a Cask
27 Making a Cask is easy: a Cask is a small Ruby file.
29 ### Examples
31 Here’s a Cask for `Alfred.app` as an example. Note that you may repeat the `app` stanza as many times as you need, to define multiple apps:
33 ```ruby
34 cask :v1 => 'alfred' do
35   version '2.3_264'
36   sha256 'a32565cdb1673f4071593d4cc9e1c26bc884218b62fef8abc450daa47ba8fa92'
38   url 'https://cachefly.alfredapp.com/Alfred_2.3_264.zip'
39   name 'Alfred'
40   homepage 'http://www.alfredapp.com/'
41   license :freemium
43   app 'Alfred 2.app'
44   app 'Alfred 2.app/Contents/Preferences/Alfred Preferences.app'
45 end
46 ```
48 Here is another Cask for `Unity.pkg`:
50 ```ruby
51 cask :v1 => 'unity' do
52   version '4.5.4'
53   sha256 '6fb72bfacf78df072559dd9a024a9d47e49b5717c8f17d53f05e2fc74a721876'
55   url 'http://netstorage.unity3d.com/unity/unity-4.5.4.dmg'
56   name 'Unity'
57   name 'Unity3D'
58   homepage 'http://unity3d.com/unity/'
59   license :commercial
61   pkg 'Unity.pkg'
63   uninstall :pkgutil => 'com.unity3d.*'
64 end
65 ```
67 And here is one for `Firefox.app`. Note that it has an unversioned download (the download `url` does not contain the version number, unlike the example above). It also suppresses the checksum with `sha256 :no_check` (necessary since the checksum will change when a new distribution is made available). This combination of `version :latest` and `sha256 :no_check` is currently the preferred mechanism when an unversioned download URL is available:
69 ```ruby
70 cask :v1 => 'firefox' do
71   version :latest
72   sha256 :no_check
74   url 'https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US'
75   name 'Firefox'
76   homepage 'https://www.mozilla.org/en-US/firefox/'
77   license :mpl
79   app 'Firefox.app'
80 end
81 ```
83 ### Generating a Token for the Cask
85 The Cask **token** is the mnemonic string people will use to interact with the Cask via `brew cask install`, `brew cask search`, etc. The name of the Cask **file** is simply the token with the extension `.rb` appended.
87 The easiest way to generate a token for a Cask is to run this command:
89 ```bash
90 $ "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/developer/bin/generate_cask_token" '/full/path/to/new/software.app'
91 ```
93 If the software you wish to Cask is not installed, or does not have an associated App bundle, just give the full proper name of the software instead of a pathname:
95 ```bash
96 $ "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/developer/bin/generate_cask_token" 'Google Chrome'
97 ```
99 If the `generate_cask_token` script does not work for you, see [Cask Token Details](#cask-token-details).
101 ### The `brew cask create` Command
103 Once you know the token, create your Cask with the handy-dandy `brew cask create` command.
105 ```bash
106 $ brew cask create my-new-cask
109 This will open `$EDITOR` with a template for your new Cask, to be stored in the file `my-new-cask.rb`. Running the `create` command above will get you a template that looks like this:
111 ```ruby
112 cask :v1 => 'my-new-cask' do
113   version ''
114   sha256 ''
116   url ''
117   name ''
118   homepage ''
119   license :unknown
121   app ''
125 ### Cask Stanzas
127 Fill in the following stanzas for your Cask:
129 | name               | value       |
130 | ------------------ | ----------- |
131 | `version`          | application version; give the value `:latest` if an unversioned download is available
132 | `sha256`           | SHA-256 checksum of the file downloaded from `url`, calculated by the command `shasum -a 256 <file>`. Can be suppressed by using the special value `:no_check`. (see also [Checksum Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#checksum-stanza-details))
133 | `url`              | URL to the `.dmg`/`.zip`/`.tgz` file that contains the application. A [comment](doc/CASK_LANGUAGE_REFERENCE.md#when-url-and-homepage-hostnames-differ-add-a-comment) should be added if the hostnames in the `url` and `homepage` stanzas differ (see also [URL Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#url-stanza-details))
134 | `name`             | the full and proper name defined by the vendor, and any useful alternate names (see also [Name Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#name-stanza-details))
135 | `homepage`         | application homepage; used for the `brew cask home` command
136 | `license`          | a symbol identifying the license for the application. Valid category licenses include `:oss`, `:closed`, and `:unknown`. It is OK to leave as `:unknown`. (see also [License Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#license-stanza-details))
137 | `app`              | relative path to an `.app` bundle that should be linked into the `~/Applications` folder on installation (see also [App Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#app-stanza-details))
139 Other commonly-used stanzas are:
141 | name               | value       |
142 | ------------------ | ----------- |
143 | `pkg`              | relative path to a `.pkg` file containing the distribution (see also [Pkg Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#pkg-stanza-details))
144 | `uninstall`        | procedures to uninstall a Cask. Optional unless the `pkg` stanza is used. (see also [Uninstall Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#uninstall-stanza-details))
146 Additional stanzas you might need for special use-cases:
148 | name                   | value       |
149 | ---------------------- | ----------- |
150 | `prefpane`             | relative path to a preference pane that should be linked into the `~/Library/PreferencePanes` folder on installation
151 | `colorpicker`          | relative path to a ColorPicker plugin that should be linked into the `~/Library/ColorPickers` folder on installation
152 | `qlplugin`             | relative path to a QuickLook plugin that should be linked into the `~/Library/QuickLook` folder on installation
153 | `font`                 | relative path to a font that should be linked into the `~/Library/Fonts` folder on installation
154 | `service`              | relative path to a service that should be linked into the `~/Library/Services` folder on installation
155 | `binary`               | relative path to a binary that should be linked into the `/usr/local/bin` folder on installation
156 | `input_method`         | relative path to a input method that should be linked into the `~/Library/Input Methods` folder on installation
157 | `screen_saver`         | relative path to a Screen Saver that should be linked into the `~/Library/Screen Savers` folder on installation
158 | `suite`                | relative path to a containing directory that should be linked into the `~/Applications` folder on installation
159 | `container :nested =>` | relative path to an inner container that must be extracted before moving on with the installation; this allows us to support dmg inside tar, zip inside dmg, etc.
160 | `caveats`              | a string or Ruby block providing the user with Cask-specific information at install time (see also [Caveats Stanza Details](doc/CASK_LANGUAGE_REFERENCE.md#caveats-stanza-details))
162 Even more special-use stanzas are listed at [Optional Stanzas](doc/CASK_LANGUAGE_REFERENCE.md#optional-stanzas) and [Legacy Stanzas](doc/CASK_LANGUAGE_REFERENCE.md#legacy-stanzas).
164 ### SourceForge URLs
166 SourceForge projects are a common way to distribute binaries, but they provide many different styles of URLs to get to the goods.
168 We prefer URLs of this format:
171 http://downloads.sourceforge.net/sourceforge/$PROJECTNAME/$FILENAME.$EXT
174 Or, if it’s from [SourceForge.JP](http://sourceforge.jp/):
177 http://$STRING.sourceforge.jp/$PROJECTNAME/$RELEASEID/$FILENAME.$EXT
180 `$STRING` is typically of the form `dl` or `$USER.dl`.
182 If these formats are not available, and the application is Mac-exclusive (otherwise a command-line download defaults to the Windows version) we prefer the use of this format:
185 http://sourceforge.net/projects/$PROJECTNAME/files/latest/download
188 ### Personal Hosting Such as Dropbox
190 URLs from dropbox.com or cl.ly/cloudapp.com are not readily distinguishable as being controlled by the original software vendor. These URLs should be used only when given as such on the official project website.
192 Also make sure to give the URL for the binary download itself, rather than a preview page. (See <https://www.dropbox.com/help/201/en>.)
194 ### Some Providers Block Command-line Downloads
196 Some hosting providers actively block command-line HTTP clients (example: FossHub). Such URLs cannot be used in Casks.
198 ### Vendor URLs Are Preferred
200 When possible, it is best to use a download URL from the original developer or vendor, rather than an aggregator such as macupdate.com.
202 ### Cask Token Details
204 If a token conflicts with an already-existing Cask, authors should manually make the new token unique by prepending the vendor name. Example: [unison.rb](../master/Casks/unison.rb) and [panic-unison.rb](../master/Casks/panic-unison.rb).
206 If possible, avoid creating tokens which differ only by the placement of
207 hyphens.
209 To generate a token manually, or to learn about exceptions for unusual cases, see [cask_token_reference.md](doc/cask_token_reference.md).
211 ### Archives With Subfolders
213 When a downloaded archive expands to a subfolder, the subfolder name must be included in the `app` value.
215 Example:
217 1. Texmaker is downloaded to the file `TexmakerMacosxLion.zip`.
218 2. `TexmakerMacosxLion.zip` unzips to a folder called `TexmakerMacosxLion`.
219 3. The folder `TexmakerMacosxLion` contains the application `texmaker.app`.
220 4. So, the `app` stanza should include the subfolder as a relative path:
222   ```ruby
223   app 'TexmakerMacosxLion/texmaker.app'
224   ```
226 ### Style guide
228 All Casks and code in the homebrew-cask project should be indented using two spaces (never tabs).
230 If relevant, you may also use string manipulations to improve the maintainability of your Cask. Here’s an example from `Lynkeos.app`:
232 ```ruby
233 cask :v1 => 'lynkeos' do
234   version '2.10'
235   sha256 'bd27055c51575555a1c8fe546cf057c57c0e45ea5d252510847277734dc550a4'
237   url "http://downloads.sourceforge.net/project/lynkeos/lynkeos/#{version}/Lynkeos-App-#{version.gsub('.', '-')}.zip"
238   name 'Lynkeos'
239   homepage 'http://lynkeos.sourceforge.net/'
240   license :gpl
242   app "Lynkeos-App-#{version.gsub('.', '-')}/Lynkeos.app"
246 ## Testing Your New Cask
248 Give it a shot with `brew cask install my-new-cask`
250 Did it install? If something went wrong, `brew cask uninstall my-new-cask` and edit your Cask to fix it.
252 If everything looks good, you’ll also want to make sure your Cask passes audit with:
254 ```bash
255 brew cask audit my-new-cask --download
258 If your application and homebrew-cask do not work well together, feel free to [file an issue](https://github.com/caskroom/homebrew-cask/issues) after checking out open issues.
260 ## Finding a Home For Your Cask
262 We maintain separate Taps for different types of binaries. Our nomenclature is:
264 + **Stable**: The latest version provided by the developer defined by them as such.
265 + **Beta, Development, Unstable**: Subsequent versions to **stable**, yet incomplete and under development, aiming to eventually become the new **stable**.
266 + **Nightly**: Constantly up-to-date versions of the current development state.
267 + **Legacy**: Any **stable** version that is not the most recent.
268 + **Trial**: Date-limited version that stops working entirely after it expires, requiring payment to lift the limitation.
269 + **Freemium**: Gratis version that works indefinitely but with limitations that can be removed by paying.
270 + **Fork**: An alternate version of an existing project, with a based-on but modified source and binary.
271 + **Unofficial**: An *allegedly* unmodified compiled binary, by a third-party, of a binary that has no existing build by the owner of the source code.
272 + **Vendorless**: A binary distributed without an official website, like a forum posting.
273 + **Walled**: When the download URL is both behind a login/registration form and from a host that differs from the homepage.
275 ### Stable Versions
277 Stable versions live in the main repository at [caskroom/homebrew-cask](https://github.com/caskroom/homebrew-cask). They should run on the latest release of OS X or the previous point release (in 2014, for example, that meant Mavericks and Yosemite).
279 ### But There Is No Stable Version!
281 When an App is only available as beta, development, or unstable versions, or in cases where such a version is the general standard, then said version can go into the main repo.
283 ### Beta, Unstable, Development, Nightly, or Legacy Versions
285 When an App’s stable version already exists in the main repo, alternate versions can be submitted to [caskroom/homebrew-versions](https://github.com/caskroom/homebrew-versions).
287 ### Trial and Freemium Versions
289 Before submitting a trial, make sure it can be made into a full working version without the need to be redownloaded. If an App provides a trial but the only way to buy the full version is via the Mac App Store, it does not belong in any of the official repos. Freemium versions are fine.
291 ### Forks and Apps with conflicting names
293 Forks should have the vendor’s name as a prefix on the cask’s file name and token. For unrelated apps that share a name, the most popular one (usually the one already present) stays unprefixed. Since this can be subjective, if you disagree with a decision open an issue and make your case to the maintainers.
295 ### Unofficial, Vendorless, and Walled Builds
297 Please submit these to [caskroom/homebrew-unofficial](http://github.com/caskroom/homebrew-unofficial). If you’ve made an unofficial build and need a place to host it, contact our sister project [alehouse](https://github.com/alehouse).
299 ### Fonts
301 Font casks live in the [caskroom/homebrew-fonts](https://github.com/caskroom/homebrew-fonts) repository. See the font repo [CONTRIBUTING.md](https://github.com/caskroom/homebrew-fonts/blob/master/CONTRIBUTING.md)
302 for details.
304 ## Submitting Your Changes
306 Hop into your Tap and check to make sure your new Cask is there:
308 ```bash
309 $ cd "$(brew --repository)"/Library/Taps/caskroom/homebrew-cask
310 $ git status
311 # On branch master
312 # Untracked files:
313 #   (use "git add <file>..." to include in what will be committed)
315 #       Casks/my-new-cask.rb
318 So far, so good. Now make a feature branch that you’ll use in your pull request:
320 ```bash
321 $ git checkout -b my-new-cask
322 Switched to a new branch 'my-new-cask'
325 Stage your Cask with `git add Casks/my-new-cask.rb`. You can view the changes that are to be committed with `git diff --cached`.
327 Commit your changes with `git commit -v`.
329 ### Commit Messages
331 For any git project, some good rules for commit messages are:
333 * The first line is commit summary, 50 characters or less,
334 * Followed by an empty line
335 * Followed by an explanation of the commit, wrapped to 72 characters.
337 See [a note about git commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for more.
339 The first line of a commit message becomes the **title** of a pull request on GitHub, like the subject line of an email. Including the key info in the first line will help us respond faster to your pull.
341 For Cask commits in the homebrew-cask project, we like to include the Application name, version number (or `:latest`), and purpose of the commit in the first line.
343 Examples of good, clear commit summaries:
345 * `Add Transmission.app v1.0`
346 * `Upgrade Transmission.app to v2.82`
347 * `Fix checksum in Transmission.app Cask`
348 * `Add CodeBox Latest`
350 Examples of difficult, unclear commit summaries:
352 * `Upgrade to v2.82`
353 * `Checksum was bad`
355 ### Pushing
357 Push your changes to your GitHub account:
359 ```bash
360 $ github_user='<my-github-username>'
361 $ git push "$github_user" my-new-cask
364 If you are using [GitHub two-factor authentication](https://github.com/blog/1614-two-factor-authentication) and set your remote repository as HTTPS you will need to set up a personal access token and use that instead your password. See more on https://help.github.com/articles/https-cloning-errors#provide-access-token-if-2fa-enabled
366 ### Filing a Pull Request on GitHub
368 Now go to *your* GitHub repository at https://github.com/my-github-username/homebrew-cask, switch branch to your topic branch and click the `Pull Request` button. You can then add further comments to your pull request.
370 Congratulations! You are done now, and your Cask should be pulled in or otherwise noticed in a while.
372 ### Squashing
374 If your pull request has multiple commits which revise the same lines of code, it is better to [squash](http://davidwalsh.name/squash-commits-git) those commits together into one logical unit.
376 But you don’t always have to squash — it is fine for a pull request to contain multiple commits when there is a logical reason for the separation.
378 ## Cleaning up
380 After your Pull Request is away, you might want to get yourself back onto `master`, so that `brew update` will pull down new Casks properly.
382 ```bash
383 cd "$(brew --repository)"/Library/Taps/caskroom/homebrew-cask
384 git checkout master
387 Neat and tidy!
389 # <3 THANK YOU! <3