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

Better nested container syntax #1248

Closed
muescha opened this issue Oct 21, 2013 · 6 comments
Closed

Better nested container syntax #1248

muescha opened this issue Oct 21, 2013 · 6 comments

Comments

@muescha
Copy link
Contributor

muescha commented Oct 21, 2013

Nested containers introduced in #1232

Current syntax is:

  nested_container 'Speed Download 5.dmg'
  link 'Speed Download 5/Speed Download.app'

I suggest a more logical dsl for nested container:

  container 'Speed Download 5.dmg' do |c|
    link 'Speed Download 5/Speed Download.app'
  end
@muescha
Copy link
Contributor Author

muescha commented Oct 21, 2013

or if the container parameter give more information about the container

  container 'Speed Download 5.dmg' do |c|
    link '#{c.path}/Speed Download.app'
  end

@phinze
Copy link
Contributor

phinze commented Oct 21, 2013

Ooo good idea!

link '#{c.path}/Speed Download.app'

The Speed Download 5.dmg just so happened to have a folder named Speed Download 5 inside it; it's not our code that makes it. The destination path for the nested container extraction is the same as the primary container; they just layer on top of each other in the same directory.

So there's not really any information we have available to yield to the block; everything is still relative to the cask root.

I ❤️ the idea of the blocks expressing the nesting though. I'll try and pick this up on my next pass on this feature.

class SpeedDownload < Cask
  url 'http://mirror.nscocoa.com/~yazsoftc1/files/sd5/sd5.zip'
  homepage 'http://www.yazsoft.com/products/speed-download'
  version 'latest'
  no_checksum
  container 'Speed Download 5.dmg' do
    link 'Speed Download 5/Speed Download.app'
  end
end

@muescha
Copy link
Contributor Author

muescha commented Oct 21, 2013

Ah ok

And if it always the same path - what if link is relative to container then we can make it DRY:

  container 'Speed Download 5.dmg' do
    # because its inside the container
    # this calls link 'Speed Download 5/Speed Download.app'
    link 'Speed Download.app'
  end

@phinze
Copy link
Contributor

phinze commented Oct 21, 2013

And if it always the same path - what if link is relative to container then we can make it DRY:

Yeah I see what you're going for, but that's my point - it's not always the same path. It happened to be that Speed Download 5.dmg contained the following contents:

Speed Download 5/
Speed Download 5/Speed Download.app

There could be another app that does not nest inside a folder like that (in fact most dmg files just have a file directly in their root).

So given Another App.dmg with just the contents:

Another App.app

The syntax would be:

container `Another App.dmg` do
  link 'Another App.app'
end

Does that make sense?

@muescha
Copy link
Contributor Author

muescha commented Oct 21, 2013

Yes that makes sense.

voanhduy1512 pushed a commit to voanhduy1512/homebrew-cask that referenced this issue Apr 19, 2014
I add a new `container` dsl. With this new dsl, we can drop `nested_container`.
@tapeinosyne
Copy link
Contributor

Superseded by #6120 as part of our transition to DSL 1.0 (#4688).

@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

No branches or pull requests

4 participants