pstadler Posted December 15, 2013 Posted December 15, 2013 (edited) A simple workflow for managing casks. Download — stable version. The source code is available here: https://github.com/pstadler/alfred-cask Edited December 15, 2013 by Patrick Stadler twinpeaks and pstadler 2
raguay.customct Posted December 16, 2013 Posted December 16, 2013 For those who do not know, Brew Casks is an extension to Homebrew that needs to be installed separately. You can get instructions here: https://github.com/phinze/homebrew-cask Thanks for the workflow! It if failing on some apps (MacVim).
pstadler Posted December 16, 2013 Author Posted December 16, 2013 Thanks for the feedback. MacVim works for me. Try installing it from the command line to see what fails.
raguay.customct Posted December 16, 2013 Posted December 16, 2013 Yes, it loaded it fine from the command line, but not from this workflow. Everything I have tried today has failed, but works from the command line. I believe it has to do with permissions, but I am not sure. But, I can use it to browse available casks!
pstadler Posted December 16, 2013 Author Posted December 16, 2013 Interesting, can you somehow verify if this is a permission issue?
raguay.customct Posted December 16, 2013 Posted December 16, 2013 Trying too, but my attempts of capturing the output are not working. I guess it is putting it out on stderr and I am not good at bash for capturing stderr. I have a python program I use to catch cli outputs, but it is not getting the stderr.
raguay.customct Posted December 16, 2013 Posted December 16, 2013 I got it working. I added a line to source my bashrc file and it works great. You might want to add that to the workflow since Alfred does not launch scripts in a way the the configuration scripts are loaded.
pstadler Posted December 16, 2013 Author Posted December 16, 2013 The problem is fixed. Please reinstall the workflow by using the download link in the first post.
raguay.customct Posted December 16, 2013 Posted December 16, 2013 (edited) Yep, that fixed it. I just added "source ~/.bashrc" before to get it to work. Edited December 16, 2013 by raguay.customct
pstadler Posted December 16, 2013 Author Posted December 16, 2013 Solution was to add /usr/local/bin to the $PATH within the script. no need to source .bashrc anymore. Thanks, Patrick
altryne Posted December 19, 2013 Posted December 19, 2013 I wrote an workflow for those who don't want to use casks, but is based on it. http://www.alfredforum.com/topic/2680-search-download-and-install-mac-apps/ just "install spotify" and it downloads it from casks repo, unzips mounts and install spotify to your Applications folder
pstadler Posted April 29, 2014 Author Posted April 29, 2014 This workflow has been updated to fix problems with recent versions of homebrew-cask.
vitor Posted April 30, 2014 Posted April 30, 2014 There’s another consideration here. By not sourcing the users’ shell startup files, it can possibly behave differently than from the command line, as it won’t be including homebrew-cask’s options. A warning on the top post that users will need to reproduce these in the workflow (if they have any of them set) would be a good idea, as not doing it can mess organisation quite a bit, like installing and linking to different directories. On another note, you have some unnecessary code in the workflow. You’re doing #!/bin/bash sh cask.sh <arguments> However, #!/bin/bash is not needed, as Alfred is already taking care of using the correct interpreter. Furthermore, by issuing sh cask.sh you’re actually telling the shell to call another shell to execute the script. You should make the script executable (once, on your side, via chmod +x ./cask.sh), and substitute sh cask.sh <arguments> in the workflow with ./cask.sh <arguments>.
pstadler Posted April 30, 2014 Author Posted April 30, 2014 I didn't expect a code review here. Feedback appreciated, but as I don't have time to refactor it, feel free to open a pull request.
vitor Posted April 30, 2014 Posted April 30, 2014 Apologies if it was insulting in any way. I don’t intend to use the workflow, but as a homebrew-cask collaborator and avid Alfred user, it interested me, which is why I mentioned the options case as that can break the workflow of unsuspecting users.It is also so common in these forums (due to Alfred’s workflows being so powerful an easy to use) to find users with little scripting experience (which I now see is not your case), that I got into the habit of explaining in detail how (and why) to make suggested changes. Making code shorter and at the same time more efficient is always good, and my point is simply that Alfred is already good at making some right decisions for us.
pstadler Posted May 1, 2014 Author Posted May 1, 2014 No worries, I'm not insulted and I agree with you. As a contributor to the homebrew-cask project and the guy who wrote the brew-cask plugin bundled with oh-my-zsh, I hope you keep up the good work! There's definitely potential in this project. Are there any plans regarding a GUI app for the non-devs out there?
pstadler Posted May 1, 2014 Author Posted May 1, 2014 (edited) I just pushed a new version. Changes: - ~/.bash_profile and ~/.profile are now sourced if available (thanks andi-w00t) - cask.sh is now executed without spawning a subshell. Edited May 1, 2014 by Patrick Stadler
vitor Posted May 1, 2014 Posted May 1, 2014 Are there any plans regarding a GUI app for the non-devs out there? Not officially, at least for the time being. Cakebrew could possibly do it, though.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now