phyllisstein Posted March 28, 2013 Share Posted March 28, 2013 (edited) Note from Andrew: While this is a convenient method for updating workflows, I cannot endorse the use of it unless you are fully aware of the security implications of blanket updating all of your workflows. I'm currently working on a built in workflow auto-updater, for a future Alfred 2 release, that performs the standard verification checks that Alfred currently does on manual import, along with migrating your hotkey/keyword settings on upgrading. I'll also be adding 3rd party workflow developer signatures to keep you safe. Hey all, I've just completed a workflow designed to make it easier for workflow developers to push updates to their work. (And to their flows.) It's called Alleyoop, it's based very heavily on the concept behind David's old extension updater, and it works a little something like this: When you enter the query oop, it searches through the workflow folders for files named update.json. update.json indicates what version of the workflow is currently installed and where to check for an update. (The format is below.) Alleyoop downloads a remote json file, indicated in update.json, and if that file indicates a higher version, it downloads the workflow at the address given by the remote file. The user finds the workflow in his or her ~/Downloads directory and opens it. There is no step 4. Workflow developers can start implementing this workflow immediately. All you need is a static place to host a json file and an alfredworkflow file—so Github will do, failing all else, but Droplr won't. Place an update.json file in your workflow, with the following keys defined: { "version": 1.0, "remote_json": "http://alfred.daniel.sh/Updates/Things.json" } version should be a float, meaning that 1.0 and 1.1 and 3.14159 are all valid, but 3.1.4 is not, and remote_json should point to a json file on a remote server that's defined like this: { "version": 1.5, "download_url": "http://alfred.daniel.sh/Workflows/Things.alfredworkflow", "description": "Brief description of the update." } If the version on the remote server is greater than the version on the user's computer, s/he'll see something like this: Selecting a workflow from the list will download it. No fuss, no muss. And that's it! Enjoy implementing this, until we get a good package manager running again, and let me know if you run into any difficulties. Download Here Edited April 4, 2013 by phyllisstein Tyler Eich, thec13, bcometa and 15 others 18 Link to comment
Guest Posted March 28, 2013 Share Posted March 28, 2013 Thank you. Nice idea and let's hope, many of our dev's will implement this! Link to comment
zhaowu Posted March 29, 2013 Share Posted March 29, 2013 That is nice! But I am still hoping for an official method. Link to comment
phyllisstein Posted March 29, 2013 Author Share Posted March 29, 2013 I've made a minor change to the workflow, and to the remote JSON template—hopefully the last, barring any compelling feature requests. If developers could include a key named description in the remote file that—well—describes what the update changes, that'd be terrific. The user workflow will expect that key, and skip your update if it—or any of the other expected JSON data—is absent. With the update description, the workflow now looks like this: Link to comment
CarlosNZ Posted March 29, 2013 Share Posted March 29, 2013 Great idea. I was wondering if someone would do something like this. Will begin adding it to my workflows. Link to comment
zhaowu Posted March 29, 2013 Share Posted March 29, 2013 begin to add to my workflow too. Link to comment
Carlos-Sz Posted March 29, 2013 Share Posted March 29, 2013 (edited) Very nice! I’ll start to make some tests. If there is a way it would be nice to open the forum topic as well (e.g. hitting an action modifier key). Question: the workflow download link can be shortened (e.g. with bitly)? Edited March 29, 2013 by Carlos-Sz Link to comment
jmjeong Posted March 29, 2013 Share Posted March 29, 2013 Good Idea. I begin to add to my workflow too. I encountered the following error message. Jaemok-ui-Mac-Pro:user.workflow.3070F65C-8B64-42DB-BD0F-B69A2EB95612 jmjeong$ python feedback.py Traceback (most recent call last): File "feedback.py", line 107, in <module> do_feedback() File "feedback.py", line 32, in do_feedback local = json.load(f, encoding="utf-8") File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 278, in load **kw) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads return cls(encoding=encoding, **kw).decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode obj, end = self.scan_once(s, idx) ValueError: Expecting , delimiter: line 4 column 5 (char 163) Link to comment
phyllisstein Posted March 29, 2013 Author Share Posted March 29, 2013 Very nice! I’ll start to make some tests. If there is a way it would be nice to open the forum topic as well (e.g. hitting an action modifier key). Question: the workflow download link can be shortened (e.g. with bitly)? No, the link should be a URL that points directly to a .alfredworkflow file. Otherwise the data pulled will be form bitly's redirect page, not the file itself. I'll look into adding a modifier key that opens the workflow's website (as defined in Alfred), which could theoretically point to the forum. Good Idea. I begin to add to my workflow too. I encountered the following error message. Jaemok-ui-Mac-Pro:user.workflow.3070F65C-8B64-42DB-BD0F-B69A2EB95612 jmjeong$ python feedback.py Traceback (most recent call last): File "feedback.py", line 107, in <module> do_feedback() File "feedback.py", line 32, in do_feedback local = json.load(f, encoding="utf-8") File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 278, in load **kw) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads return cls(encoding=encoding, **kw).decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode obj, end = self.scan_once(s, idx) ValueError: Expecting , delimiter: line 4 column 5 (char 163) This means that you're missing a comma in your JSON. Look more carefully at the syntax that's given in the first post: keys and values are separated with colons, key-value pairs are separated with commas. Link to comment
Carlos-Sz Posted March 29, 2013 Share Posted March 29, 2013 No, the link should be a URL that points directly to a .alfredworkflow file. Otherwise the data pulled will be form bitly's redirect page, not the file itself. I'll look into adding a modifier key that opens the workflow's website (as defined in Alfred), which could theoretically point to the forum. Before your reply I made a test with a bitly shortened URL and it worked. The interesting thing is that my hotkeys were not reseted after the updating. So far so good. Link to comment
Boarder24 Posted March 29, 2013 Share Posted March 29, 2013 I love this! At first I was very confused, but after re-reading it, I have set up all my workflows to do updates! Link to comment
phyllisstein Posted March 29, 2013 Author Share Posted March 29, 2013 Before your reply I made a test with a bitly shortened URL and it worked. The interesting thing is that my hotkeys were not reseted after the updating. So far so good. Oh, neat; that's a freebie. Thanks for all the positive feedback, y'all. If you want to send me lists of your workflows that support this, I'll add them to the first post and my Alfred site. Link to comment
CarlosNZ Posted March 29, 2013 Share Posted March 29, 2013 Hey, when trying to run the workflow, it's getting stuck here, with nothing further happening: Interestingly, it seems to be exactly the same problem as I had earlier today with this workflow, which was also Python-based, and it also traversed the Alfred workflow folder, so it's quite possibly same issue. Maybe take a look at how he fixed it? (Or is just because it's not finding any workflow with update info? In which case, it should probably show "No updates found" or something, right?) Link to comment
phyllisstein Posted March 29, 2013 Author Share Posted March 29, 2013 Hey, when trying to run the workflow, it's getting stuck here, with nothing further happening: Interestingly, it seems to be exactly the same problem as I had earlier today with this workflow, which was also Python-based, and it also traversed the Alfred workflow folder, so it's quite possibly same issue. Maybe take a look at how he fixed it? (Or is just because it's not finding any workflow with update info? In which case, it should probably show "No updates found" or something, right?) Could you do the standard thing where you change the script filter command to python feedback.py {query} 2>&1 | tee feedback.log for me and see if the log yields any clues? It does indeed say that there's nothing to update when there's nothing to update—or at least it ought to. Link to comment
CarlosNZ Posted March 29, 2013 Share Posted March 29, 2013 Could you do the standard thing where you change the script filter command to python feedback.py {query} 2>&1 | tee feedback.log for me and see if the log yields any clues? It does indeed say that there's nothing to update when there's nothing to update—or at least it ought to. Righto. Here you go: Traceback (most recent call last): File "feedback.py", line 96, in <module> do_feedback() File "feedback.py", line 33, in do_feedback remote_uri = local["remote_json"] KeyError: 'remote_json' Hope that helps. Link to comment
phyllisstein Posted March 29, 2013 Author Share Posted March 29, 2013 Thanks, it does indeed. What that means is that you've created an "update.json" file somewhere in one of your workflow folders, but haven't set the key "remote_json," which is required. I believe the updated version currently at the link above should, instead of crashing there, quietly ignore the bad data and move on. Link to comment
CarlosNZ Posted March 29, 2013 Share Posted March 29, 2013 Thanks, it does indeed. What that means is that you've created an "update.json" file somewhere in one of your workflow folders, but haven't set the key "remote_json," which is required. I believe the updated version currently at the link above should, instead of crashing there, quietly ignore the bad data and move on. Hmm, pretty sure I hadn't actually created an "update.json" file yet. But whatever, it works now. Cheers. One question regarding setup for workflows: I like to put the version number in the filename (makes it way easier to keep track of IMHO), so I'm assuming this will still be okay, as long as the static "remote.json" is updated with the new filename at the same time as I update the version no.? { "version": 1.5, "download_uri": "http://webhost.com/Workflows/MyWorkflowv1.5.alfredworkflow", "description": "Points to a new file now. Okay?" } Link to comment
phyllisstein Posted March 29, 2013 Author Share Posted March 29, 2013 Hmm, pretty sure I hadn't actually created an "update.json" file yet. But whatever, it works now. Cheers. One question regarding setup for workflows: I like to put the version number in the filename (makes it way easier to keep track of IMHO), so I'm assuming this will still be okay, as long as the static "remote.json" is updated with the new filename at the same time as I update the version no.? { "version": 1.5, "download_uri": "http://webhost.com/Workflows/MyWorkflowv1.5.alfredworkflow", "description": "Points to a new file now. Okay?" } Huh. That's awfully strange. I'll have to poke around a bit more. Changing the value for "download_uri" with each new version should be fine. Nothing is cached on the user's computer, so it'll grab the new one each time it tries to update. Link to comment
Guest Posted March 29, 2013 Share Posted March 29, 2013 Added it to my RealBasic Wiki Search Workflow. Testet it and it works just fine. Thank you phyllisstein. Link to comment
xtin Posted March 29, 2013 Share Posted March 29, 2013 That is awesome, will include it into mine asap. One neat thing would be to have another command "ooplist" or so, to see which workflows are oop-enabled. CarlosNZ 1 Link to comment
jmjeong Posted March 29, 2013 Share Posted March 29, 2013 Added it to my http://www.alfredforum.com/topic/1572-browse-alfred-extension-alfext/ workflow Link to comment
mwaterfall Posted March 29, 2013 Share Posted March 29, 2013 Very nice work! My Datetime Format Converter workflow now supports this. Link to comment
phyllisstein Posted March 29, 2013 Author Share Posted March 29, 2013 That is awesome, will include it into mine asap. One neat thing would be to have another command "ooplist" or so, to see which workflows are oop-enabled. Thanks! I've updated the original workflow so that entering "oop?" will list all compatible workflows. I've also made it compatible with itself, after a fashion: you should now be able to download updates to Alleyoop from within Alleyoop, but they'll show up in your Downloads folder and have to be installed manually, since the script's files can't be overwritten while the script is running. Link to comment
Boarder24 Posted March 29, 2013 Share Posted March 29, 2013 I just integrated all my workflows with this! Download links: AirPlane Mode: http://d.pr/f/HRpR Vpn Connect: http://d.pr/f/S7dq Toggle Caffeine: http://d.pr/f/nPw9 Tunefind: http://d.pr/f/rind Link to comment
Carlos-Sz Posted March 29, 2013 Share Posted March 29, 2013 Thanks! I've updated the original workflow so that entering "oop?" will list all compatible workflows. I've also made it compatible with itself, after a fashion: you should now be able to download updates to Alleyoop from within Alleyoop, but they'll show up in your Downloads folder and have to be installed manually, since the script's files can't be overwritten while the script is running. Great featue. I was about to ask for something like this. Link to comment
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