Check homepages of the casks and try to fix them.
The cask-homepage
script is designed to check homepages of the casks for
availability by checking their response statuses. It's useful in finding casks
that are no longer maintained or available. It also checks the URL for these
rules (in brackets) below and gives appropriate warnings if violated:
- Host has changed (host)
- Path has changed (path)
- Only HTTP is available (http)
- HTTPS is available (https)
- Server prefers to include WWW (www)
- Server prefers to exclude WWW (no_www)
- Server prefers to include a trailing slash (slash)
- Server prefers to exclude a trailing slash (no_slash)
- Missing a bare domain URL trailing slash (bare_slash)
The word in brackets represents the rule itself and can be found a warning in CSV or can be used with
-i, --ignore
option.
The script also can automatically fix those warnings when running it in
combination with the -f, --fix
option.
Since there are a lot of casks in Homebrew-Cask and Homebrew-Versions some of them can become unavailable due to various reasons which usually is reflected on the homepage. To help maintainers find such casks the weekly result of this script is available here:
- http://caskroom.victorpopkov.com/homebrew-cask/homepages.csv
- http://caskroom.victorpopkov.com/homebrew-versions/homepages.csv
Please note, that the lists are regenerated every week at 16:05 (GMT+0) on Saturday. Please double check before submitting a PR, to make sure that the cask hasn't been updated by someone else yet.
Use to specify a remote to pull from (defaults to 'upstream').
Use to specify a remote to push to (defaults to 'origin').
Use to specify a branch name to push to.
By default it's generated automatically when fixing mode is enabled using the
format: cask-homepage_<random>
. When you specify you own one, take into
account that all existing changes in this branch will be overwritten using
git push --force
.
Edit pushed changes.
This option can be used if you need to make pushed changes: for example if you already created a PR and you need to modify some of the casks.
It automatically pulls the selected branch from the origin
, asks which casks
to modify and launches the default editor to modify them. After making all the
changes it rebases them and pushes to the same branch again.
Set browser header.
By default User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36
is
used.
Output the results in CSV format into a file.
For example, to output a CSV list in your home directory:
cask-homepage -o ~/outdated.csv
Try to fix warnings automatically (optional: a total number of casks to fix).
Show and output all casks even if homepages are good.
By default, only the casks with homepage errors or warnings are shown on screen and added to the CSV file. This parameter forces to show all the casks even if the homepage is good.
Deletes local and remote branches named cask-homepage_<random>
.
Show current script version.
Show the usage message with options descriptions.
These are the warnings that are currently supported (rule itself is in brackets):
- Host has changed (host)
- Path has changed (path)
- Only HTTP is available (http)
- HTTPS is available (https)
- Server prefers to include WWW (www)
- Server prefers to exclude WWW (no_www)
- Server prefers to include a trailing slash (slash)
- Server prefers to exclude a trailing slash (no_slash)
- Missing a bare domain URL trailing slash (bare_slash)
If one of the enabled rules is violated one of the warnings from above will be shown. Each successfully checked cask can have multiple warnings.
It's also sometimes important to catch only those redirects that have a change in the host itself. This rule is a good way to find those.
Example:
Cask name: 1password
Cask homepage: https://agilebits.com/onepassword [301]
Status: warning
1. Host has changed → https://1password.com/onepassword
2. Redirect found → https://1password.com/
It helps to find URLs where the path has been changed.
Example:
Cask name: cura-beta
Cask homepage: https://ultimaker.com/en/products/software [301]
Status: warning
1. Path has changed → https://ultimaker.com/en/products/cura-software
Sometimes HTTPS version is no longer available so the URL redirects to HTTP version instead. This rule helps to catch this kind of redirects.
Example:
Cask name: doitim
Cask homepage: https://doit.im/ [302]
Status: warning
1. Only HTTP is available → http://doit.im/
Since the HTTPS is more preferred over the usual plain HTTP the script checks if it's available and gives an appropriate warning message if found. It will also check if it's available even if the host has been changed.
Example:
Cask name: 010-editor
Cask homepage: http://www.sweetscape.com/ [301]
Status: warning
1. HTTPS is available → https://www.sweetscape.com/
This rule checks whether server prefers to forcefully append a WWW to the URL.
Example:
Cask name: bee
Cask homepage: http://neat.io/bee/ [301]
Status: warning
1. Server prefers to include WWW → http://www.neat.io/bee/
This rule checks whether server prefers to forcefully remove a WWW from the URL.
Example:
Cask name: appcleaner
Cask homepage: https://www.freemacsoft.net/appcleaner/ [301]
Status: warning
1. Server prefers to exclude WWW → https://freemacsoft.net/appcleaner/
This rule checks whether server prefers to forcefully append a trailing slash to the URL.
Example:
Cask name: ghost
Cask homepage: https://ghost.org/downloads [301]
Status: warning
1. Server prefers to include a trailing slash → https://ghost.org/downloads/
This rule checks whether server prefers to forcefully remove a trailing slash from the URL. It ignores all the cases where bare_slash is needed.
Example:
Cask name: logoist
Cask homepage: http://www.syniumsoftware.com/logoist/ [301]
Status: warning
1. Server prefers to exclude a trailing slash → http://www.syniumsoftware.com/logoist
It's highly recommended to use a trailing slash in a bare domain URL like a homepage. However, most mainstream browsers "append a trailing slash" automatically to the request.
From RFC 2616:
Please note, that the absolute path cannot be empty; if none is present in the original URI, it MUST be given as "/" (the server root).
Example:
Cask name: 5kplayer
Cask homepage: https://www.5kplayer.com [200]
Status: warning
1. Missing a bare domain URL trailing slash → https://www.5kplayer.com/
This script can also fix all the issues automatically by creating a temporary branch and push all the changes there. It won't open a PR automatically so you can manually check it before submitting.
By default, when -f/--fix
flag is applied, it will fix all the casks. However,
you can specify the amount of casks to fix or fix only certain casks using:
cask-homepage -f <number> [<casks>...]
At the moment, the script doesn't fix the "host has been verified" comments, but
it supports quick PR editing using -e/--push-edit
flag so you can easily make
any changes to already existing branch:
cask-homepage -e
When using the -e/--push-edit
flag it will run the script in the interactive
mode where you can specify which of created branches and casks you would like to
edit and uses the default editor for that. After making all the changes to the
casks and commit descriptions it will automatically rebase and push all the
changes to the same branch again.
Since there are always some cases when applying one of the rules can break the URL or the given warning doesn't make the URL better, it's important to have an ability to manually disable some of them. In order to make it happen the XML configuration file is used that includes different rules to make it possible.
There are not many rules needed so there are only two main groups: skip and ignore.
In some rare cases, it's better to completely disable the homepage checking for some casks. When this rule is applied it will force the cask to be skipped during the checking process. The skipped casks won't be shown in the CSV list by default and only on the screen with "skipped" status.
You can ignore any warning specifically by using this rule. There are two ways to achieve that: ignore the rule only for a specific cask or ignore all of the casks that match the certain URL pattern.
By default you just have to cd
into the Casks directory and run the script. It
will automatically use all the rules by default and should only those casks that
have some warnings or errors.
$ cd ~/path/to/homebrew-cask/Casks
$ cask-homepage
Checking homepages of 3435 casks using these rules:
bare_slash enabled Missing a bare domain URL trailing slash
host enabled Host has changed
http enabled Only HTTP is available
https enabled HTTPS is available
no_slash enabled Server prefers to exclude a trailing slash
no_www enabled Server prefers to exclude WWW
path enabled Path has changed
slash enabled Server prefers to include a trailing slash
www enabled Server prefers to include WWW
---------------------------------------------------------------------------------------------------------------------------------------------
Cask name: 010-editor
Cask homepage: http://www.sweetscape.com/ [301]
Status: warning
1. HTTPS is available → https://www.sweetscape.com/
---------------------------------------------------------------------------------------------------------------------------------------------
Cask name: 1password
Cask homepage: https://agilebits.com/onepassword [301]
Status: warning
1. Host has changed → https://1password.com/onepassword
2. Path has changed → https://1password.com/
---------------------------------------------------------------------------------------------------------------------------------------------
Cask name: ableton-live
Cask homepage: https://ableton.com/en/live [301]
Status: warning
1. Server prefers to include WWW → https://www.ableton.com/en/live/
2. Server prefers to include a trailing slash → https://www.ableton.com/en/live/
...
In some cases it's useful to output all the found outdated casks into separate CSV lists:
- http://caskroom.victorpopkov.com/homebrew-cask/homepages.csv
- http://caskroom.victorpopkov.com/homebrew-versions/homepages.csv
In order to do that you have to cd
into the Casks directory and run the script
with -o
option and ~/path/to/output.csv
argument. For example:
cd ~/path/to/homebrew-versions/Casks
cask-homepage -o '~/path/to/output.csv'