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

Stanzas in conditional statements #14333

Closed
Eitot opened this issue Oct 11, 2015 · 1 comment
Closed

Stanzas in conditional statements #14333

Eitot opened this issue Oct 11, 2015 · 1 comment

Comments

@Eitot
Copy link
Contributor

Eitot commented Oct 11, 2015

I’ve worked on an update for image2icon.rb. I am not sure whether this will work though and I would appreciate some input. I’ve wrapped two old versions of the same program into several conditional statements, in each case the name, app, and zap stanzas are different. Will this work? What will happen when a user updates, say, from Mountain Lion to El Capitan, will the newer version of the app be installed alongside the old version or will the old version be deleted before? Does it make sense to include the zap stanza of previous versions too (or just list them all regardless of version?)?

cask :v1 => 'image2icon' do

  if MacOS.release == :tiger
    version '0.5.1'
    sha256 'b268136c5067438f09a634a886b8c33e841a1d6d4e5b860278e02812563151d4'
    url 'http://www.img2icnsapp.com/static/old_versions/img2icns0.5.zip'
    name 'img2icns'
    name 'Image2icon'
    container :nested => 'img2icns05.dmg'
    app 'img2icns.app'
    zap :delete => '~/Library/Preferences/net.shinyfrog.img2icns.plist'

  elsif MacOS.release <= :mountain_lion
    version '1.2.2'
    sha256 'babae11fd9a496057db9c4ff491f9e62fa07479187cd33a8d35aca11728e7567'
    url 'http://www.img2icnsapp.com/static/old_versions/Img2icns1.2.2.zip'
    name 'Img2icns'
    name 'Image2icon'
    app 'Img2icns.app'
    zap :delete => [
      '~/Library/Preferences/net.shinyfrog.img2icns.plist',
      '~/Library/Caches/net.shinyfrog.img2icns',
      '~/Library/Application Support/Img2icns',
      '~/Library/Saved Application State/net.shinyfrog.img2icns.savedState'
    ]

  else
    version '2.2'
    sha256 'dd1d588a4450c96272e345e16a8e9a8b4738d473e1683ceee19e1756eb39c6d7'
    # amazonaws.com is the official download host per the vendor homepage
    url "https://sf-applications.s3.amazonaws.com/Image2Icon/app-releases/Image2icon#{version}.zip"
    name 'Image2icon'
    name 'Img2icns'
    app 'Image2Icon.app'
    zap :delete => [
      '~/Library/Caches/net.shinyfrog.image2icon',
      '~/Library/Preferences/net.shinyfrog.image2icon.plist',
      '~/Library/Containers/net.shinyfrog.image2icon',
      '~/Library/Containers/net.shinyfrog.image2icon.templateRenderer',
      '~/Library/Containers/net.shinyfrog.templateRenderer',
      '~/Library/Saved Application State/net.shinyfrog.image2icon.savedState'
    ]
  end

  homepage 'http://www.img2icnsapp.com/'
  license :freemium
  depends_on :macos => '>= :tiger'

end
@vitorgalvao
Copy link
Member

There’s too much repetition between the last two conditionals. name, for example, can be abstracted. Also, screw :tiger, homebrew-cask likely won’t even work, there.

It’s also weird to have both versions of the app (with different names) in the same cask, and goes against the token reference.

Just update the newest one, and let the old ones out. If someone asks for them, we can add them to caskroom/versions.

@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

2 participants