samuelmeuli/glance

Binary releases and Homebrew Cask

crunchtime-ali opened this issue ยท 12 comments

Dear Samuel,

it's very good to distribute Glance via App Store but some people might prefer installing binary releases themself or via Homebrew Cask.
Can you supply Binaries for Glance for every GitHub release?

If you do I will take care of having it added to Homebrew.

Some people also might not be able to install Glance because of restrictions on their work devices like this:

CleanShot 2020-05-18 at 00 29 55@2x

Done: v1.0.0

If you could manage the formula, that would be great ๐Ÿ˜Š

Paths for the zap stanza:

  • ~/Library/Application\ Scripts/com.samuelmeuli.Glance/
  • ~/Library/Application\ Scripts/com.samuelmeuli.Glance.QLPlugin/
  • ~/Library/Containers/com.samuelmeuli.Glance/
  • ~/Library/Containers/com.samuelmeuli.Glance.QLPlugin/
  • ~/Library/Group\ Containers/group.com.samuelmeuli.glance/

@samuelmeuli Thank you very much. I will take care of the formula later today and report here.

@samuelmeuli I am placing the Glance.app in /Applications/ and executing it but that doesn't seem to be enough. Will I have to copy the stanzas in the appropriate folders myself or how is that done?

That should be enough. The Quick Look plugin is registered when the app is opened for the first time.

Are you on macOS 10.15?

@samuelmeuli You can try the cask yourself when you create it with brew cask create glance, then replace the template with this:

cask 'glance' do
  version '1.0.0'
  sha256 '8ef7ba4a5130955e213fdfcc2bf43cba47c742d5f02e0e9c62405acaf19626b5'

  url "https://github.com/samuelmeuli/glance/releases/download/v#{version}/Glance.dmg"
  appcast 'https://github.com/samuelmeuli/glance/releases.atom'
  name 'Glance'
  homepage 'https://github.com/samuelmeuli/glance'
  depends_on macos: '>= :catalina'

  app 'Glance.app'
  installer script: {
    executable: "Glance.app/Contents/MacOS/Glance",
  }

  zap trash: [
    '~/Library/Application\ Scripts/com.samuelmeuli.Glance/',
    '~/Library/Application\ Scripts/com.samuelmeuli.Glance.QLPlugin/',
    '~/Library/Containers/com.samuelmeuli.Glance/',
    '~/Library/Containers/com.samuelmeuli.Glance.QLPlugin/',
    '~/Library/Group\ Containers/group.com.samuelmeuli.glance/',
  ]
end

then brew cask install glance.

installer script: {
  executable: "Glance.app/Contents/MacOS/Glance",
}

This part is breaking the installation for me. Without it it's working fine.

I suspect this is because when the app is opened by the script, it's not yet in the /Applications/ directory. And this seems to be a requirement for Quick Look plugins to be registered by macOS.

@samuelmeuli Thank you for trying. I made some progress. I moved the execution of Glance.app to postflight section. It now executes the app but the terminal output hangs at the following until you quit the app manually. After quitting it Glance is working as expected.
Now I could set a small timer and quit the application in the postflight script but I think the cleaner way would be to set a --setup or --quiet argument when calling the binary, then you do the setup magic, then the app quits with return code zero by itself, preferably without showing a dock icon. How do you think about it?

This is where the cask installation hangs:

==> Installing Cask glance
==> Moving App 'Glance.app' to '/Applications/Glance.app'.

I think the user should open the app by themselves. Automatically executing a binary that was downloaded from the internet seems a bit problematic to me. And the user might want to verify that the app is sandboxed before opening it. Maybe a note in caveats is enough?

@samuelmeuli My opinion differs a bit but I respect yours and therefore added it to the caveats and created a merge request. Since it seems to be the first QL-plugin of its kind to enter the Caskroom I suspect there will be some discussion so feel free to chime in at Homebrew/homebrew-cask#82816

Great, I'm curious to hear what other people think. Thanks a lot for working on this, @crunchtime-ali! ๐Ÿ˜Š

@samuelmeuli Can you maybe chime in on vitorgalvaos' question Homebrew/homebrew-cask#82816 (comment)?
I looked at the source code but feel you are more qualified to answer the question. As I understand it the Quick Look plugin resides in /Applications/Glance.app/Contents/PlugIns/QLPlugin.appex

Glance is now available on Homebrew! ๐ŸŽ‰

brew cask install glance

Many thanks to @crunchtime-ali!