updated doc files
This commit is contained in:
parent
252443c073
commit
855bc7feb5
1 changed files with 42 additions and 8 deletions
|
|
@ -337,12 +337,22 @@ def get_upload_template_msg(filename, destination, context, use_jinja,
|
||||||
|
|
||||||
@_contextmanager
|
@_contextmanager
|
||||||
def virtualenv_source():
|
def virtualenv_source():
|
||||||
|
"""
|
||||||
|
helper method that sources the virtualenvwrapper for all following commands
|
||||||
|
|
||||||
|
uses python yield command
|
||||||
|
"""
|
||||||
with prefix("source virtualenvwrapper.sh"):
|
with prefix("source virtualenvwrapper.sh"):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
@_contextmanager
|
@_contextmanager
|
||||||
def virtualenv():
|
def virtualenv():
|
||||||
|
"""
|
||||||
|
helper method to set the virtual environment for the following commands
|
||||||
|
|
||||||
|
uses python yield command
|
||||||
|
"""
|
||||||
configuration = env.config
|
configuration = env.config
|
||||||
with virtualenv_source():
|
with virtualenv_source():
|
||||||
with prefix("workon %s" % configuration.virtualenv.name):
|
with prefix("workon %s" % configuration.virtualenv.name):
|
||||||
|
|
@ -485,12 +495,20 @@ def link_create(path_src, path_dst, debug=False):
|
||||||
"""
|
"""
|
||||||
takes a source and destination path, then links it
|
takes a source and destination path, then links it
|
||||||
if the destination path already exists and is a link,
|
if the destination path already exists and is a link,
|
||||||
then delete it. Otherwise sys.exit
|
then delete it.
|
||||||
|
|
||||||
path_src - source path
|
Otherwise sys.exit with an error message.
|
||||||
path_dst - destination path
|
|
||||||
|
|
||||||
returns: if debug=True then it returns a msg
|
:parameter path_src: source path
|
||||||
|
:type path_src: string
|
||||||
|
|
||||||
|
:paramter path_dst: destination path
|
||||||
|
:type path_dst: string
|
||||||
|
|
||||||
|
:parameter debug: whether we do nothing and just return a message
|
||||||
|
:type debug: boolean
|
||||||
|
|
||||||
|
:return: if debug=True then it returns a msg
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from fabric.contrib.files import is_link
|
from fabric.contrib.files import is_link
|
||||||
|
|
@ -531,12 +549,18 @@ def link_create(path_src, path_dst, debug=False):
|
||||||
|
|
||||||
def prompt_continue(message="Do you want to continue? Y/n", default="Y",
|
def prompt_continue(message="Do you want to continue? Y/n", default="Y",
|
||||||
exit=True):
|
exit=True):
|
||||||
""" prompts user if he wants to continue
|
"""
|
||||||
|
prompts user if he wants to continue
|
||||||
|
|
||||||
Keyword Arguments:
|
:parameter message: ask if user wants to continue
|
||||||
|
:type message: string
|
||||||
|
|
||||||
message -- ask if user wants to continue
|
:parameter default: the default entry that we expect for the user if he
|
||||||
default -- what to do if the user hits enter without giving a value
|
hits <enter> enter without giving a value
|
||||||
|
:type default: string
|
||||||
|
|
||||||
|
:parameter exit: whether we do a sys.exit if it fails. default True
|
||||||
|
:type exit: boolean
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from fabric.operations import prompt
|
from fabric.operations import prompt
|
||||||
|
|
@ -560,6 +584,16 @@ def prompt_continue(message="Do you want to continue? Y/n", default="Y",
|
||||||
|
|
||||||
|
|
||||||
def check_debug(env):
|
def check_debug(env):
|
||||||
|
"""
|
||||||
|
helper method to determine if debug was set to True in the fabric
|
||||||
|
environment
|
||||||
|
|
||||||
|
:parameter env: the fabric environment
|
||||||
|
:type env: dict
|
||||||
|
|
||||||
|
:return: True if debug was set
|
||||||
|
:rtype: boolean
|
||||||
|
"""
|
||||||
|
|
||||||
if hasattr(env, 'debug'):
|
if hasattr(env, 'debug'):
|
||||||
return env.debug
|
return env.debug
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue