Add `is_program_on_path` and `install_docker_most_recent` functions

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Express `run_and_get_stdout` in terms of `run_and_get_output`

`run_and_get_output` can capture both stdout and stderr depending on the
values of its `captureStdout` and `captureStderr` arguments. It sits on
a level below `run_and_get_stdout` in terms of abstraction.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Use `viki_fabric_config.yml` for configuration for viki-fabric-helpers

This patch fixes the location of the YAML file for the
viki-fabric-helpers package to `viki_fabric_config.yml`. This makes it
easier for future patches which may add new keys to the file for
configuring other parts of the package.

Reading of the configuration file happens at the `viki.fabric` package
level, when any module underneath the `viki.fabric` package is imported.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
[BUGFIX] Correct global variable name

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Rename `git` key for `viki_fabric_config.yml` to `viki.fabric.git`

This makes it clear that the configuration is for the `viki.fabric.git`
module.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
viki.fabric.git - Remove need to call `initialize` function

This is achieved by adding a `_check_initialized` decorator, and
decorating the functions in the `viki.fabric.git` module which directly
make use of the global variables are initialized using the `initialize`
function.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Rename `initialize` function to `_initialize`

Since we removed the need to call the `initialize` function in the
previous patch, we can make it private.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Create `get_return_value_from_result_of_execute_runs_once` function

This allows us to retrieve the return value from a local Fabric task
decorated with the `fabric.decorators.runs_once` and run using the
`fabric.tasks.execute` function.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Add `viki.fabric.docker` module

This module contains Docker related Fabric tasks which will help
simplify future development for people authoring Docker related Fabric
scripts.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Rename `initialize` function to `_initialize`

Since we removed the need to call the `initialize` function in the
previous patch, we can make it private.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Use global `VIKI_FABRIC_CONFIG_KEY_NAME` to hold `viki_fabric_config` string

The global is housed in `viki/fabric/__init__.py`; eventually direct
access of the `env.viki_fabric_config` dict should be replaced using
helper functions.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
viki.fabric.helpers - create `get_in_viki_fabric_config` function

This is used to retrieve values read from the `viki_fabric_config.yml`
file under the `viki.fabric.VIKI_FABRIC_CONFIG_KEY_NAME` key.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
viki.fabric.helpers - add `env_has_nested_keys` function

This allows us to determine if a series of nested keys exists within
`fabric.api.env`

Signed-off-by: Pang Yan Han <yanhan@viki.com>
viki.fabric.helpers - add `get_in_env` function

and write `get_in_viki_fabric_config` in terms of `get_in_env`.

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Check that all expected keys exist in env[VIKI_FABRIC_CONFIG_KEY_NAME]["viki.fabric.git"]

by using `assert`

Signed-off-by: Pang Yan Han <yanhan@viki.com>
viki.fabric.git - add `_` prefix to private globals

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Add documentation on configuring viki-fabric-helpers library

Signed-off-by: Pang Yan Han <yanhan@viki.com>
viki.fabric.docker - Reword parts of docstrings for Fabric tasks

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Add short guide to `viki.fabric.docker` module

Signed-off-by: Pang Yan Han <yanhan@viki.com>
Add link to Example Script that shows usage of a helper function

This concrete example should explain things a lot better than the
original docstring.

Signed-off-by: Pang Yan Han <yanhan@viki.com>