Commit Graph

1075 Commits

Author SHA1 Message Date
Paul Hinze f6f507b289 some refactoring around the new download strategy
- move the interface from top-level methods to hash arguments of URL to
   keep the cask DSL as skinny as possible
 - promote the Cask::Headers object up to a Cask::URL object that
   encapsulates all infornation about the URL
 - pull all knowledge about curl arguments into the DownloadStrategy,
   leaving URL to act as a value object to be queried for details
 - test at the DownloadStrategy level; setting up expected curl args
   and example casks
2013-12-15 13:18:47 -06:00
Paul Hinze 24a53c4af7 Merge pull request #1944 from jonahoffline/add_headers_download_strategy
Add DownloadStrategy with custom :headers support
2013-12-14 09:13:58 -06:00
Paul Hinze fd82e97fa1 Merge pull request #2085 from pstadler/master
Handle CaskAlreadyInstalledError more graceful
2013-12-14 07:10:22 -08:00
Paul Hinze 6fa34a8e3e Merge pull request #2051 from rolandwalker/uninstall_flags
flag handling consistent btw install/uninstall
2013-12-14 07:07:45 -08:00
Paul Hinze 0c6e97b8fd use absolute paths for all commands
closes #2029
2013-12-14 08:48:40 -06:00
Paul Hinze 4bfc09ec02 Merge pull request #2066 from halo/master
Configurable Caskroom location, see #475
2013-12-14 06:00:31 -08:00
Patrick Stadler cb11080468 CaskAlreadyInstalledError exits with 0 2013-12-14 14:10:57 +01:00
future e7d98677fe Added inline comment on option parser so that people won't forget about the documentation 2013-12-14 10:13:06 +01:00
Joel Kuzmarski 7432affc59 services support 2013-12-13 18:13:19 -06:00
Roland Walker 9b4805be4e Merge pull request #2026 from rolandwalker/safer_quit_uninst
safer test for currently running app
2013-12-13 13:54:38 -08:00
Paul Hinze 8870f7c1fc Merge pull request #2008 from kevinSuttle/colorpickers 2013-12-13 10:40:36 -06:00
Paul Hinze 0a0c4a2d8a remove use of caller 2013-12-13 08:56:59 -06:00
Jonah Ruiz c92890ecc9 Refactor similar method structure in dirs and files into one for re-use.
By using the name of the method calling fs_command we remove duplication
2013-12-13 04:14:54 -04:00
Kevin Suttle 6dff4a35db Add support for colorpicker type 2013-12-12 22:59:58 -05:00
Jonah Ruiz 06be4b0d8e Add DownloadStrategy and Cask::Headers for custom :headers support
accepts a :user_agent argument and/or multiple :cookies
  headers :user_agent => 'Netscape/1.0', :cookies => { :cookey => "r00t" }

Also adds a standalone :fake_user_agent for a default UserAgent (Chrome)
  fake_user_agent
References #1175, #958
2013-12-12 21:29:12 -04:00
future af408269cf Make caskroom configurable via command line argument 2013-12-12 12:31:57 +01:00
Roland Walker ce4b83984c flag handling consistent btw install/uninstall
This makes uninstall process flag arguments in the same manner
as install. Any argument with a leading dash is assumed to be a
flag, not a Cask.  Argument processing still needs work, unknown
flags and spelling errors are silently accepted.
2013-12-11 17:15:33 -05:00
Roland Walker be7cc838a7 safer test for currently running app
The previous version could fail if the specified bundle was not installed.
Here we tell "System Events" until determining it is safe to do otherwise.
2013-12-09 22:23:27 -05:00
Roland Walker 07b9eea19b refine & document order of uninstall keys
Proposed order - :script, :launchctl, :quit, :kext, :pkgutil, :files.  Quit
a process before attempting to unload an assocated kext, unload kext before
attempting to delete the associated file, etc.  Arguably :script fits
loically with :files near the end of the list.  However, we also have
:after_uninstall which implicitly fires immediately after :files.
Therefore, running :script early provides greater functionality.
2013-12-09 21:34:30 -05:00
Fernando Paredes 150c5bcf6f Merge pull request #2019 from rolandwalker/validate_uninstall_keys
validate keys given to :uninstall
2013-12-09 17:25:27 -08:00
Roland Walker bd9d680b03 check if kext is present before attempting unload
this is intended to address #1941
2013-12-09 19:37:07 -05:00
Roland Walker cf56f10555 add :quit key to uninstall check 2013-12-09 14:17:03 -05:00
Roland Walker dda6573d47 validate keys given to :uninstall
this should also be part of audit
2013-12-09 10:39:34 -05:00
Roland Walker 6d05664532 add :quit key to uninstall
The applescript is divided into two commands to keep from transiently
invoking the application in the case where it is not currently running.
2013-12-09 09:23:53 -05:00
Fernando Paredes 72ad901543 Merge pull request #2013 from NanoXD/WidgetSupport
Widget Support
2013-12-08 18:20:48 -08:00
Fernando Paredes 26154a0fb3 Merge pull request #2012 from phinze/verbose-pkg-install
support --verbose flag for pkg installer
2013-12-08 18:19:02 -08:00
Fernando Paredes d9c77c65cb Add support for installing Widgets 2013-12-08 09:28:56 -08:00
Paul Hinze d5b4c9d044 support --verbose flag for pkg installer
refs #1976
2013-12-08 10:36:17 -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
Paul Hinze 79aa1b7275 allow casks to support arbitrary blocks
this allows us to experiment with behavior that we may not want to
promote to an official feature just yet.

i'm thinking about stuff like #544, and other things i can't foresee

we'll have to be careful to not let this get out of hand, but i think
it could be helpful for cask authors to be able to try and problem solve
locally.
2013-12-05 21:02:59 -06:00
Paul Hinze f75c47e32f Merge pull request #1948 from phinze/non-ruby-backed-casks
support non-ruby-backed casks
2013-12-05 18:28:31 -08:00
Paul Hinze 5dba177bf1 Merge pull request #1860 from rolandwalker/fonts
add support for installing fonts
2013-12-05 18:27:02 -08:00
phinze 10db2d5d3c support non-ruby-backed casks
- brew cask list now displays casks without backing ruby files
- casks without a source are displayed as "caskname (!)"
- these casks can be uninstalled, with the caveat that it only removes
  their files from the caskroom (doesn't run pkg uninstall or anything,
  since there's no ruby file to define what to do)
2013-12-05 20:10:19 -06:00
Peter Jaros fb1e0ac245 Create qlplugindir during init. 2013-11-28 19:45:49 -05:00
Roland Walker 5da6e642bf add support for installing fonts 2013-11-26 08:38:43 -05:00
Fernando Paredes 26de3172a9 Merge pull request #1733 from lgarron/qlplugin
QuickLook Plugin Support
2013-11-25 16:00:10 -08:00
Reto Kaiser 70656ffd20 Use HOMEBREW_REPOSITORY instead of HOMEBREW_PREFIX to derive tapspath 2013-11-17 02:16:37 +01:00
phinze ca0dbf84a6 pull cask loading out into classes
- introduce Cask::Source to encapsulate different types of loading
   behind a consistent interface
 - mostly this is method-level reorg, kept refactoring of the internals
   of these methods to a minimum for this pass
 - this is preparatory cleanup for adding the ability to represent a
   cask without a backing ruby file
2013-11-16 13:40:51 -06:00
Lucas Garron ee30f839d2 QuickLook plugin support. 2013-11-14 20:26:07 -08:00
Shane Watson 0627d3a909 Use exit codes 2013-11-10 13:30:11 -08:00
phinze 1ba71a3554 remove empty app dirs from caskroom on uninstall
previously an install + uninstall would leave around an empty dir with
the app's name. now we clean that up.

refs #1461
2013-11-10 14:48:16 -06:00
Shane Watson 8ab01bc255 Guard against unspecified casks in CLI 2013-11-10 13:44:10 -06:00
Paul Hinze 0b09339fab Merge pull request #1537 from linc01n/info_with_caveats
Add caveats to info like homebrew
2013-11-10 08:52:27 -08:00
Shane Watson cf1b51d8f4 Change "while !" to until 2013-11-09 09:17:20 -08:00
Lincoln Lee 22ee53b1d3 Add caveats to info like homebrew 2013-11-09 18:45:50 +08:00
phinze 8feec1de14 new preferred sourceforge url style
- document sf link policy
 - change audit to accept old and new style links
 - need to keep old style links for projects where the 'latest' link
   does not point to something usable
 - link to official policy in audit warning message

refs #1436
2013-11-05 22:09:15 -06:00
Paul Hinze abb842bb44 Merge pull request #1499 from phinze/1035-fix-ambiguious-cask-load
use exact matching when loading a cask
2013-11-05 19:22:41 -08:00
phinze 58ac54ed29 use exact matching when loading a cask
fixes issue where casks with names that were a strict prefix of other
casks would always shadow them.

refs #1035
2013-11-05 21:07:52 -06:00
Paul Hinze 8baff93b12 Merge pull request #1462 from phinze/smarter-plist-parser
more robust plist parsing, and better error handling
2013-11-03 12:54:03 -08:00
phinze 27856b09f8 more robust plist parsing, and better error handling
hdiutil can output DMG agreement information before the output plist
xml, and our plist parser was choking on that text before the xml
started.

so now we scan to the beginning of an xml document before trying to
parse the xml.

also added much more explicit error handling around the plist parsing,
to hopefully catch related and future plist-related errors.

refs #914
2013-11-03 13:07:18 -06:00
phinze a1fa264465 brew cask list, when given args, list installed files
this mimics (and indeed steals code from) homebrew's behavior

refs #1417
2013-11-03 12:23:08 -06:00
phinze 02d1543a24 sudo the rmdir on pkg uninstall
fixes an issue we've hit where chmod 777 is insufficient to allow
Pathname#rmdir to work properly.

refs #1374
2013-10-31 19:33:48 -05:00
Tim Buchwaldt 0d12e96d16 Match non-patchlevel releases of Alfred 2013-10-25 20:48:03 +02:00
phinze 7ae7a18932 fixes to pkg uninstaller to prevent madness
- do not remove *all* symlinks from referenced dirs, only broken ones
 - restore dir permission after use so we don't leave behind 777 dirs
 - add some better testing around `Cask::Pkg`
 - clean up `FakeSystemCommand` interface in tests

refs #1274
2013-10-24 14:56:29 -05:00
phinze a9df0c4c45 fix: reinstall attempt nukes existing files
oopsie!
2013-10-23 19:36:06 -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
Kevin Deldycke cc4e796a74 Add new cask for Prey project.
This cask install the batch version of Prey package, as detailed in:
http://support.preyproject.com/kb/installation/how-to-deploy-prey-in-batch-mode-mac-os

As it requires an API key to be installed, a warning is displayed to the
user with an explanation on how to fix the issue.

Also added -E option to sudo invocation so environment variables can be
passed to the installer.

closes #953

Signed-off-by: phinze <paul.t.hinze@gmail.com>
2013-10-20 13:18:54 -05:00
phinze c03ada18ec support for nested containers
- this allows us to support casks for things like "dmg in zip" "zip in
   tar", etc, etc
 - a nested container can be any format that homebrew-cask supports
 - the existing container support is now referred to as a Cask's
   "primary container"
 - use the `nested_container` artifact type to indicate the relative
   path to a nested container that you wanted extracted
 - multiple layers of nesting should work with multiple nested_container
   directives (though this is untested as yet)
 - add SpeedDownload as the first cask to use this feature; refs #602
2013-10-19 16:20:00 -05:00
Fernando Paredes a16f12d268 Merge pull request #1181 from andizzle/checklink_bugfix
fix a small bug that could stop the check link process.
2013-10-17 07:01:19 -07:00
wenbin1989 89a0bf74b4 use /bin/ln instead of ln, to prevent link error
people who use GNU core utilities's ln doesn't have -h parameter, so ln -hfs will course error.
use /bin/ln instead of ln to prevent this error
2013-10-14 12:44:43 +08:00
Andy Zhang 70ffbc1b08 fix a small bug that could stop the check link process. 2013-10-09 12:23:24 +11:00
Adam Stankiewicz 590a7bb572 fix: Allow for underscores in urls
Signed-off-by: phinze <paul.t.hinze@gmail.com>
2013-10-07 20:03:44 -05:00
phinze 18fb8fc028 support custom prefpanedir option 2013-10-07 17:45:58 -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 def2ec4545 fix download to track with upstream api change 2013-09-24 12:54:32 -05:00
Benjamin Hawkes-Lewis ec18210887 Remove .DS_Store files when uninstalling packages
.DS_Store files (http://en.wikipedia.org/wiki/.DS_Store) may litter
directories installed with pkgutil preventing them testing as empty and
getting deleted. Delete them along with symlinks.
2013-09-23 11:54:49 +01: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
phinze 711e44b405 reverse default for SystemCommand's print option
we were setting it to false basically everywhere and it was getting
a little silly
2013-09-22 13:44:29 -05:00
phinze 49e29bcf61 require tmpdir to fix container error
the tests require tmpdir for themselves, which is why they didn't catch
this. i hate ruby libraries like this...
2013-09-22 13:06:06 -05:00
Paul Hinze 70ba5c43c0 pkg uninstall: support kernel extension unloading
this should complete support for `wav-tap` and finish out #839
2013-09-22 08:25:16 -05:00
Paul Hinze 357c49162c when uninstalling pkgs; sudo chmod before examining
this helps avoid a situation (which happened with `wav-tap`) where the
non-priveleged ruby code gets permision denied errors while examining the
contents of directories using `Pathname`.
2013-09-22 08:20:18 -05:00
Paul Hinze 21f1cc6544 naked pkg - save files with spaces properly 2013-09-22 08:19:34 -05:00
Paul Hinze 3c9423e8c6 naked pkg support + major container refactor
`Cask::Installer` was already much too complex, so I took this
opportunity to throw a `Cask::Container` abstraction around the
extraction part of the package install step.

It goes like this: a Cask's URL points to a Container of some sort. The
containers we currently support are: dmg, zip, tar, and (new) naked.
Naked refers to a raw file that just needs to be copied in place. This
currently just means a pkg file, but in the future it may expand.

A Container knows how to do two things: identify a path as being its
type (`Container.me?`) and extracting the contents of its container to
the proper destination for a Cask (`Container#extract`).

The first Cask we have that supports the naked pkg type is
`heroku-toolbelt`. (Thanks to @sheerun for the Cask definition.)

Other miscellania batched in with this refactor:

 - switched to an explicit require strategy rather than globbing
 - `Cask::Installer` is instantiated now to match its interface with
   other similar collaorators
 - simplified zip and tar identification to shorter strings rather than
   exact matches of full `file -Izb` output
 - `Cask::SystemCommand` gets explicit output redirection options
 - many rogue backticks replaced to properly use `SystemCommand`
 - fixed misnamed test file `link_checker_spec.rb`
 - remove some extraneous `after` clauses in tests; leaning more on
   `test/support/cleanup.rb` to uninstall for us
 - pkg uninstall `:files` gets a `-rf` to support removing dirs

refs #839 and #1043
2013-09-21 21:59:07 -05:00
billwanjohi 47ed885fc0 require software_spec in download.rb
another lib looking for formula_support
2013-09-14 16:52:39 -05:00
billwanjohi 5d6642ba13 fixes #1015: requires library with checksum method
homebrew did some library reorganization which broke brew-cask
this should fix it
2013-09-14 16:39:04 -05:00
phinze fbc246fa5c fix overzealous cask already created error
this prevented any cask being created via `brew cask create` that was a
suffix substring of an existing cask.

refs #998
2013-09-09 11:16:26 -05:00
Shane Delmore cb3d16ef48 Simplifying uri source validation. 2013-07-27 15:44:03 -07:00
Shane Delmore 8ccb22749d Merge branch 'master' into cask-strategy
* master: (75 commits)
  Update Shuttle from version 1.1.1 to 1.1.2
  no version but latest
  OSX port of the awesome gqrx SDR software
  SdrDx – OS X and Windows SDR Software
  Updates version for LibreOffice to 4.1
  Adds cask for Simon.app
  DSP Radio - Software Defined Radio for Mac OS X
  CuteSdr, the QT based SDR project from RF-Space.
  Updated to Zotero 4.0.9
  add maratis 3.21
  updated xld to 20130720
  Rename HexFiend.rb to hexfiend.rb
  Add latest Hex Fiend.
  Add AeroFS cask
  Update link option.
  Add cask for MongoHub (https://github.com/fotonauts/MongoHub-Mac)
  Add cask for Robomongo (http://robomongo.org)
  Add cask for MongoHub (https://github.com/fotonauts/MongoHub-Mac)
  Adding 'Google Earth'.
  Add link to OpenOffice
  ...
2013-07-26 12:15:43 -07:00
Shane Delmore 413aa0a0aa Renaming cask_title to requested_cask for clarity. 2013-07-26 12:00:27 -07:00
Shane Delmore 583559d84e Issue #6. Adding load from url feature. 2013-07-26 11:54:40 -07:00
phinze 171456dc98 support for install/uninstall
accepts a single argument, which is a relative path to a pkg
inside the extracted Cask; homebrew-cask will attempt to install this
pkg after the Cask is extracted via `installer`

because of the many different ways uninstallers work, this
has several features:

 - `:script`: a script in the Cask which serves as an uninstaller (e.g.
   Vagrant, VirtualBox), uses `:args`, and `:input` keys to interact
   with said script
 - `:pkgutil`: a regexp which captures all package_ids installed by this
   cask; homebrew-cask will list all files installed under these ids and
   remove them
 - `:launchctl`: a list of bundle_ids for services that should be
   removed by homebrew-cask
 - `:files`: a fallback list of files to manually remove; helps when
   uninstallers miss something

refs #661
2013-07-21 22:01:38 -05:00
Fernando Paredes 15f4688a4d Add -qq parameter to unzip to eradicate the unzip __MACOSX caution. 2013-07-21 12:34:57 -07:00
Shane Delmore 9405014011 Replacing regexp file test with File.file?. 2013-07-16 21:58:11 -07:00
Shane Delmore 429eb80cbe Adding support for local casks outside of the casks directory 2013-07-16 15:12:16 -07:00
Fernando Paredes 8f029257bf Merge pull request #415 from fanquake/cask-description-typo
Fix typo in Brew Cask description
2013-07-13 11:38:15 -07:00
Robert Curth ba52f6377e [#583] Auditing of cask download and checksums
closes #688
2013-07-07 09:06:02 -05:00
Keith Smiley 6404f82d09 Verify appdir after reading command line opts
Helps prevent default appdir from being created regardless of whether
the user configured it or not.

Closes #496
2013-06-15 20:13:05 -05:00
Michael Ford 3d1af71731 Fix typo in Brew Cask description 2013-06-01 01:12:31 +08:00
Vítor Galvão d933cf3b32 Merge pull request #385 from jamesaanderson/cask-template
Update cask template with shortened link syntax
2013-05-30 04:54:30 -07:00
Kristoffer Sachse ea5149cde9 Fix typo in usage explanation 2013-05-30 09:58:49 +03:00
James Anderson 11a2af136e Update cask template with shortened link syntax 2013-05-29 06:33:05 -07:00
phinze 3522952f22 clarify install sudo message
since we actually will use sudo if we have an installer
2013-05-27 10:35:44 -05:00
phinze 71c97bb2e4 support new one-arg link syntax
refs #304

going forward, casks should use

    link 'Foo.app'

rather than

    link :app, 'Foo.app'
2013-05-23 21:03:37 -05:00
Paul Hinze 9835591935 whoops! pass down force argument to installer
this was preventing the `brew cask install --force cask` syntax from
working

the test was wrong too - corrected that so now we're covered from future
breakage

refs #329
2013-05-14 18:08:59 -05:00
Paul Hinze 92dbff9b5f use absolute path to ln when linking
this is an attempt to avoid GNU `ln`, which is sometimes installed on
macs by users sick of dealing with the subtle differences of BSD tools
from the rest of the known universe.

refs #328
2013-05-14 12:28:50 -05:00
Paul Hinze a89494860a check for cask before unlinking during uninstall
this was exposed in #313 by @vitorgalvao in his attempt to update the
anvil cask; by adding a link to that cask, (which just so happens to be
the cask that we chose for our "already uninstalled message" test).

the fix is simply to move the "already uninstalled" check *before* we
start to unlink.
2013-05-12 19:55:30 -05:00
Paul Hinze 17026b6e93 don't reinstall already installed casks
thanks to @ccutrer for the catch; this implementation is based on his PR

refs #233
2013-05-11 23:32:17 -05:00
Paul Hinze 3991bd6839 a beta pkg installer
- the vagrant cask is our guinea pig
- works for me
- only basic testing at the moment
- i wanted to push something to get the gears turning on this

it turns out the concept is pretty simple. specify a list of pkgs to
install; borrow the patterns from linkables for that. then basically
just run "sudo installer"

refs #14
2013-05-11 23:01:59 -05:00
phinze fed2824c7f add bona fide `brew cask create` command
the create command opens up an editor with template to get started

remove --create override flag from `brew cask edit`

hopefully this will be more straightforward for contributors

refs #306
2013-05-11 19:24:17 -05:00
phinze a8b343b869 fix github links in `brew cask info`
refs #294
2013-05-11 14:02:53 -05:00
phinze ce94c6de2a update alfred linking to work with Alfred 2.0
i'm not going to worry about backwards compatibility with Alfred 1.X -
forward to the future!

closes #18
2013-05-11 13:53:10 -05:00
phinze d4cecf35c9 programmatically modify alfred scope
refs #18
2013-04-28 13:56:26 -05:00
phinze 0de91ed257 exclude __MACOSX dir when unzipping
should take care of #222
2013-04-28 11:38:09 -05:00
phinze 7a1a6a9308 support for caveats
i.e. custom messages printed after installing a cask

refs #218
2013-04-28 11:10:06 -05:00
phinze 021c6afb73 allow linkables to be set to none
sometimes it doesn't make sense for a cask to link anything out to the
Applications dir
2013-04-28 11:10:06 -05:00
Vince Cima 3f35ac095e brew cask audit will now throw a warning for any formula hosted on SourceForge that doesn't use desired URL format 2013-04-20 00:16:57 -04:00
phinze 3a20b320d0 fix issue where linkapps would double symlink
since ln was not using the -h it was following the target symlink
destination and deciding it was a destination directory. madness
ensued.

also test cleanup and more output and change linkables to use sets
2013-04-13 18:17:20 -05:00
phinze 6cb1afa246 add unlinkapps for cli access to revert linkapps 2013-04-13 14:17:00 -05:00
phinze e16e1622c0 automatically link on install / unlink on uninstall 2013-04-13 14:10:37 -05:00
Félix Saparelli dfd4ab2947 Fix linking error when .app filenames have spaces 2013-04-13 13:42:25 +12:00
phinze 37761138ea recursively chown caskroom dirs when creating
fixes #199
2013-04-12 10:09:46 -05:00
phinze 74bdbd8f10 Merge branch 'apps-in-spotlight'
Closes #188
Closes #99
2013-04-12 08:30:15 -05:00
phinze 3b416ce7b5 add audits into the build process
this way travis will be able to cover incoming pull requests of new
casks by running the audit on them. cool!

also:

- add checksums to audit
- fix missing checksums
2013-04-07 14:30:09 -05:00
phinze d92ca8fefd move Caskroom into opt for spotlight goodness 2013-04-07 12:56:55 -05:00
phinze 1585d52ddc linkapps 2.0 2013-04-07 12:56:55 -05:00
phinze 2427fd6dd5 make the Cask DSL resilient to unexpected methods
will help with introducing and removing features, since the Cask
definitions move with every `brew update` and track master but the code
to handle them requires an explicit release and a `brew upgrade brew-cask`

relates to #179
2013-04-07 12:04:39 -05:00
phinze bf33643526 create casks with `brew cask edit foo --create` 2013-04-04 16:24:26 -06:00
phinze 0fbe7a1a8d rework Cask.path so it can return hypothetical paths
introduces the concept of a default_tap which is where we assume cask
paths that do not exist will end up

this is plumbing to support the incoming `cask edit foo --create`
feature
2013-04-04 15:55:07 -06:00
phinze bdd6ead535 parens to fix syntastic warning 2013-04-04 15:52:50 -06:00
phinze b156c04b84 basic tests around edit 2013-04-04 14:24:28 -06:00
Paul Hinze e702a69b28 so long content_length
closes #131
2013-03-13 13:13:37 -05:00
Paul Hinze 93b63bd583 clean up and pull out link checker / audit common code 2013-03-13 13:03:12 -05:00
Paul Hinze 972ed76799 add fake HTTP HEAD checking for google code URLs
this allows google code urls to pass link checking.

refs #131
2013-03-13 12:42:54 -05:00
Paul Hinze 78834bfbd0 extract link checker from audit process
did not duplicate content lentgh check in preparation for the removal of
content_length as discussed in #131
2013-03-13 12:41:16 -05:00
phinze 0dbb81b0e1 rename 'open' -> 'home' to match homebrew
closes #167
2013-02-22 16:32:02 -06:00
phinze ff80676b29 add `brew cask info` command
thanks to @passcod for original implementation on his fork

refs #72
2013-02-17 14:25:23 -06:00
phinze f866a18725 add `brew cask open` command
thanks to @passcod for original implementation on his fork

refs #72
2013-02-17 14:07:59 -06:00
phinze 9189bd5be6 Out of the Cellar, into the Caskroom
Install casks into HOMEBREW_PREFIX/"Caskroom" instead of the Cellar.
This prevents us from colliding with normal Homebrew Formulae.

NOTE: this will be a breaking change, with the following effects:

- all installed casks will no longer be reported as installed
- orphans all existing casks in the Cellar
- no automated facility for cleanup or migration of existing casks

refs #38, where we can discuss the implications of this before cutting a
new release
2013-02-17 12:54:44 -06:00
Paul Hinze fca6c49beb Merge pull request #117 from passcod/options-support
Add options to the cli
2012-12-19 22:51:40 -08:00
Félix Saparelli 5ad6796bcd Add options to the cli
Options can be passed on the command-line and/or using
the HOMEBREW_CASK_OPTS environment variable (which has
lowest priority). There is a single --appdir=PATH option
right now, but this commit enables future awesomeness!

Other minor changes:

* `brew cask help` now returns the same thing as `brew cask`
  instead of saying there was “no such command as help”.

* The HEREDOC block now uses Homebrew's #undent instead of the
  customed-rolled #gsub version. Cleaner and more flexible.

* `Cask.set_appdir` has been renamed to `Cask.appdir=`. This
  is more Rubyish, and of little consequence (the only place
  it was previously used was in the tests).
2012-12-19 00:54:49 +13:00
phinze 0d1f831b79 Add checksum support to Casks.
`md5`, `sha1`, `sha256` all take a hexdigest string, e.g:
sha1 'f645e9da45a621415a07a7492c45923b1a1fd4d4'

`no_checksum` takes no argument, and indicates there is no checksum
for this cask. This is *not recommended*, and should only be used for
casks that have no versioned downloads.

`brew cask install` will complain if there is no sum provided (unless
`no_checksum` has been invoked), or if the sums do not match. It will
provide the computed checksum so the cask can be easily amended.

Adapted from @passcod's work in 82cc199ae6
2012-12-17 17:04:22 -07:00
phinze f1221be6c2 double gsub to properly get title for BootXChange
thanks to @passcod for this
2012-12-17 17:00:35 -07:00
phinze 97b715b27d demockify actions_tests 2012-11-25 15:49:16 -06:00
phinze c96ea20317 get linkapps tests de-mockified 2012-11-25 15:49:16 -06:00
phinze 3ad61a5d56 halfway through ripping out mocha 2012-11-25 15:49:09 -06:00
phinze 3ac3ae6360 fix linkapps and cleanup output
damn i'm getting burned by mocking in my tests - going to have to fix
something here
2012-11-21 17:53:15 -06:00
phinze 259ed643f9 fix dmg plist parsing problem
should take care of #104

this was a subtle one - after i reorganized the requires, plist/parser
was getting double required, which broke plist parsing and hence dmg
installs
2012-11-21 16:12:45 -06:00
phinze 2a22a74415 fix broken cask list 2012-11-20 10:21:28 -06:00
phinze 30b43437ab fix requires via modified libdir
should address #103
2012-11-20 09:00:42 -06:00
phinze 2f99d29693 brew cask audit
for a given cask:
 - checks required fields
 - checks URL responds successfully
 - checks content_length specified
2012-11-18 23:12:21 -06:00
phinze e2d074e216 separate Cask.all_titles from Cask.all 2012-11-18 23:11:22 -06:00
phinze 31719b32f5 clean up includes 2012-11-18 12:27:14 -06:00
phinze 9e509d289b uninstall no longer depends uses homebrew
- should make tests a bit more reliable
2012-11-18 12:17:50 -06:00
phinze 3539767745 fix uninstall to work with multiple casks at once
homebrew does internal caching in ARGV that prevents us from doing the
`ARGV.clear; ARGV << 'newarg'` trick twice.

rather than try to further reach in to homebrew's innards, i figure it's
better to just pass multiple arguments down to homebrew code at once,
since it already supports that

refs #47
2012-10-20 13:34:11 -05:00
phinze ab57da07ea add brew cask uninstall
this delegates to homebrew's uninstall to get its work done. vanilla
`brew uninstall` actually works, but this gives us a more consistent
interface.

as discussed in #47
2012-10-20 13:01:41 -05:00
phinze c40dc63737 fix typo in Cask.init :(
💩 this is what i get for doing things outside of test coverage

added a smoke test this time
2012-10-15 19:25:35 -05:00
phinze 55146b76d4 fix a missed reference to old HOME_APPS const 2012-10-15 19:13:06 -05:00
phinze 9b2f2c7ecd allow `brew cask linkapps` to accept arguments
arguments scope linkapps command to just those casks

also added unit tests around the CLI code - whee!
2012-10-15 18:45:55 -05:00
phinze 96cff81979 have linkapps recognizes apps in subdirs
should address #33

includes cleanup and tests

i'm not crazy about leaning on installing/uninstalling caffeine in the
tests. it makes for some unnecessarily heavy tests and downloads. but
i'd rather get tests in place first then fix the warts.
2012-10-15 18:28:36 -05:00
Sean T Allen 444973c5b4 Add cask for Jumpcut.
Jumpcut is a tgz file whose handling isn't currently supported.
This commit adds support for it.

The test for tar.gz and tar.bz are very similar and could probably
be refactored. Leaving that as an exercise for another time.
Should have more use cases before opening that up.
2012-10-14 04:30:39 -04:00
phinze c44192c1d3 eat ditto warnings
a cheap way to address #17.

i don't really like it, but after a bunch of research and
experimentation to figure out if we can skip `.Trashes` or remove it,
this was the best i could come up with.
2012-10-13 17:00:37 -05:00
phinze 1a7e278935 a bona fide cask install test; and more splitting
I chose Caffeine since it's relatively small to download. Eventually I'd
like to switch this up so we bundle a dmg, zip, etc that the test suite
wires in to verify that we do the Right Thing (tm) with all those file
types. Probably will want to support `file://` URLs in Casks to help us
for that use case.
2012-10-13 16:48:25 -05:00
phinze a0434184b0 basic testing and separation of the Cask DSL 2012-10-13 16:30:59 -05:00
phinze f35cda322c add test coverage and start to split up cask.rb
ahhhhh the joys of refactoring under test coverage
2012-10-13 16:17:52 -05:00
phinze ab564ef254 handle multiple casks with install
should address #52

includes better error handling if a nonexistent cask is referenced

first test-driven commit, suckas!
2012-10-13 15:28:59 -05:00
phinze f1932a4d8c OMG a test suite!
Just getting started of course, but this piggy backs on Homebrew's
testing strategy to give us a platform for a fully featured test suite.
Neato!

And the tests provide value right away, as I added some better error
handling to `Cask.load`.

Big things ahead. Just you wait.
2012-10-13 14:39:00 -05:00
phinze eb04e6784a properly recognize existing symlinks in linkapps
turns out a symlink of a directory is both a symlink and a directory, so
you have to test for symlink first if you want to catch it.

this should address #36
2012-10-10 13:46:51 -05:00
phinze 501d1bad58 consistently quote shell commands to handle spaces
addresses issues brought up in #34
2012-10-10 13:18:41 -05:00
phinze cf2470b96a fix a little typo that got in linkapps' way 2012-10-05 10:48:13 -05:00
Félix Saparelli f9ac30cf2d Fix broken linkapps command 2012-10-06 03:08:32 +13:00
Félix Saparelli 51e5760615 Allow wider definition for _zip?
Some zip files have a different definition, e.g.
Minecraft has:

    application/xml; charset=utf-8 compressed-encoding=application/zip;
      charset=binary; charset=binary

Most other zips have:

    application/x-empty; compressed-encoding=application/zip;
      charset=binary; charset=binary

But the result is the same. So now we test only for:

    compressed-encoding=application/zip; charset=binary; charset=binary
2012-09-24 16:26:50 +12:00
Félix Saparelli 4de758bca3 Add tap support to `edit` and `list`
Most notably, Cask.all returns an array of strings,
not of Cask instances. This makes things easier, as
well as faster, as there's no need to run map(&:to_s)
everywhere anymore.

self.path is a utility method which returns the path
of the cask from its title. There's something subtle
going in there:

 - If `cask_title` is fully qualified, e.g.
   "phinze-cask/alfred", it's straightforward.

 - If `cask_title` is only the name, e.g.
   "firefox-aurora", the name is matched from
   the full list (self.all) (which isn't sorted)
   and the first result is returned.

Hence, self.path with only the name is not precise.
There might be the possibility to apply heuristics
to do a better match (prefer phinze-cask, or maybe
installed casks?) but that's for another issue :-)

self.nice_listing is another utility method used
in `search` and `list`. It returns a list where
unique casks don't have a prefix, and duplicates
do. The prefix is the tap name. The list is then
sorted. For an example or two, look at the first
comment on phinze/#12.
2012-09-24 16:10:51 +12:00
Félix Saparelli 5b51542ccf Use puts_columns 2012-09-24 16:10:51 +12:00
Félix Saparelli 4a6e0b2513 Sort search results 2012-09-24 16:10:50 +12:00
Félix Saparelli 3d3207bf5d Add basic taps functionality; partial phinze/#12 support
Instead of only listing `Taps/phinze-cask/Casks`, now list
every taps that has a `Casks` directory. Might conflict with
a few commands for the moment, works OK with `brew cask search`.
2012-09-24 16:10:50 +12:00
phinze b45974c224 support `brew cask edit` 2012-09-21 23:32:19 -05:00
phinze 029bd855db support tar-bzip archives so we can add macvim 2012-09-21 23:05:10 -05:00
phinze 9e421ee368 ohai the success message 2012-09-21 23:04:53 -05:00
phinze ff6f5c75fa fix broken downloads due to changed interface
fixes #9
2012-08-25 21:22:52 -05:00
phinze 0962ab3b47 reference Casks from permanent home under Taps 2012-08-25 20:59:34 -05:00
phinze e342897a91 fix linkapps, which was making circular symlinks
whoopsie
2012-03-10 14:25:42 -06:00
phinze 5a0d1d5556 quick sketchy first release of code/ideas
this is a first draft of an idea i've had kicking around for awhile

pushing out some code so i can get a conversation started
2012-03-09 22:43:50 -06:00