Commit Graph

79 Commits

Author SHA1 Message Date
Roland Walker dd5d767b18 Merge pull request #4244 from rolandwalker/toplevel_dir_permissions
special case permissions when creating `/opt`
2014-05-07 22:36:42 -04:00
Roland Walker 1fe644f84f special case permissions when creating `/opt`
or any other toplevel directory. Closes #4187
2014-05-07 10:56:04 -04:00
Roland Walker 0153c19f7a Defend against unusual Homebrew setups
To aid in Tap transition.  Require Homebrew 0.9.5, rescue
`rename_tags_dir_if_necessary` (`respond_to?` won't work there
because `rename_tags_dir_if_necessary` is a private method.

References: #4192, @Jackiebo in #4096
2014-05-07 09:50:42 -04:00
Roland Walker fb1300366e automatically transition to new Tap name/location
At every command execution
- invoke `rename_taps_dir_if_necessary` to help with Homebrew's Tap migration.
  (Homebrew's migration seems to sometimes fail to fire, see #4096)
- untap `phinze/cask`, and tap `caskroom/cask`, to help with our own move
  to a GitHub organization
After a few months, this can be reverted.
2014-05-03 16:24:00 -04:00
Roland Walker 3ded5898b6 more reliable way to look up username
`ENV` is manipulable.  `getpwuid` is reliable.
2014-02-21 09:30:37 -05:00
Roland Walker 3ad2d6c31c create target directories on-demand
closes #2996.  Moves the logic for creating target directores
from init-time in cask.rb to install-time within the artifact
classes.  Removes the need for special-case mkpath for each
new artifact type.
2014-02-21 09:22:37 -05:00
Roland Walker 379f3e7c88 add missing `HOMEBREW_CACHE_CASKS.mkpath`
If `mkpath` must be done for the parent dir, then it certainly
must also be done for the child dir.
2014-02-05 09:57:35 -05:00
Roland Walker 3cc22374f9 doubledash hygiene for external cmd: sudo, AND
also includes doubledash hygiene for any child commands following each sudo
2014-01-31 12:58:39 -05:00
Roland Walker 2a450c3a07 make version number available within brew-cask
brew cask doctor was showing 1.8.7 as the homebrew-cask software version
2014-01-29 10:00:13 -05:00
Roland Walker ad31b17316 Merge pull request #2647 from jedahan/screensaver
initial screensaver work
2014-01-28 08:21:19 -08:00
Jonathan Dahan ca61dfdd81 Add support for screensaver artifact 2014-01-28 10:17:50 -05:00
Roland Walker 216444849e Add copious debugging with --debug
- add new file "cask/utils.rb" analogous to "utils.rb" in Homebrew
- define odebug and odumpcask, analogs of ohai and friends, but
  which only give output when --debug is in effect
- move the debug setting from an instance variable in Cask::CLI
  to a method Cask.debug, defined in "lib/cask/options.rb", which
  was added in #2276. (Perhaps options.rb should be merged back
  into Cask::CLI).
- sprinkle odebug statements liberally throughout the codebase
- update tests
2014-01-28 10:15:43 -05:00
Roland Walker 768b21eae8 always submit external commands in list form
For safety.
- This is a step toward reworking system_command.rb so that
invocations are done in list form on the back end, avoiding
surprises from quoting and shell metacharacters.
- There is one transitional hack here: the _quote method in
Cask::SystemCommand is modified to avoid double-quoting.  The
_quote method itself will go away in a future revision when
only list-forms are used.
- Casks using system are not touched. It seems natural to
address that when creating the DSL for after_install/before_install.
2014-01-24 20:58:03 -05:00
Roland Walker 7a0f9ef37f always use full path to external utilities
per #2029
2014-01-23 12:20:32 -05:00
Roland Walker 329c48298a caveats first-class in DSL, gets own mini-DSL
Make caveats a first-class member of the Cask DSL.  It no longer has to
be specified with "def caveats", but can be given as "caveats do ... end"
as with after_install blocks.

In addition, create a mini-DSL which can be used within caveats blocks,
providing standard messages when manual installers must be used,
reboot-required, etc.

Add alternate form: caveats can also accept a compile-time string for
simple cases.

This is 99% compatible with old Casks, as it still works by defining
a caveats method.  However, all Casks containing caveats are cleaned
up and adapted according to the new DSL.

Full docs in CONTRIBUTING.md.
2014-01-20 11:54:46 -05:00
Paul Hinze 6786f336e8 Merge pull request #2303 from rolandwalker/qualified_cask_names
handle fully-qualified cask names, fixes #2235
2014-01-10 11:23:43 -08:00
Paul Hinze 2412bfebbb Merge pull request #2360 from jfb/master
chown can only be run as root
2014-01-10 11:02:56 -08:00
Paul Hinze 0967e4dd51 try forcing a require of homebrew's download_strategy
working on fixing #2275
2014-01-10 10:42:18 -06:00
James Felix Black 83d5e7dfe4 chown can only be run as root
The logic here was flawed -- my caskroom.parent was writeable, but chown
was called regardless, causing an error.
2014-01-08 11:22:32 -08:00
Stratos Moros 7136269198 implement `binary` artifact 2014-01-05 22:55:18 +02:00
Roland Walker b88bf787e0 handle fully-qualified cask names, fixes #2235
form "<user>/<repo>/<cask>" may be used on cmdline, matching homebrew
- refactor Cask::Source::Tap into Cask::Source::Tapped, removing
  code, only handling unqualified cask names here now (ie no slash)
- create Cask::Source::TappedQualified, handling "<user>-<repo>/<cask>"
  form as before, and new form "<user>/<repo>/<cask>", for the case that
  the relevant tap already exists
- create Cask::Source::UntappedQualified, handling both command-line
  forms as above, but implicitly creating adding a new tap if it
  does not already exist
- add module Cask::QualifiedCaskName for utility functions on qualified
  Cask names
2014-01-04 07:14:35 -05:00
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
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
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
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
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
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
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
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 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
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
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
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
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
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 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 37761138ea recursively chown caskroom dirs when creating
fixes #199
2013-04-12 10:09:46 -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 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 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