Commit graph

54 commits

Author SHA1 Message Date
Sébastien Gross
8ca2b12e92 Add :bsexec option to command.run
* Similar to `:sudo`, gives the ability to run an external command
  within a given context.
* Exposes `:bsexec` in DSL; not yet documented
* Fixes #7132 (mount dmg image fails if user does not have StartupItemContext(8))
2014-12-12 11:38:41 -05:00
Roland Walker
967aa22793 recast method destination_path as staged_path
* part of DSL 1.0 review
* `destination_path` was always a bit vague (it refers to
  Cask-specific, version-specific location under
  `/opt/homebrew-cask/Caskroom`)
* here renamed `staged_path` to match upcoming command verb
  `brew cask stage`
* rename also intended to reduce confusion when we implement
  copying as a configurable alternative to symlinking
* transitional `destination_path` methods to remain while
  Casks are converted (this was documented as a part of the
  DSL, and used by 39 Casks in main repo)
* unrelated variables containing "stage" recast for clarity
2014-10-18 12:23:36 -04:00
Roland Walker
e3f10f82b8 doc and tests for container :type
includes some minor tweaks/re-ordering in docs
2014-10-03 10:40:54 -04:00
Roland Walker
7986b0dbaf hide stderr messages from ditto against DMG 2014-09-30 10:16:58 -04:00
Roland Walker
0e7be245be Return Cask::SystemCommand::Result object
from Cask::SystemCommand.run

* stderr and stdout are now separated, though both are available
* :print_stderr is made the default, closer to previous behavior
* exit status can be read from the result object
* plist parsing is more naturally handled in the result object.
  The :plist argument to the run method was removed.
* whitespace
2014-09-27 08:59:08 -04:00
Roland Walker
41d9fc363c switch to %Q{} for complex quoting 2014-09-25 09:38:22 -04:00
Roland Walker
bb72723325 remove :print_stdout => false
this is the default, and need not be specified
2014-09-25 09:36:13 -04:00
Roland Walker
100285702b recast :print => true as :print_stdout => true
in Cask::SystemCommand
2014-09-25 09:31:05 -04:00
Roland Walker
49e6e6eb10 refactor :stderr => :silence
replace with :print_stderr => false

The double test on options[:print_stderr] in system_command.rb
is intentional, and temporary.
2014-09-25 09:23:27 -04:00
Roland Walker
dfcbd7154e docs, error msgs, tests for depends_on :formula
replacing depends_on_formula in DSL
2014-09-11 20:33:39 -04:00
Roland Walker
99d001afa4 add support for xar containers
references: #5442
2014-08-02 14:51:51 -04:00
Roland Walker
04fd5c0494 rename seven_zip.rb to better match class name 2014-08-02 11:19:04 -04:00
Roland Walker
aa0004d715 divide Cask::Container::Naked into explicit types
- Cask::Container::Pkg
- Cask::Container::Ttf
- Cask::Container::Otf

which are autodetected based on filetypes as with other
containers.  Cask::Container::Naked remains available
for explicit use in a container_type stanza.
2014-08-02 11:09:00 -04:00
Roland Walker
b84d605035 improve criteria extension method
casecmp was a bug as a substring could match
2014-08-02 11:03:20 -04:00
Roland Walker
04ea21e03c refactor GenericUnar container class
This is just a matter of semantics: renaming the abstract base
class `Cask::Container::UnarBase` so that it makes sense when
referring to it in a `container_type` stanza.
2014-07-31 11:18:50 -04:00
Roland Walker
f1cad8c7a2 Merge pull request #5517 from rolandwalker/pure_gzip_container
support pure gzip containers (not tar.gz)
2014-07-28 14:05:08 -04:00
Roland Walker
baba437ca1 Zip container does not need to require 'tmpdir' 2014-07-26 16:30:15 -04:00
Roland Walker
35e7997c35 support pure gzip containers (not tar.gz)
References: #5455
2014-07-26 15:58:49 -04:00
Roland Walker
06c9bae613 don't check error code of diskutil eject
nstead, determine success by directly testing the intended effect:
does the mount path still exist?

Also:
 - retry once on failure.
 - silent success if the given mount point did not exist.

These changes are intended to help with unpredictable problems with
the test suite that manifest frequently on Travis.

References: #4975, #4900, #4857
2014-06-19 11:57:01 -04:00
Roland Walker
87b670e5cd switch to diskutil for eject
Mostly to see if this reduces random Travis errors, but also
because `diskutil eject` is a documented interface, and
`hdiutil eject` is not.
2014-06-18 16:04:17 -04:00
Roland Walker
30c8412812 permit hdiutil to exit with error code
Mysterious `hdiutil` errors are a longtime problem with the
test suite, and the largest cause of false Travis failure
reports.

What appears to happen is that `hdiutil` returns a valid
plist output, but also exits with an error code.

Recently, user errors have been reported which seem to be
related to the same problem (#4857).

After #4892 and #4887, we have have more assurances that mount errors
will be caught elsewhere, if the XML is incorrect/missing, or if the
mounts are not returned.

So, for this special case, it should be safe to simply
ignore the error code from `hdiutil`.
2014-06-14 20:19:12 -04:00
Roland Walker
b9b41030b7 ensure more informative errors from dmg.rb
The logic for better errors was already there; this just makes
sure that another exceptional case is handled, and falls through
to the existing error-check.

References: #4857
2014-06-14 08:50:02 -04:00
Roland Walker
ba8d9ba4b5 fix some erroneous uses of casecmp
`casecmp` returns -1/0/1, never false or nil
2014-03-12 10:40:11 -04:00
Roland Walker
a8acf3de1a bugfix: preserve resource forks when unzipping
Use the unarchiving ability built into the `ditto` utility,
rather explicitly calling the `unzip` utility.  Fixes
caskroom/homebrew-fonts#90.
2014-03-11 08:46:38 -04:00
Roland Walker
15a4ca92e9 test if lsar is nil before attempting split
fixes #3332
2014-03-02 10:22:03 -05:00
muescha
d7341a79b5 better error message (same like at cabextract) 2014-02-26 00:08:18 +01:00
Roland Walker
c7e0e5b2e5 support Bzip2 containers
bzips of tarballs are already supported via `tar`.  This
adds support for a single file asset within a bzip2 container.
2014-02-25 16:36:36 -05:00
Roland Walker
9fa39c2681 add support for RAR containers
this will not pass Travis until #2744 is merged
2014-02-25 16:29:24 -05:00
Roland Walker
b90633d92a add support for Stuffit containers
This will not pass Travis until #2744 is merged
2014-02-25 12:54:49 -05:00
Roland Walker
a75a4840cf Add 7z container support
relevant Casks must use `depends_on_formula unar`
2014-02-25 12:32:37 -05:00
Roland Walker
297cd6382a Merge pull request #3058 from rolandwalker/exception_objects
raise exception objects
2014-02-25 12:30:30 -05:00
Roland Walker
a7647426ce Merge pull request #2467 from vmrob/adobe-air-apps
Add support for Adobe Air app container
2014-02-25 12:23:08 -05:00
Roland Walker
6f6a07fc0f mass whitespace cleanup 2014-02-22 21:13:52 -05:00
Roland Walker
60378bcc7e CaskError objects instead of strings, better msgs 2014-02-19 18:47:39 -05:00
Victor Robertson
026ca0c6e1 Add support for Adobe Air app installations
Adobe Air applications take the form of a .air file that the Adobe Air
runtime then installs and creates a .app -- typically in
/Applications.  This patch provides a new container for those .air
files which the Adobe Air runtime installs to the Caskroom as well as
tests for Adobe Air app installations.

Presently, if homebrew-cask doesn't detect the Adobe Air runtime, it
will provide an informative error message and instructions to obtain
it via `brew cask install adobe-air`.  This is obviously not ideal and
the installation process for the runtime should be automated in the
future.
2014-02-17 11:36:01 -06:00
Roland Walker
298d98d204 fixup #2872 2014-02-12 08:03:07 -05:00
Roland Walker
c5dd610f2a make criteria work again when cabextract missing
addresses an incidental report in #2467
2014-02-12 07:55:43 -05:00
Paul Hinze
9faa44e6cc Merge pull request #1992 from rolandwalker/core_fonts
CAB containers
2014-02-08 12:14:18 -06:00
Roland Walker
9a0751b33a realpath hygiene for external commands
For external commands which do not support the doubledash convention
(#2613), wrap file arguments in Pathname.new(file).realpath at the
very last minute.  This provides a guarantee against surprises caused
by unusual filenames which might be misinterpreted as flags.
2014-02-03 20:02:34 -05:00
Roland Walker
36ce20a4ee support CAB archives 2014-02-03 18:37:20 -05:00
Roland Walker
288805e6ea doubledash hygiene for external cmd: file 2014-01-31 13:05:10 -05:00
Roland Walker
6038fd221d doubledash hygiene for external cmd: ditto 2014-01-31 13:05:09 -05:00
Paul Hinze
0c6e97b8fd use absolute paths for all commands
closes #2029
2013-12-14 08:48:40 -06:00
Roland Walker
837f4932ec Allow naked OTF and TTF files, follow-up on #1860
This should not be needed for .qlgenerator or .prefPane, because
(like .app) those are always directories/bundles and therefore must
be transported in some type of container.
2013-12-06 16:11:33 -05:00
phinze
c85ef168fc require most commands to succeed; cleanup on install failure
- add `run!` method which raises if command does not succeed
- use `run!` when the command we are running must succeed for things to
  move forward. this should help produce clearer error messages in
  failure scenarios.
- move caveats earlier in the install process so reports can be made
  about potential failures
- remove the destination tree on cask install failure, so the cask will
  not be considered installed
2013-10-20 16:52:51 -05:00
phinze
c244385eb2 prefpane support; artifact refactor
= New Concept: Cask::Artifact

An Artifact is a file in an extacted container for which homebrew-cask
should take some sort of action on install/uninstall.

== Current artifacts:

 - App: link/unlink to ~/Applications
 - Pkg: install/uninstall (with sudo)
 - Prefpane: link/unlink to ~/Library/PreferencePanes

= New Feature: Preference Pane Handling

Specifying `prefpane 'MyApp.prefPane'` in a Cask causes it to be linked
on install to the correct location for it to show up in System
Preferences.

refs #69

= Removed Commands: linkapps/unlinkapps

These were old and mostly unused and don't really make much sense when
linking/unlinking happens automatically in the install process.

= Changed Behavior: stricter relative pathname requirement

With this refactor, we remove the fuzzy searching for a file in an
extracted container when that file was referenced from `link`
or `install`. There may be some casks that need to be updated due to
this change.
2013-10-07 13:51:42 -05:00
phinze
04c9b19775 whoops; input needs to be enumerable 2013-10-02 09:51:40 -05:00
phinze
bebcb22ab1 somewhere along the way we lost hdiutil accepting dmg agreements
should take care of #1105
also refs #720
2013-10-02 09:38:53 -05:00
phinze
95877c9d20 fix typo in tar container
refs #1083
2013-09-25 14:40:24 -05:00
phinze
a9cd8e7101 fix a few bugs around recent changes
- re-added a lost nil guard on `Dmg` containers
 - `FakeSystemCommand` was still returning an array of split lines
   instead of a string, even though its real counterpart switched to
   string when install/uninstall landed
 - flushed out an alfred cli bug
 - moved plist parsing down to SystemCommand layer
2013-09-22 14:44:31 -05:00