Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp install processes #114

Closed
wants to merge 17 commits into from
Closed

Revamp install processes #114

wants to merge 17 commits into from

Conversation

passcod
Copy link
Contributor

@passcod passcod commented Dec 10, 2012

Not sure whether this should/could be merged in or if it'd be better to cherry-pick/copy/steal selected changes out. Anyway, here goes:


This fork/branch is testing out a radically different way of installing Casks. It develops ideas exposed in the following issues:

Checksums

(DONE by phinze.)

content_length has been removed. In its stead, there are md5, sha1, and sha256 which all take a hexdigest string, e.g:

class Candybar < Cask
  url 'http://panic.com/museum/candybar/CandyBar 3.3.4.zip'
  homepage 'http://panic.com/museum/candybar/'
  sha1 'f645e9da45a621415a07a7492c45923b1a1fd4d4'
end

brew cask install will warn if there is no checksum provided, and error if the sums do not match.

Audit

brew cask audit has had a facelift, and is now based on brew audit. It checks whitespace, URLs, checksums, versions, and code style just like Homebrew's one, albeit modified to fit Casks (a lot of stuff related to compiling was removed).

Caskroom

Casks are now installed in $HOMEBREW_PREFIX/Caskroom/$name/$version/ instead of in the Cellar. This stops Homebrew from complaining about unlinked kegs, and from listing our casks on brew list.

Devel & Edge

You can now specify alternate specs for devel (checksummed, versioned) and edge (un-checksummed, unversioned) using blocks, e.g.

class Firefox < Cask
  url 'http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/17.0.1/mac/en-US/Firefox%2017.0.1.dmg'
  homepage 'http://www.mozilla.org/en-US/firefox/'
  version '17.0.1'
  sha1 'a9888ce69440574fabff712549c8ff503fd1acb7'

  # Beta
  devel do
    url 'http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/18.0b3/mac/en-US/Firefox%2018.0b3.dmg'
    version '18.0b3'
    sha1 '31e383782b4fbbcbf3a1ef578d82cbf6861912cb'
  end

  # Nightly
  edge do
    url 'http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-20.0a1.en-US.mac.dmg'
  end
end

If the top level url is unspecified, then the edge spec will be used, e.g.

class FirefoxAurora < Cask
  homepage 'http://www.mozilla.org/en-US/firefox/aurora/'

  edge do
    url 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora/firefox-19.0a2.en-US.mac.dmg'
    version '19.0a2'
  end
end

Version parsing

Additionally, we will attempt to parse the URL to get the version, so if the correct version is within the URL, there is no need to specify it explicitely using version. This also applies to devel specs.

Linking

Moar breaking changes: brew cask linkapps is removed. Linking is done at install-time, and by default has the same behaviour (link every .app found recursively). However, that behaviour can be overridden in the formula:

class Brackets < Cask
  url 'https://github.com/downloads/adobe/brackets/brackets-sprint-16-MAC.dmg'
  homepage 'http://brackets.io'
  version 'sprint-16'
  sha1 '94322762ecb00baab857e324a98e543d548bf961'

  install :app => 'Brackets Sprint 16.app'
end

install is spec-specific (so you have a different one for devel and edge), and takes a hash with a single pair of the form:

:type => 'path/to/file.ext'

You can have as many install ... statements as necessary. Currently, the only types supported are app (.app files, linked into ~/Applications or whatever --appdir is set to) and pref (.prefPane files, linked into ~/Library/PreferencePanes or whatever --prefdir is set to).

Configuration

(DONE in #117)

You can now configure some aspects of brew cask's operation. You can set options on the command:

$ brew cask install adium --appdir=/Applications

or you can set them in the HOMEBREW_CASK_OPTS environment variable:

# ~/.bashrc, somewhere at the end of the file

export HOMEBREW_CASK_OPTS='--appdir=/Applications'

Command-line options override environment ones.

Available options:

  • --appdir=PATH — Where applications are linked / aliased. Defaults to ~/Applications.
  • --prefdir=PATH — Where preference panes are linked / aliased. Defaults to ~/Library/PreferencePanes.
  • --edge — Use the edge spec for that cask.
  • --devel — Use the devel spec for that cask.
  • --stable — Use the stable spec for that cask. Useful to override the ENV.
  • --[no-]ignore-edge-only — Ignore “edge-only” problems when auditing casks. If you're
    working with brew cask audit a lot, I recommend you put it in your HOMEBREW_CASK_OPTS.

Cask info

brew cask info <a cask> now gives:

adium: 1.5.3
http://www.adium.im/
/usr/local/Caskroom/adium/1.5.3 (2947 files, 69M)
https://github.com/phinze/cask/commits/master/Casks/adium.rb

And you can use brew cask open <cask name> to open its homepage.

Félix Saparelli added 15 commits December 11, 2012 01:13
`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.
It checks whitespace, URLs, and code style just like Homebrew's one,
albeit modified to fit Casks (a lot of compiling-related stuff was
removed).
Can now specify alternate specs for *devel* (checksummed, versioned)
and *edge* (un-checksummed, unversioned) using blocks, see README.md.
Also change `--linkpath` option to `--[app|pref]dir`.
@phinze
Copy link
Contributor

phinze commented Dec 10, 2012

Holy crap, it's Christmas come early!!!!

Let me take a look at this later today, but the summary sounds AWESOME

On Monday, December 10, 2012 at 6:27 AM, Félix Saparelli wrote:

Not sure whether this should/could be merged in or if it'd be better to cherry-pick/copy/steal selected changes out. Anyway, here goes:
This fork/branch is testing out a radically different way of installing Casks. It develops ideas exposed in the following issues:
#105 (#105) — Features to help manage multiple .app folders
#89 (#89) — Don't make brew doctor complain (about unlinked kegs)
#72 (#72) — Features for metadata
#38 (#38) — Moar configuration
#30 (#30) — Config: install/link path
#41 (#41) — Better version management
#69 (#69) — Features for installing different types
#82 (#82) — Checksums

Checksums
content_length has been removed. In its stead, there are md5, sha1, and sha256 which all take a hexdigest string, e.g:
class Candybar < Cask url 'http://panic.com/museum/candybar/CandyBar 3.3.4.zip' homepage 'http://panic.com/museum/candybar/' sha1 'f645e9da45a621415a07a7492c45923b1a1fd4d4' end

brew cask install will warn if there is no checksum provided, and error if the sums do not match.
Audit
brew cask audit has had a facelift, and is now based on brew audit. It checks whitespace, URLs, checksums, versions, and code style just like Homebrew's one, albeit modified to fit Casks (a lot of stuff related to compiling was removed).
Caskroom
Casks are now installed in $HOMEBREW_PREFIX/Caskroom/$name/$version/ instead of in the Cellar. This stops Homebrew from complaining about unlinked kegs, and from listing our casks on brew list.
Devel & Edge
You can now specify alternate specs for devel (checksummed, versioned) and edge (un-checksummed, unversioned) using blocks, e.g.
class Firefox < Cask url 'http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/17.0.1/mac/en-US/Firefox%2017.0.1.dmg' homepage 'http://www.mozilla.org/en-US/firefox/' version '17.0.1' sha1 'a9888ce69440574fabff712549c8ff503fd1acb7' # Beta devel do url 'http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/18.0b3/mac/en-US/Firefox%2018.0b3.dmg' version '18.0b3' sha1 '31e383782b4fbbcbf3a1ef578d82cbf6861912cb' end # Nightly edge do url 'http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-20.0a1.en-US.mac.dmg' end end

If the top level url is unspecified, then the edge spec will be used, e.g.
class FirefoxAurora < Cask homepage 'http://www.mozilla.org/en-US/firefox/aurora/' edge do url 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora/firefox-19.0a2.en-US.mac.dmg' version '19.0a2' end end

Version parsing
Additionally, we will attempt to parse the URL to get the version, so if the correct version is within the URL, there is no need to specify it explicitely using version. This also applies to devel specs.
Linking
Moar breaking changes: brew cask linkapps is removed. Linking is done at install-time, and by default has the same behaviour (link every .app found recursively). However, that behaviour can be overridden in the formula:
class Brackets < Cask url 'https://github.com/downloads/adobe/brackets/brackets-sprint-16-MAC.dmg' homepage 'http://brackets.io' version 'sprint-16' sha1 '94322762ecb00baab857e324a98e543d548bf961' install :app => 'Brackets Sprint 16.app' end

install is spec-specific (so you have a different one for devel and edge), and takes a hash with a single pair of the form:
:type => 'path/to/file.ext'
You can have as many install ... statements as necessary. Currently, the only types supported are app (.app files, linked into ~/Applications or whatever --appdir is set to) and pref (.prefPane files, linked into ~/Library/PreferencePanes or whatever --prefdir is set to).
Configuration
You can now configure some aspects of brew cask's operation. You can set options on the command:
$ brew cask install adium --appdir=/Applications
or you can set them in the HOMEBREW_CASK_OPTS environment variable:

~/.bashrc, somewhere at the end of the file export HOMEBREW_CASK_OPTS='--appdir=/Applications'

Command-line options override environment ones.
Available options:
--appdir=PATH — Where applications are linked / aliased. Defaults to ~/Applications.
--prefdir=PATH — Where preference panes are linked / aliased. Defaults to ~/Library/PreferencePanes.
--edge — Use the edge spec for that cask.
--devel — Use the devel spec for that cask.
--stable — Use the stable spec for that cask. Useful to override the ENV.
--[no-]ignore-edge-only — Ignore “edge-only” problems when auditing casks. If you're working with brew cask audit a lot, I recommend you put it in your HOMEBREW_CASK_OPTS.

Cask info
brew cask info now gives:
adium: 1.5.3 http://www.adium.im/ /usr/local/Caskroom/adium/1.5.3 (2947 files, 69M) https://github.com/phinze/cask/commits/master/Casks/adium.rb
And you can use brew cask open to open its homepage.
You can merge this Pull Request by running:
git pull https://github.com/passcod/homebrew-cask revamp-install
Or view, comment on, or merge it at:
#114
Commit Summary
Summarise planned changes
Add code map
Complete code map for vanilla
Echofon is discontinued
Replace content_length with md5/sha1/sha256/no_checksum
Audit is more thorough and based on homebrew's
Edit map
Install to prefix/Caskroom
Linkpath is changeable using an option
Add brew cask info
Add brew cask open
Use stable / devel / edge specs
Remove additional checks
Remove brew cask linkapps in favour of install in DSL
Bring mu-commander up to speed

File Changes
M Casks/adium.rb (3)
M Casks/alfred.rb (2)
M Casks/anvil.rb (6)
M Casks/aquamacs.rb (1)
M Casks/arq.rb (6)
M Casks/at-monitor.rb (6)
M Casks/back-in-time.rb (2)
M Casks/bartender.rb (6)
M Casks/bettertouchtool.rb (6)
M Casks/boot-x-changer.rb (3)
M Casks/brackets.rb (4)
M Casks/caffeine.rb (2)
M Casks/candybar.rb (5)
M Casks/changes.rb (6)
M Casks/chocolat.rb (6)
M Casks/chromium.rb (5)
M Casks/clip-menu.rb (3)
M Casks/colloquy.rb (3)
M Casks/cura.rb (2)
M Casks/cyberduck.rb (3)
M Casks/dia.rb (2)
M Casks/disk-inventory-x.rb (6)
M Casks/divvy.rb (6)
M Casks/dropbox.rb (2)
D Casks/echofon.rb (5)
M Casks/emacs.rb (2)
M Casks/firefox-aurora.rb (8)
M Casks/firefox.rb (18)
M Casks/fluid.rb (3)
M Casks/flux.rb (6)
M Casks/gephi.rb (4)
M Casks/gfxcardstatus.rb (3)
M Casks/gimp.rb (2)
M Casks/github.rb (6)
M Casks/gitx-l.rb (3)
M Casks/gitx.rb (6)
M Casks/gmail-notifr.rb (3)
M Casks/google-chrome-canary.rb (6)
M Casks/google-chrome.rb (3)
M Casks/google-notifier.rb (3)
M Casks/handbrake.rb (2)
M Casks/handbrakebatch.rb (6)
M Casks/hands-off.rb (3)
M Casks/inkscape.rb (4)
M Casks/intellij-community.rb (3)
M Casks/intellij-ultimate.rb (3)
M Casks/irip.rb (6)
M Casks/istat-menus.rb (3)
M Casks/iterm2.rb (2)
M Casks/jumpcut.rb (3)
M Casks/justlooking.rb (3)
M Casks/keepass-x.rb (5)
M Casks/keyboard-maestro.rb (6)
M Casks/libre-office.rb (2)
M Casks/little-snitch.rb (3)
M Casks/livestation.rb (3)
M Casks/macvim.rb (2)
M Casks/makemkv.rb (1)
M Casks/menu-bar-filter.rb (3)
M Casks/moom.rb (6)
M Casks/mu-commander.rb (3)
M Casks/namemangler.rb (6)
M Casks/notational-velocity.rb (6)
M Casks/nv-alt.rb (5)
M Casks/one-password.rb (3)
M Casks/open-office.rb (5)
M Casks/paintbrush.rb (5)
M Casks/pandora-jam.rb (6)
M Casks/picard.rb (3)
M Casks/plex.rb (3)
M Casks/postgres.rb (7)
M Casks/propane.rb (6)
M Casks/quicksilver.rb (6)
M Casks/racket.rb (5)
M Casks/rdio.rb (6)
M Casks/ringtones.rb (6)
M Casks/ripit.rb (6)
M Casks/rubymine.rb (5)
M Casks/scrivener.rb (6)
M Casks/scrup.rb (1)
M Casks/seashore.rb (6)
M Casks/sequel-pro.rb (2)
M Casks/shortcat.rb (2)
M Casks/size-up.rb (2)
M Casks/skype.rb (3)
M Casks/slate.rb (6)
M Casks/sourcetree.rb (3)
M Casks/sparrow.rb (7)
M Casks/spectacle.rb (2)
M Casks/spotify.rb (1)
M Casks/steam.rb (3)
M Casks/sublime-text.rb (2)
M Casks/tagalicious.rb (6)
M Casks/textadept.rb (1)
M Casks/textmate1.rb (2)
M Casks/textmate2.rb (2)
M Casks/textwrangler.rb (5)
M Casks/the-unarchiver.rb (2)
M Casks/thunderbird.rb (2)
M Casks/time-machine-editor.rb (6)
M Casks/transmission.rb (3)
M Casks/transmit.rb (2)
M Casks/tunewiki.rb (2)
M Casks/tvmobili.rb (2)
M Casks/u-torrent.rb (2)
M Casks/virtualbox.rb (2)
M Casks/vlc.rb (3)
M Casks/woodhouse.rb (3)
M Casks/x-quartz.rb (3)
M Casks/xbmc.rb (3)
M Casks/xscope.rb (3)
A MAP (117)
M README.md (260)
M lib/cask.rb (104)
D lib/cask/actions.rb (19)
D lib/cask/audit.rb (126)
M lib/cask/auditor.rb (176)
M lib/cask/cli.rb (44)
M lib/cask/cli/audit.rb (18)
A lib/cask/cli/info.rb (33)
M lib/cask/cli/install.rb (4)
D lib/cask/cli/linkapps.rb (12)
M lib/cask/dsl.rb (72)
M lib/cask/exceptions.rb (2)
M lib/cask/installer.rb (8)
A lib/cask/link.rb (48)

Patch Links
https://github.com/phinze/homebrew-cask/pull/114.patch
https://github.com/phinze/homebrew-cask/pull/114.diff


Reply to this email directly or view it on GitHub (#114).

@passcod
Copy link
Contributor Author

passcod commented Dec 12, 2012

Note that the extensions aren't fixed for the install statements. This is perfectly legal:

# Symlink Somefile.jar to ~/Applications
install :app => 'Somefile.jar'

@phinze
Copy link
Contributor

phinze commented Dec 12, 2012

Ack, I owe you a review on this stuff. I will try to get to it soon!

On Wed, Dec 12, 2012 at 1:48 PM, Félix Saparelli
notifications@github.comwrote:

Note that the extensions aren't fixed for the install statements. This is
perfectly legal:

Symlink Somefile.jar to ~/Applicationsinstall :app => 'Somefile.jar'


Reply to this email directly or view it on GitHubhttps://github.com//pull/114#issuecomment-11306385.

@patcon
Copy link
Contributor

patcon commented Dec 14, 2012

MotherTRUCKER! 👍

@patcon
Copy link
Contributor

patcon commented Dec 14, 2012

I really like that you provided a means to specific stable, devel, and edge, btw

@phinze
Copy link
Contributor

phinze commented Dec 14, 2012

Took some time to look this over this afternoon.

Few initial comments:

Devel / Edge

Awesome.

auto-link

Nice!

Caskroom

+1, you beat me to the punch here, and with a better name

Configurability

+1, nice simple interface with args that can also be stuck in the env

Checksums

also beat me to the punch, nicely done

Audit

i like going with homebrew style audit here, but one of the main purposes of the audit in my mind was to check the durability of the remote URL. the core part of this is performing a HEAD request against the URL and expecting a 200, along with the content_length to ensure the binary is still there.

Tests

Where are they?! ;)

I figure you were trying to sketch this out which is why you didn't work on the test suite, but I was getting up to pretty decent test coverage, and your changes don't include tests.

So let's figure out next steps!!

I think it would be nice to pull this stuff in piecemeal. I'll take a further look this weekend to see if I can make a proposal.

@passcod
Copy link
Contributor Author

passcod commented Dec 15, 2012

Tests… yeah, I mostly began that work as a prototyping/sketching/lemme-see-how-it-goes, but it went better than I expected, so I sent the pull request in before polishing everything. If you have a look at the branch readme you'll see that I had planned to include appifying (see #99) as part of it all, and, implicitly, tests were planned too. However, I just recently started a new job and didn't want to just stop working on it and have it all waste away, so that's why I sent it up unfinished like that :)

Audit: I thought about fetching all URLs/specs and checking the SHAs, but that adds a lot of delays and variance to each audit. Maybe… have it enabled for individual audits (e.g. brew cask audit <a single cask>) by default, and disabled for multiple/all audits (e.g. brew cask audit or brew cask audit <one> <two> <and more> <casks>), unless a switch, say --[no-]audit-fetch is set?


Also, I've been toying with the idea of named scopes to accommodate more complex alpha/beta/nightly/devel/edge release schemes. It'd look something like this:

# Casks/formula-blah.rb

class Firefox < Cask
  url 'http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/17.0.1/mac/en-US/Firefox%2017.0.1.dmg'
  homepage 'http://www.mozilla.org/en-US/firefox/'
  version '17.0.1'
  sha1 'a9888ce69440574fabff712549c8ff503fd1acb7'

  # By default, both checksums and versions are required / checked…
  spec :beta do
    url 'http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/18.0b3/mac/en-US/Firefox%2018.0b3.dmg'
    version '18.0b3'
    sha1 '31e383782b4fbbcbf3a1ef578d82cbf6861912cb'
  end

  # …and you can disable each separately…
  spec :aurora, :checksum => false do
    url 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora/firefox-19.0a2.en-US.mac.dmg'
    version '19.0a2'
  end

  # …and also set aliases for ease-of-use / familiarity
  spec :nightly, :checksum => false, :version => false, :alias => :edge do
    url 'http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-20.0a1.en-US.mac.dmg'
  end
end
# brew cask info firefox
firefox: 17.0.1 (stable)
specs: stable, beta, aurora, nightly/edge
http://www.mozilla.org/en-US/firefox/
/usr/local/Caskroom/firefox/17.0.1 (1234 files, 56M)
https://github.com/phinze/cask/commits/master/Casks/firefox.rb

With options looking like this:

# Predefined specs have predefined switches:
--stable
--devel
--edge

# Custom specs use a more generic syntax:
--spec=aurora

# Re: the example above, aliased specs can be accessed through any name:
--spec=nightly
--edge

# The generic syntax is also valid for predefined specs:
--spec=devel
--spec=stable

What do you think?
(Umm, maybe I should spin that in another issue instead?)

@passcod passcod mentioned this pull request Dec 18, 2012
@passcod
Copy link
Contributor Author

passcod commented Jan 28, 2013

Closing this as it's better tracked through the individual issues now.

fharbe pushed a commit to fharbe/homebrew-cask that referenced this pull request Mar 11, 2014
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants