Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a better way to update (preserving the config) #1

Open
v-yarotsky opened this issue Mar 9, 2016 · 7 comments
Open

Need a better way to update (preserving the config) #1

v-yarotsky opened this issue Mar 9, 2016 · 7 comments

Comments

@v-yarotsky
Copy link
Owner

No description provided.

@v-yarotsky
Copy link
Owner Author

@deanishe mentioned that the config can be stored ~/Library/Application Support/Alfred 2/Workflow Data/<bundle id>

@deanishe
Copy link

There are de facto data and cache directories for each workflow.

Alfred passes their paths in the alfred_workflow_data and alfred_workflow_cache environment vars when you run your workflow, but it doesn't create the directories for you.

@v-yarotsky
Copy link
Owner Author

I just realized that neither of these folders are going to be synced between computers.
How about having explicit backup/restore commands that would make use of alfred_workflow_cache?
The update process would still be quite clunky, but probably not nearly as much as it is today (run dawg edit, copy contents, update, run dawg edit, paste contents).

@deanishe
Copy link

If I wanted to sync data between machines, I'd probably use a sibling directory to the workflow's own, e.g. ../my.bundle.id.sync-data/ or just ../my.bundle.id.data.json. It'll get synced along with all the workflows and Alfred won't overwrite or delete it.

@deanishe
Copy link

The smoothest solution for a situation like this (a workflow rewriting its own info.plist), imo, would be to install a Launch Agent that watches the configuration file and info.plist for changes and calls dawg -update.

That would pick up on most things that can happen, like a user editing the configuration via File > Open Recent instead of dawg edit, or all the user's Script Filters getting deleted on update. You could also drop the -n -W editing method, with its unusual application behaviour.

dawg would have to be careful to avoid an infinite loop when rewriting info.plist itself.

@v-yarotsky
Copy link
Owner Author

Moving the configuration file out of the workflow has one other downside, though – users won't be able to share the workflow with the configuration by just exporting it.
For example, I'd like to share my pre-configured dawg workflow with my team so that they can just double-click to get started.
With that said, I have one more solution in mind, although it can be quite tricky – code auto-update; i.e. dawg could check with github every so often to see if the new version is available, and if it is – it could just download a new binary.

@deanishe
Copy link

Presumably, you'd include a sample configuration with the workflow that gets copied to the proper location on install if no configuration file exists in any case. For your team, replace that with the one from your settings.

My Python workflow library has supported updates via GitHub releases for a good while. It's a super-handy feature, but it doesn't do anything complicated. It just downloads the .alfredworkflow file and tells Alfred to install it via open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants