Jump to content


Photo

Alleyoop: Update Alfred Workflows

update package management behind-the-scenes

  • Please log in to reply
168 replies to this topic

#1 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 370 posts
  • LocationNew York, NY

Posted 28 March 2013 - 06:06 PM

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:

  1. 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.)
  2. 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.
  3. The user finds the workflow in his or her ~/Downloads directory and opens it.
  4. 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:

alley_screen.jpg

 

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 by phyllisstein, 04 April 2013 - 09:39 AM.

  • Tyler Eich, drking, Clinton Strong and 16 others like this

alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#2 Schneppi

Schneppi

    Member

  • Member
  • PipPip
  • 29 posts

Posted 28 March 2013 - 11:29 PM

Thank you. Nice idea and let's hope, many of our dev's will implement this!



#3 zhaowu

zhaowu

    Member

  • Member
  • PipPip
  • 96 posts

Posted 29 March 2013 - 12:01 AM

That is nice! But I am still hoping for an official method.



#4 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 370 posts
  • LocationNew York, NY

Posted 29 March 2013 - 12:47 AM

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:

 

alley_2.jpg


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#5 CarlosNZ

CarlosNZ

    Advanced Member

  • Member
  • PipPipPip
  • 371 posts
  • LocationAuckland, New Zealand

Posted 29 March 2013 - 12:53 AM

Great idea. I was wondering if someone would do something like this. Will begin adding it to my workflows.


Twitter: @CarlosNZ | My Alfred Workflows: Carl's Geekzone

#6 zhaowu

zhaowu

    Member

  • Member
  • PipPip
  • 96 posts

Posted 29 March 2013 - 03:00 AM

begin to add to my workflow too.



#7 Carlos-Sz

Carlos-Sz

    Advanced Member

  • Member
  • PipPipPip
  • 767 posts

Posted 29 March 2013 - 04:11 AM

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 by Carlos-Sz, 29 March 2013 - 04:14 AM.


#8 jmjeong

jmjeong

    Member

  • Member
  • PipPip
  • 68 posts

Posted 29 March 2013 - 05:00 AM

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)
 


#9 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 370 posts
  • LocationNew York, NY

Posted 29 March 2013 - 05:08 AM

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.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#10 Carlos-Sz

Carlos-Sz

    Advanced Member

  • Member
  • PipPipPip
  • 767 posts

Posted 29 March 2013 - 05:29 AM

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.



#11 Boarder24

Boarder24

    Member

  • Member
  • PipPip
  • 41 posts

Posted 29 March 2013 - 05:39 AM

I love this! At first I was very confused, but after re-reading it, I have set up all my workflows to do updates!


Mountain Lion, OS X 10.8.3

 

 


#12 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 370 posts
  • LocationNew York, NY

Posted 29 March 2013 - 08:07 AM

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.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#13 CarlosNZ

CarlosNZ

    Advanced Member

  • Member
  • PipPipPip
  • 371 posts
  • LocationAuckland, New Zealand

Posted 29 March 2013 - 09:05 AM

Hey, when trying to run the workflow, it's getting stuck here, with nothing further happening:

screenshot20130329at100.png

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? :unsure: In which case, it should probably show "No updates found" or something, right?)


Twitter: @CarlosNZ | My Alfred Workflows: Carl's Geekzone

#14 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 370 posts
  • LocationNew York, NY

Posted 29 March 2013 - 09:14 AM

Hey, when trying to run the workflow, it's getting stuck here, with nothing further happening:

screenshot20130329at100.png

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? :unsure: 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.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#15 CarlosNZ

CarlosNZ

    Advanced Member

  • Member
  • PipPipPip
  • 371 posts
  • LocationAuckland, New Zealand

Posted 29 March 2013 - 09:17 AM

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. ;)


Twitter: @CarlosNZ | My Alfred Workflows: Carl's Geekzone

#16 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 370 posts
  • LocationNew York, NY

Posted 29 March 2013 - 09:20 AM

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.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#17 CarlosNZ

CarlosNZ

    Advanced Member

  • Member
  • PipPipPip
  • 371 posts
  • LocationAuckland, New Zealand

Posted 29 March 2013 - 09:26 AM

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?"
}

Twitter: @CarlosNZ | My Alfred Workflows: Carl's Geekzone

#18 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 370 posts
  • LocationNew York, NY

Posted 29 March 2013 - 09:31 AM

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.


alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#19 Schneppi

Schneppi

    Member

  • Member
  • PipPip
  • 29 posts

Posted 29 March 2013 - 10:45 AM

Added it to my RealBasic Wiki Search Workflow.

Testet it and it works just fine.

Thank you phyllisstein.



#20 xtin

xtin

    Member

  • Member
  • PipPip
  • 41 posts

Posted 29 March 2013 - 11:44 AM

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 and Schneppi like this



Also tagged with one or more of these keywords: update, package management, behind-the-scenes

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users