samuelmeuli / glance

🔎 All-in-one Quick Look plugin
MIT License
963 stars 68 forks source link

Binary releases and Homebrew Cask #11

Closed crunchtime-ali closed 4 years ago

crunchtime-ali commented 4 years ago

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
samuelmeuli commented 4 years ago

Done: v1.0.0

If you could manage the formula, that would be great 😊

Paths for the zap stanza:

crunchtime-ali commented 4 years ago

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

crunchtime-ali commented 4 years ago

@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?

samuelmeuli commented 4 years ago

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?

crunchtime-ali commented 4 years ago

@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.

samuelmeuli commented 4 years ago
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.

crunchtime-ali commented 4 years ago

@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'.
samuelmeuli commented 4 years ago

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?

crunchtime-ali commented 4 years ago

@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 https://github.com/Homebrew/homebrew-cask/pull/82816

samuelmeuli commented 4 years ago

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

crunchtime-ali commented 4 years ago

@samuelmeuli Can you maybe chime in on vitorgalvaos' question https://github.com/Homebrew/homebrew-cask/pull/82816#discussion_r426924354? 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

samuelmeuli commented 4 years ago

Glance is now available on Homebrew! 🎉

brew cask install glance

Many thanks to @crunchtime-ali!