Beispiel #1
0
    def test_doc_task(self):
        task_config = TaskConfig(
            {
                "class_path": "cumulusci.tests.test_utils.FunTestTask",
                "options": {"color": "black"},
            }
        )
        result = utils.doc_task("command", task_config)
        self.assertEqual(
            """command
==========================================

**Description:** None

**Class::** cumulusci.tests.test_utils.FunTestTask

extra docs

Options:
------------------------------------------

* **flavor** *(required)*: What flavor
* **color**: What color **Default: black**""",
            result,
        )
    def test_doc_task(self):
        task_config = TaskConfig(
            {
                "class_path": "cumulusci.tests.test_utils.FunTestTask",
                "options": {"color": "black"},
            }
        )
        result = utils.doc_task("command", task_config)
        self.assertEqual(
            """command
==========================================

**Description:** None

**Class::** cumulusci.tests.test_utils.FunTestTask

extra docs

Options:
------------------------------------------

* **flavor** *(required)*: What flavor
* **color**: What color **Default: black**""",
            result,
        )
Beispiel #3
0
def task_info(runtime, task_name):
    task_config = (runtime.project_config.get_task(task_name)
                   if runtime.project_config is not None else
                   runtime.global_config.get_task(task_name))

    doc = doc_task(task_name, task_config).encode()
    click.echo(rst2ansi(doc))
Beispiel #4
0
def task_doc(config):
    config_src = config.global_config

    for name, options in list(config_src.tasks.items()):
        task_config = TaskConfig(options)
        doc = doc_task(name, task_config)
        click.echo(doc)
        click.echo("")
Beispiel #5
0
def task_info(config, task_name):
    try:
        task_config = config.project_config.get_task(task_name)
    except CumulusCIUsageError as e:
        raise click.UsageError(str(e))

    doc = doc_task(task_name, task_config).encode()
    click.echo(rst2ansi(doc))
Beispiel #6
0
def task_info(config, task_name):
    check_project_config(config)
    task_config = getattr(config.project_config, 'tasks__{}'.format(task_name))
    if not task_config:
        raise TaskNotFoundError('Task not found: {}'.format(task_name))

    task_config = TaskConfig(task_config)
    click.echo(rst2ansi(doc_task(task_name, task_config)))
Beispiel #7
0
def task_doc(config):
    config_src = config.global_config
    
    for name, options in config_src.tasks.items():
        task_config = TaskConfig(options)
        doc = doc_task(name, task_config)
        click.echo(doc)
        click.echo('')
Beispiel #8
0
    def test_doc_task_not_inherited(self):
        task_config = TaskConfig({
            "class_path": "cumulusci.tests.test_utils.FunTestTaskChild",
            "options": {
                "color": "black"
            },
        })
        result = utils.doc_task("command", task_config)

        assert "extra docs" not in result
Beispiel #9
0
def task_doc(runtime):
    config_src = runtime.global_config

    click.echo("==========================================")
    click.echo("Tasks Reference")
    click.echo("==========================================")
    click.echo("")

    for name, options in config_src.tasks.items():
        task_config = TaskConfig(options)
        doc = doc_task(name, task_config)
        click.echo(doc)
        click.echo("")
Beispiel #10
0
    def test_doc_task(self):
        task_config = TaskConfig({
            'class_path': 'cumulusci.tests.test_utils.TestTask',
            'options': {
                'color': 'black',
            }
        })
        result = utils.doc_task('command', task_config)
        self.assertEqual("""command
==========================================

**Description:** None

**Class::** cumulusci.tests.test_utils.TestTask

Options:
------------------------------------------

* **flavor** *(required)*: What flavor
* **color**: What color **Default: black**""", result)
Beispiel #11
0
    def test_doc_task(self, task_config):
        task_doc = utils.doc_task("scoop_icecream", task_config)
        assert (task_doc == """**scoop_icecream**
==========================================\n
**Description:** Scoops icecream\n
**Class:** cumulusci.tests.test_utils.FunTestTask\n
extra docs
Command Syntax\n------------------------------------------\n
``$ cci task run scoop_icecream``\n\n
Options\n------------------------------------------\n\n
``--flavor VANILLA``
\t *Required*\n
\t What flavor\n
\t Type: string\n
``--color COLOR``
\t *Optional*\n
\t What color\n
\t Default: black\n
``--size SIZE``
\t *Optional*\n
\t How big""")
Beispiel #12
0
def task_info(config, task_name):
    check_project_config(config)
    task_config = getattr(config.project_config, 'tasks__{}'.format(task_name))
    if not task_config:
        raise TaskNotFoundError('Task not found: {}'.format(task_name))

    task_config = TaskConfig(task_config)
    click.echo(rst2ansi(doc_task(task_name, task_config)))
    return
    class_path = task_config.get('class_path')
    task_class = import_class(class_path)

    # General task info
    click.echo('Description: {}'.format(task_config.get('description')))
    click.echo('Class: {}'.format(task_config.get('class_path')))

    # Default options
    default_options = task_config.get('options', {})
    if default_options:
        click.echo('')
        click.echo('Default Option Values')
        for key, value in default_options.items():
            click.echo('    {}: {}'.format(key, value))

    # Task options
    task_options = getattr(task_class, 'task_options', {})
    if task_options:
        click.echo('')
        data = []
        headers = ['Option', 'Required', 'Description']
        for key, option in task_options.items():
            if option.get('required'):
                data.append((key, '*', option.get('description')))
            else:
                data.append((key, '', option.get('description')))
        table = Table(data, headers)
        click.echo(table)
Beispiel #13
0
def task_info(config, task_name):
    task_config = config.project_config.get_task(task_name)
    doc = doc_task(task_name, task_config).encode()
    click.echo(rst2ansi(doc))