# Path: test/framework/config.py



import os, re, tempfile
from os.path import join as jp
from functools import partial
from jenkinsflow.test import cfg as test_cfg
from jenkinsflow.test.cfg import ApiType
from .config import flow_graph_root_dir
from .lines_in import lines_in as generic_lines_in
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.




_log_file_prefix = tempfile.gettempdir() + '/jenkinsflow/'


def _script_api_log_file(job_name):
    return _log_file_prefix + job_name + '.log'


def console_url(api, job_name, num):
    if api.api_type == ApiType.SCRIPT:
        return _script_api_log_file(job_name)
    return 'http://x.x/job/' + job_name + '/' + (str(num) + "/console" if api.api_type == ApiType.MOCK else "")


def result_msg(api, job_name, num=None):
    if api.api_type == ApiType.SCRIPT:
        return repr(job_name) + " - build: " + _script_api_log_file(job_name)
    return repr(job_name) + " - build: http://x.x/job/" + job_name + "/" + (str(num) + "/console" if api.api_type == ApiType.MOCK and num else "")


def build_started_msg(api, job_name, num, invocation_number=0):

# Path: test/framework/config.py



# Path: test/framework/utils.py
import os, re, tempfile
from os.path import join as jp
from functools import partial
from jenkinsflow.test import cfg as test_cfg
from jenkinsflow.test.cfg import ApiType
from .config import flow_graph_root_dir
from .lines_in import lines_in as generic_lines_in

# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.




_log_file_prefix = tempfile.gettempdir() + '/jenkinsflow/'


def _script_api_log_file(job_name):
    return _log_file_prefix + job_name + '.log'


def console_url(api, job_name, num):
    if api.api_type == ApiType.SCRIPT:
        return _script_api_log_file(job_name)
    return 'http://x.x/job/' + job_name + '/' + (str(num) + "/console" if api.api_type == ApiType.MOCK else "")


def result_msg(api, job_name, num=None):
    if api.api_type == ApiType.SCRIPT:
        return repr(job_name) + " - build: " + _script_api_log_file(job_name)
    return repr(job_name) + " - build: http://x.x/job/" + job_name + "/" + (str(num) + "/console" if api.api_type == ApiType.MOCK and num else "")


def build_started_msg(api, job_name, num, invocation_number=0):

    return "Build started: " + repr(job_name) + ((' Invocation-' + repr(invocation_number)) if invocation_number else '') + " - " + console_url(api, job_name, num)