Skip to content

Commit

Permalink
Document persisting workflow variables
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Jun 29, 2018
1 parent cb4ce7d commit c33f41a
Show file tree
Hide file tree
Showing 15 changed files with 230 additions and 433 deletions.
405 changes: 12 additions & 393 deletions README.md

Large diffs are not rendered by default.

Binary file added alfred-workflow-1.33.zip
Binary file not shown.
Binary file modified docs/Alfred-Workflow.docset.zip
Binary file not shown.
14 changes: 14 additions & 0 deletions docs/api/util.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ as running AppleScript or JXA code, or calling an External Trigger.
.. autofunction:: appinfo


Configuration
^^^^^^^^^^^^^

Functions for manipulating the values of workflow variables in the
`workflow configuration sheet`_/``info.plist``.

.. autofunction:: set_config

.. autofunction:: unset_config


Other helpers
^^^^^^^^^^^^^

Expand All @@ -54,3 +65,6 @@ The following exceptions, may be raised by utility functions.
.. autoexception:: AcquisitionError

.. autoexception:: subprocess.CalledProcessError


.. _workflow configuration sheet: https://www.alfredapp.com/help/workflows/advanced/variables/#environment
17 changes: 14 additions & 3 deletions docs/api/web.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@ modelled on the excellent `requests`_ library.
The purpose of :mod:`workflow.web` is to cover trivial cases at just 0.5% of
the size of `requests`_.

.. warning::
.. danger::

As :mod:`workflow.web` is based on Python 2's standard HTTP libraries,
it **does not** verify SSL certificates when establishing HTTPS
connections on Python versions older than 2.7.9 (i.e. pre-Yosemite).
there are two important problems with SSL connections.

Python versions older than 2.7.9 (i.e. pre-Yosemite) **do not**
verify SSL certificates when establishing HTTPS connections.

As a result, you **must not** use this module for sensitive
connections unless you're certain it will only run on 2.7.9/Yosemite
and later. If your workflow is Alfred 3-only, this requirement is met.
Secondly, versions of macOS older than High Sierra (10.13) have an
extremely outdated version of OpenSSL, which is incompatible with
many servers' SSL configuration.

Consequently, :mod:`workflow.web` cannot connect to such servers.
As this includes GitHub's SSL configuration, the
:ref:`update mechanism <guide-updates>` only works on High Sierra
and later.
.. autofunction:: get
.. autofunction:: post
Expand Down
45 changes: 45 additions & 0 deletions docs/aw-workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ corresponding section in the `GitHub README`_.
- `Alfred Soundboard <http://www.packal.org/workflow/alfred-soundboard>`__
by `Steffen <http://www.packal.org/users/steffen>`__.
A soundboard for alfred at your fingertips.
- `alfred-can-i-use-search <http://www.packal.org/workflow/alfred-can-i-use-search>`__
by `CHARLIE AN <http://www.packal.org/users/charlie-an>`__.
Browser support tables for modern web technologies.
- `Alfred-Drive-Workflow <http://www.packal.org/workflow/alfred-drive-workflow>`__
by `azai91 <http://www.packal.org/users/azai91>`__.
Browse, search and open Google Drive files from within Alfred.
Expand Down Expand Up @@ -69,6 +72,12 @@ corresponding section in the `GitHub README`_.
- `aws-alfred-workflow <http://www.packal.org/workflow/aws-alfred-workflow>`__
by `twang <http://www.packal.org/users/twang>`__.
Workflow for searching AWS.
- `Baidu Translate (百度翻译) <http://www.packal.org/workflow/baidu-translate-bai-du-fan-yi>`__
by `zer4tul <http://www.packal.org/users/zer4tul>`__.
Translate using Baidu's translate service API.
- `Baidu Translation <http://www.packal.org/workflow/baidu-translation>`__
by `niuniu3 <http://www.packal.org/users/niuniu3>`__.
Translate words by Baidu Translation Service.
- `Base Converter <http://www.packal.org/workflow/base-converter>`__
by `ahalbert <http://www.packal.org/users/ahalbert>`__.
Convert arbitrary bases(up to base 32) in Alfred 2 and copy them to the clipboard.
Expand All @@ -84,6 +93,9 @@ corresponding section in the `GitHub README`_.
- `BibQuery <http://www.packal.org/workflow/bibquery>`__
by `hackademic <http://www.packal.org/users/hackademic>`__.
Search BibDesk from the comfort of your keyboard.
- `Bing Search <http://www.packal.org/workflow/bing-search>`__
by `gedogdong2010 <http://www.packal.org/users/gedogdong2010>`__.
Get bing search results based on your query.
- `Bitcoin Exchange Rates <http://www.packal.org/workflow/bitcoin-exchange-rates>`__
by `Benny <http://www.packal.org/users/benny>`__.
Request current bitcoin exchange rate from blockchain.info.
Expand All @@ -108,6 +120,9 @@ corresponding section in the `GitHub README`_.
- `Cheatsheet <http://www.packal.org/workflow/cheatsheet>`__
by `mutasem <http://www.packal.org/users/mutasem>`__.
Get shortcuts for your tools.
- `ChromeBookmarks <http://www.packal.org/workflow/chromebookmarks>`__
by `duanemay <http://www.packal.org/users/duanemay>`__.
Search Chrome Bookmarks.
- `Code Case <http://www.packal.org/workflow/code-case>`__
by `dfay <http://www.packal.org/users/dfay>`__.
Case Converter for Code.
Expand All @@ -126,6 +141,9 @@ corresponding section in the `GitHub README`_.
- `CryptoCurrency Price Tracker <http://www.packal.org/workflow/cryptocurrency-price-tracker>`__
by `rhlsthrm <http://www.packal.org/users/rhlsthrm>`__.
Quickly check cryptocurrency prices.
- `Currency Converter <http://www.packal.org/workflow/currency-converter-0>`__
by `代战 <http://www.packal.org/users/代战>`__.
Currency Exchange include BTC, ETH.
- `Currency Exchange <http://www.packal.org/workflow/currency-exchange>`__
by `daninfpj <http://www.packal.org/users/daninfpj>`__.
Alfred workflow to convert between currencies (including Bitcoin).
Expand Down Expand Up @@ -198,6 +216,12 @@ corresponding section in the `GitHub README`_.
- `GitLab <http://www.packal.org/workflow/gitlab>`__
by `lwaite <http://www.packal.org/users/lwaite>`__.
GitLab Project search for Alfred.
- `Gitmoji <http://www.packal.org/workflow/gitmoji-0>`__
by `leolabs <http://www.packal.org/users/leolabs>`__.
Search for Gitmojis easily and copy them to your clipboard.
- `gitmoji <http://www.packal.org/workflow/gitmoji>`__
by `o <http://www.packal.org/users/o>`__.
This simple Alfred workflow lets you quick search and input gitmoji.
- `Glosbe Translation <http://www.packal.org/workflow/glosbe-translation>`__
by `deanishe <http://www.packal.org/users/deanishe>`__.
Translate text using Glosbe.com.
Expand All @@ -222,6 +246,9 @@ corresponding section in the `GitHub README`_.
- `HGNC Search <http://www.packal.org/workflow/hgnc-search>`__
by `danielecook <http://www.packal.org/users/danielecook>`__.
Search for human genes.
- `Home Assistant <http://www.packal.org/workflow/home-assistant>`__
by `Skakiz <http://www.packal.org/users/skakiz>`__.
You will be able to control you lights, get sensor information, trigger automations and look for your devices in device tracker. All in Home Assistance.
- `Homebrew and Cask for Alfred <http://www.packal.org/workflow/homebrew-and-cask-alfred>`__
by `fniephaus <http://www.packal.org/users/fniephaus>`__.
Easily control Homebrew and Cask with Alfred.
Expand Down Expand Up @@ -279,6 +306,9 @@ corresponding section in the `GitHub README`_.
- `LastPass Vault Manager <http://www.packal.org/workflow/lastpass-vault-manager>`__
by `bachya <http://www.packal.org/users/bachya>`__.
A workflow to interact with a LastPass vault.
- `LeetCode Search <http://www.packal.org/workflow/leetcode-search>`__
by `cocoboy027 <http://www.packal.org/users/cocoboy027>`__.
LeetCode Search is an Alfred Workflow plugin for searching algorithm problems in LeetCode with custom options.
- `LibGen <http://www.packal.org/workflow/libgen>`__
by `hackademic <http://www.packal.org/users/hackademic>`__.
Search and Download pdfs and ebooks from Library Genesis.
Expand Down Expand Up @@ -402,6 +432,9 @@ corresponding section in the `GitHub README`_.
- `RGB to Hex <http://www.packal.org/workflow/rgb-hex>`__
by `Sonic Wu <http://www.packal.org/users/sonic-wu>`__.
Convert RGB values of a color to a hexadecimal string.
- `rockkoca.workflow.figure-fight-sogou <http://www.packal.org/workflow/rockkocaworkflowfigure-fight-sogou>`__
by `rockkoca <http://www.packal.org/users/rockkoca>`__.
Funny Figures for Chatting.
- `Rotten Search <http://www.packal.org/workflow/rotten-search>`__
by `yakiyama <http://www.packal.org/users/yakiyama>`__.
Search movie from RottenTomatoes.com.
Expand Down Expand Up @@ -486,6 +519,12 @@ corresponding section in the `GitHub README`_.
- `SwitchHosts! <http://www.packal.org/workflow/switchhosts>`__
by `oldj <http://www.packal.org/users/oldj>`__.
The workflow for SwitchHosts! app.
- `Synonyms <http://www.packal.org/workflow/synonyms>`__
by `David <http://www.packal.org/users/david>`__.
Display synonyms from www.synonyms.net.
- `Tado <http://www.packal.org/workflow/tado>`__
by `auino <http://www.packal.org/users/auino>`__.
Access to your Tado from Alfred.
- `TeXdoc <http://www.packal.org/workflow/texdoc>`__
by `Egon Geerardyn <http://www.packal.org/users/egon-geerardyn>`__.
Searches your LaTeX documentation using texdoc.
Expand Down Expand Up @@ -522,6 +561,12 @@ corresponding section in the `GitHub README`_.
- `Wikify <http://www.packal.org/workflow/wikify>`__
by `hackademic <http://www.packal.org/users/hackademic>`__.
Your little Evernote Wiki-Helper.
- `Word Counter App <http://www.packal.org/workflow/word-counter-app>`__
by `markwk <http://www.packal.org/users/markwk>`__.
Display Latest Typing Word Counts and Export Stats to CSV.
- `Word Search <http://www.packal.org/workflow/word-search>`__
by `isaacpz <http://www.packal.org/users/isaacpz>`__.
Finds new words to improve your writing.
- `Workflow Directory - Open in Finder or Terminal <http://www.packal.org/workflow/workflow-directory-open-finder-or-terminal>`__
by `jeffsui <http://www.packal.org/users/jeffsui>`__.
Same behavior as the right click menu on a workflow. Saves you time if you are developing workflows.
Expand Down
16 changes: 15 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,21 @@ If you'd like to submit a pull request, please observe the following:
seconds or less is smooth. Alfred-Workflow should do its utmost to
consume as little of that time as possible.

The main entry point for unit testing is the ``run-tests.sh`` script in the root directory. This will fail *if code coverage is < 100%*. Travis-CI also uses this script. Add `# pragma: no cover` with care.
The main entry point for unit testing is the ``run-tests.sh`` script in the root directory. This will fail *if code coverage is < 100%*. Travis-CI also uses this script. Add ``# pragma: no cover`` with care.


.. _unit-tests:

Unit tests
==========

Alfred-Workflow includes a full suite of unit tests. Please use the
``run-tests.sh`` script in the root directory of the repo to run the unit tests:
it creates the necessary test environment to run the unit tests.
``test_workflow.py`` *will* fail if not run via ``run-scripts.sh``, but the test
suites for the other modules may also be run directly.

Moreover, ``run-tests.sh`` checks the coverage of the unit tests and will fail if it is below 100%.


.. _questions:
Expand Down
11 changes: 10 additions & 1 deletion docs/guide/persistent-data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ convenient interface for storing persistent settings with
See :ref:`Settings <guide-settings>` and :ref:`Keychain access <keychain>` for more
information on storing settings and sensitive data.


.. _caching-data:

Caching data
Expand Down Expand Up @@ -228,6 +229,14 @@ for details on how ``filter_func`` works.
Settings
========

.. tip::

Alfred 3.6 introduced an API to update the workflow variables stored in
the workflow's configuration sheet (i.e. the values are persisted
across workflow runs). See :ref:`workflow-variables` if you'd prefer
to store your workflow's settings there.


:attr:`Workflow.settings` is a subclass of :class:`dict` that automatically
saves its contents to the ``settings.json`` file in your Workflow's data
directory when it is changed.
Expand Down Expand Up @@ -330,5 +339,5 @@ For example:
If you only want to write to a file, you can use the
:class:`~workflow.workflow.atomic_writer` context manager. This does not
guarantee that the file will be written, but does guarantee that it will
only be written if the write succeeds (the data is first written to a temporary
only be written if the write succeeds (the data are first written to a temporary
file).
14 changes: 12 additions & 2 deletions docs/guide/update.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ if a newer version is available.
Currently, only updates from `GitHub releases`_ are supported.


.. important::

Updating from GitHub requires (at least) macOS 10.13/High Sierra.

The extremely outdated version of OpenSSL in 10.12/Sierra and
earlier is not compatible with GitHub's SSL configuration, so the
system Python (and therefore this library) cannot connect to
GitHub's servers.


.. contents::
:local:

Expand Down Expand Up @@ -137,8 +147,8 @@ workflow alongside ``info.plist``::
...


The ``version`` file should be plain text with no file extension and contain
nothing but the version string, e.g.::
The ``version`` file should be plain text with no file extension and
contain nothing but the version string, e.g.::

1.2.5

Expand Down
Loading

0 comments on commit c33f41a

Please sign in to comment.