358 Commits

Author SHA1 Message Date
Nathan Toone
6d318761d2 Delete pkgutil directories that are really files.
Sometimes, pkgutil will return actual files (usually .nib files) as if they were part of the directory.  Microsoft Office is an example of this: in a recent update the file `/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/SharedSupport/Microsoft Error Reporting.app/Contents/Resources/en.lproj/MainWindowAlt.nib` was returning from `/usr/sbin/pkgutil --only-dirs --files com.microsoft.package.component` even though it should have been a file instead of a directory.  This caused the `rmdir` command to fail.

This patch will check if we are trying to delete a “directory” that is really a “file” - and if we are, we just delete the file instead.  This will allow packages that get in this state to be uninstalled.  A unit test which can be run using `brew cask-tests` is also included.
2016-12-28 11:57:47 -07:00
Markus Reiter
3088faaf9c Fix error message when cask fails to install. 2016-12-16 18:22:04 +01:00
Markus Reiter
f02491180b Merge pull request #1618 from rwanyoike/cask-reinstall-order
cask reinstall: download and verify cask before uninstall
2016-12-09 17:24:05 +01:00
Markus Reiter
049206bf16 Merge pull request #1464 from reitermarkus/quit-with-launchctl
Use `launchctl` to get running processes by bundle ID.
2016-12-06 15:08:21 +01:00
Raymond Wanyoike
0d67e35fb7 cask reinstall: use fetch and stage steps from #1620 2016-12-05 12:08:55 +03:00
Markus Reiter
697340ff3b Merge pull request #1620 from reitermarkus/refactoring
Refactor Cask installer.
2016-12-05 09:27:32 +01:00
Markus Reiter
5cc7acee17 Merge pull request #1590 from reitermarkus/fail-if-app-source-already-exists
Fail if cask source already exists.
2016-12-05 09:22:00 +01:00
Markus Reiter
86a80c8a3d Use launchctl to get running processes by bundle ID. 2016-12-05 00:20:29 +01:00
Markus Reiter
5785f54f4b Revert install_artifacts if one artifact fails to install. 2016-12-04 23:19:15 +01:00
Markus Reiter
e6d9248787 Separate fetch and stage steps in Hbc::Installer. 2016-12-04 23:19:15 +01:00
Markus Reiter
7d7ca0cb1a Use Homebrew’s Emoji class in cask installer. 2016-12-04 23:19:15 +01:00
Markus Reiter
006f25d8cf Use Homebrew to detect if X11 is installed. 2016-12-04 23:19:15 +01:00
Raymond Wanyoike
55ef924e7a cask reinstall: download and verify cask before uninstall
Closes: caskroom/homebrew-cask#27075
2016-12-04 13:37:26 +03:00
Markus Reiter
e0b93f1537 Also fail if symlinked artifacts already exist. 2016-11-28 14:01:06 +01:00
Markus Reiter
e63efb3fe4 Warn when overwriting an artifact. 2016-11-28 14:01:06 +01:00
Markus Reiter
9a29bd35e6 Fail if cask source already exists. 2016-11-28 13:38:49 +01:00
Kaito Udagawa
63e7fb5cae cask: Delete package dir if it is symlink on the uninstall
When a Formula is converted into a Cask (e.g. osxfuse),
a symlink remains at the place of package dir.
This change ensure to remove such leftovers.
2016-11-22 03:10:42 +09:00
Markus Reiter
c7267b123d Merge pull request #1502 from reitermarkus/load-metadata-cask-file
Load cask file in `.metadata` directory directly.
2016-11-21 10:43:15 +01:00
Markus Reiter
cc7541cbc4 Merge pull request #1535 from umireon/cask-pkg-choice
Cask: Add the choices option to pkg stanza
2016-11-21 10:25:30 +01:00
Kaito Udagawa
df635c8259 cask: compact the code 2016-11-21 04:13:29 +09:00
Kaito Udagawa
0c22cc45e6 cask: Call Tempfile#close(true) with the choices file to ensure it deleted 2016-11-20 14:23:55 +09:00
Kaito Udagawa
2807202103 cask: use Tempfile and some style fixes 2016-11-19 14:52:38 +09:00
Markus Reiter
1834457272 Remove kernel extensions specified in uninstall :kext. 2016-11-19 01:53:26 +01:00
Markus Reiter
bd9755fd78 Load cask file in .metadata directory directly. 2016-11-18 23:02:58 +01:00
Kaito Udagawa
f4a3bc100b cask: add the choices option to pkg stanza
installer command accepts -applyChoiceChangesXML option to change
customize options on the GUI installer from the commandline.
(`man installer` for more detailed information)

The introduced option `choice` enables the choice changes to be supplied
via pkg stanza without tricks in preflight code.
2016-11-19 04:41:21 +09:00
Josh Hagins
c20d50fc7a hbc/cmd/style: bump rubocop-cask to 0.10.6 2016-11-15 11:57:10 -05:00
Markus Reiter
3a01fbadcd Merge pull request #1362 from reitermarkus/rubocop
Update RuboCop to 0.45.0.
2016-11-14 16:50:24 +01:00
Markus Reiter
ff96f7ec26 Fix detection of self-extracting .exe files. 2016-11-14 15:30:48 +01:00
Markus Reiter
c648518f35 Rename single line block parameters to acc/elem. 2016-11-13 23:36:04 +01:00
Markus Reiter
e9391481a8 Update RuboCop to 0.45.0. 2016-11-13 23:18:08 +01:00
Markus Reiter
84b2276fd8 Use guard clauses. 2016-11-13 23:00:47 +01:00
Markus Reiter
8241bbb15b Merge pull request #1475 from reitermarkus/fix-locations
Fix `Hbc::Locations` in tests.
2016-11-11 13:43:38 +01:00
Markus Reiter
8fea516dcd Merge pull request #1481 from reitermarkus/sudo-askpass
Support `SUDO_ASKPASS` environment variable in `brew cask`.
2016-11-11 10:56:05 +01:00
Markus Reiter
0b8a8cce28 Support SUDO_ASKPASS environment variable. 2016-11-11 00:30:05 +01:00
Mike McQuaid
c2815fbb9a Merge pull request #1381 from adzenith/patch-1
`brew doctor` recommends using cask to upgrade XQuartz
2016-11-10 21:05:21 +00:00
Markus Reiter
a0f9963391 Disallow running brew cask as root. 2016-11-10 15:01:29 +01:00
Markus Reiter
8dd8273d5e Remove unnecessary Hbc::Locations aliases. 2016-11-10 14:48:53 +01:00
Nikolaus Wittenstein
969ac3a9c6 brew doctor recommends using cask to upgrade XQuartz
Also changes exceptions.rb to use Formatter.url
2016-11-09 22:21:21 -05:00
Dorian
702d07917e Update the CaskAlreadyInstalledError with new reinstall command
e.g. this changes:

```
To re-install google-chrome, run:
  brew cask uninstall --force google-chrome && brew cask install google-chrome
```

To:

```
To re-install google-chrome, run:
  brew cask reinstall google-chrome
```
2016-11-09 15:08:12 +01:00
Mandar Gokhale
0e15ffff62 Correct a few typos
...and update man pages where applicable
2016-11-03 12:09:44 +00:00
Josh Hagins
2605521ca9 Merge pull request #1361 from jawshooah/cask/refactor-auditor
hbc/auditor: refactor and fix bug
2016-10-29 11:40:39 -04:00
buo
6a406763f3 Open incomplete download in append mode
Open the incomplete download in append mode instead of write mode.
Opening in write mode truncates the existing file, so curl keeps
restarting downloads instead of resuming the incomplete downloads.
2016-10-25 16:46:59 +09:00
Josh Hagins
3f3fa4d0f7 Merge pull request #1334 from jawshooah/cask/fix-tap-regex
hbc/qualified_token: simplify token parsing
2016-10-24 10:38:02 -04:00
Josh Hagins
b2870c2480 hbc/qualified_token: use regex captures instead of String#split 2016-10-24 09:50:33 -04:00
Josh Hagins
4ed51d8240 hbc/auditor: refactor and fix bug
Use instance methods to DRY things up, and fix a bug discovered in
caskroom/homebrew-cask#26067 where Casks with language blocks would
always fail audit.
2016-10-24 04:27:21 -04:00
Josh Hagins
b481ed73a0 Merge pull request #1252 from niw/fix_cask_command_changes_entire_directory_ownership
FIX: cask changes /usr/local ownership recursively
2016-10-24 01:21:08 -04:00
Josh Hagins
606a762344 Merge pull request #1248 from Git-Jiro/add_reinstall_cmd_to_cask
add cask reinstall command
2016-10-24 01:11:48 -04:00
Josh Hagins
44f1354d63 hbc/qualified_token: simplify token parsing
- Stop supporting archaic "user-repo/token" syntax
- Move regex for parsing tapped Cask token to tap_constants
2016-10-23 21:48:11 -04:00
Josh Hagins
512a0c950e Merge pull request #1355 from reitermarkus/fix-depends-on-test
Fix locally failing `depends_on` test.
2016-10-23 21:42:48 -04:00
Markus Reiter
c7a535de22 Refactor Hbc::UrlChecker test. 2016-10-23 22:58:01 +02:00