Commit graph

31 commits

Author SHA1 Message Date
Roland Walker
2fa0281589 don't invoke method Homebrew.install_tap
* invoke `brew` executable for the equivalent action
* remove `cmd/tap.rb` from homebrew-fork
2014-12-17 09:48:20 -05:00
Roland Walker
bf99c6b0a3 Store metadata with installed Casks.
Step 2: Snapshot the Cask file used at install-time, using
the previously-merged metadata directory support.

Using a simple filesystem-is-a-database approach, we set up a
`.metadata` directory for each installed Cask in which we can
record any information, starting with a copy of the Cask
definition which was used at install-time.

This should be useful for various cases such as:
- a fallback when the Cask was renamed/removed.  We
  currently cannot recover any uninstall info in that
  scenario
- installation of multiple versions of the same software

There might be a smarter way to discover the source filename
for the Cask through introspection or some deep Ruby voodoo.
All I could come up with was to pass the filename in on the
constructor, which seems perfectly reasonable if voodoo is
not available.  The existing code was taking the title as an
argument to the constructor, which is dispensable.

This PR contains no code to actually make use of the metadata,
but only takes care of the relevant book-keeping: creation,
destruction, as well as organization of metadata according to
software version number and timestamp.
2014-12-10 18:24:43 -05:00
Roland Walker
a870869f9a Merge pull request #7822 from rolandwalker/allow_leading_numbers
Remove constraint that Cask tokens cannot start with digits
2014-12-06 09:00:04 -05:00
Roland Walker
a6bc35cfa8 remove support for title method in Casks
obsoleted by `token`
2014-12-05 18:41:24 -05:00
Roland Walker
cb5a40f787 remove constraint that tokens can't start w/ digit
Class names are now completely hidden from the user.  This
commit works by adding a prefix to all Cask class names, which
is considered to be an ugly transitional hack on the way to
representing individual Casks as instances.
2014-12-05 11:54:56 -05:00
Claudia
03a8efe128 Make CLI::Alfred and Source::PathBase work with Ruby 1.8 2014-12-02 17:01:01 +01:00
Roland Walker
a335d3b06d unify and recast "Cask name" & "title" as "token"
* "Canonical App Name" becomes "Simplified App Name"
* devscript `cask_namer` renamed to `generate_cask_token`
* doc file `CASK_NAMING_REFERENCE.md` renamed to `cask_token_reference.md`
* DSL uses `"#{token}"` for interpolation instead of `"#{title}"`
* documentation text
* backend code (variables, method, class names)
* error message text
* tests
* code comments
* Cask comments
* emphasize `tags :name`
* doc: use "vendor" consistently instead of "developer"
* doc: many man page argument descriptions were incorrect
* incidental clarifications

Many backend variables similar to `cask_name` or `cask` have
been standardized to `cask_token`, `token`, etc, resolving a long-
standing ambiguity in which variables named `cask` might contain
a Cask instance or a string token.

In many places the docs could be shortened from "Cask name" to
simply "token", which is desirable because we use the term "Cask"
in too many contexts.
2014-12-01 11:00:23 -05:00
Roland Walker
e2a0214de6 enforce a valid minimum DSL version in headers 2014-11-22 20:08:25 -05:00
Roland Walker
4d3d254a30 comment wording 2014-11-21 09:25:46 -05:00
Roland Walker
6c53607967 require new-style header lines
and enforce that the cask name (per the header) must match
the filename
2014-11-19 10:57:39 -05:00
Roland Walker
2692b5cd8d remove old-style header line from test Casks
This takes the form of a horrible hack: DSL version numbers may
end with "test", *eg* ":v1test". Such Casks are mapped to class
`TestCask` instead of class `Cask`.

The intention is that all of this logic will be removed when
Casks are migrated away from separate classes.

Tests driven by RSpec are still todo.
2014-11-18 09:09:01 -05:00
Roland Walker
113a667fcc flag backward-compatibility todo 2014-11-13 11:45:47 -05:00
Federico Bond
950bc054bd Fix cask loading behavior. Refs #5769 2014-08-15 13:57:43 -03:00
Roland Walker
3e2eafb636 forward-compatibility to remove naming limitations
Currently, Casks names are constrained by the need to form
valid Ruby class names.  This change enables a new syntax,
in which the first line of a Cask will read like
```ruby
cask :v1 => 'my-app' do
```
where :v1 refers to the version of the DSL spec.
2014-07-28 13:36:44 -04:00
Roland Walker
c082b5521a Improve error checking and messages on Cask load
Other Cask sources ultimately invoke the `load` method in the
abstract class Cask::Source::PathBase, so these changes apply
to all other sources.
2014-06-04 07:34:52 -04:00
Roland Walker
787b471618 isolate ErrorDuringExecution rescue
it only should be rescued for the `curl` invocation
2014-06-03 11:39:58 -04:00
Roland Walker
f24b4ba05a show resolved Cask source file or URI w/ --debug
references #4641
2014-06-03 10:38:49 -04:00
Roland Walker
f8c9567a66 Don't prefer Cask files in the cwd
Fixes #4641.  Cask files in the cwd are still permitted, but
at the very lowest priority, below Tapped Cask names.
2014-06-03 10:33:19 -04:00
Roland Walker
5b2e9d1466 doc/comment: known performance issues 2014-05-15 16:52:41 -04:00
Roland Walker
598f53ba48 memoize all_tapped_cask_dirs 2014-05-15 16:49:43 -04:00
Roland Walker
03af4f45a1 make cask_titles hold Pathnames, not strings 2014-05-15 16:38:35 -04:00
Roland Walker
5101d363ab append the .rb extension on Cask::Source::Path
Unless `.rb` is already present on the query string.  Failure
to append the extension caused confusing effects, including
selective failure of "brew cask list" when invoked from
`/usr/local/bin` working directory.  Fixes #4077 .
Credit to @mroth on the detective work.
2014-05-13 09:04:14 -04:00
Roland Walker
400433be20 Adapt to homebrew's move of the tap directory
Closes #4035. Closes #4029. Closes #4026.
2014-04-26 09:42:16 -04:00
Roland Walker
36cd9e4d72 accept and ignore trailing .rb on CL arguments
"Be conservative in what you do, be liberal in what you accept."
2014-02-25 18:24:58 -05:00
Roland Walker
6f6a07fc0f mass whitespace cleanup 2014-02-22 21:13:52 -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
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
Roland Walker
f223821038 add feedback when downloading a URI source
otherwise the user sees the curl progress bar w/o explanation
2014-01-04 07:43:29 -05: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
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
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