<commit_before>''',
Created on May 3rd, 2012

@package: superdesk media archive
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: <NAME>

Publish the GUI resources.
'''

from ..gui_core import publish_gui_resources
from ..gui_core.gui_core import getGuiPath, getPublishedLib, gui_folder_format, \
    lib_folder_format, publishGui
from ..gui_core.gui_lib import publish, server_url
from ..plugin.registry import cdmGUI
from ally.container import ioc
from ally.support.util_io import openURI
from distribution.container import app
from io import BytesIO
import logging

# --------------------------------------------------------------------

log = logging.getLogger(__name__)

# --------------------------------------------------------------------

@ioc.config
def ui_demo_embed_file():
    ''' the demo client html file '''
    return 'index.html'

@ioc.config
def themes_path():
    ''' The path to the themes directory '''
    return 'lib/livedesk-embed/themes'

# --------------------------------------------------------------------

@ioc.after(publish)
def updateDemoEmbedFile():
    if not publish_gui_resources(): return  # No publishing is allowed
    try:
        bootPath = lib_folder_format() % 'livedesk-embed/'
        with openURI(getGuiPath(ui_demo_embed_file())) as f:
            out = f.read().replace(b'{server_url}', bytes(server_url(), 'utf-8'))
            out = out.replace(b'{gui}', bytes(gui_folder_format(), 'utf-8'));
            out = out.replace(b'{lib_core}', bytes(lib_folder_format() % 'core/', 'utf-8'));
            cdmGUI().publishFromFile(bootPath + ui_demo_embed_file(), BytesIO(out))
    except:
        log.exception('Error publishing demo client file')
    else:
        assert log.debug('Client demo script published:', server_url() + getPublishedLib('livedesk-embed/' + ui_demo_embed_file())) or True

@app.populate
def publishJS():
    publishGui('livedesk-embed')<commit_msg>NR-638 : The embed start script is not configured<commit_after>''',
Created on May 3rd, 2012

@package: superdesk media archive
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: <NAME>

Publish the GUI resources.
'''

from ..gui_core import publish_gui_resources
from ..gui_core.gui_core import getGuiPath, getPublishedLib, gui_folder_format, \
    lib_folder_format, publishGui
from ..gui_core.gui_lib import server_url
from ..plugin.registry import cdmGUI
from ally.container import ioc
from ally.support.util_io import openURI
from distribution.container import app
from io import BytesIO
import logging

# --------------------------------------------------------------------

log = logging.getLogger(__name__)

# --------------------------------------------------------------------

@ioc.config
def ui_demo_embed_file():
    ''' the demo client html file '''
    return 'index.html'

@ioc.config
def themes_path():
    ''' The path to the themes directory '''
    return 'lib/livedesk-embed/themes'

# --------------------------------------------------------------------

@app.populate
def publishJS():
    publishGui('livedesk-embed')

@ioc.after(publishJS)
def updateDemoEmbedFile():
    if not publish_gui_resources(): return  # No publishing is allowed
    try:
        bootPath = lib_folder_format() % 'livedesk-embed/'
        with openURI(getGuiPath(ui_demo_embed_file())) as f:
            out = f.read().replace(b'{server_url}', bytes(server_url(), 'utf-8'))
            out = out.replace(b'{gui}', bytes(gui_folder_format(), 'utf-8'));
            out = out.replace(b'{lib_core}', bytes(lib_folder_format() % 'core/', 'utf-8'));
            cdmGUI().publishContent(bootPath + ui_demo_embed_file(), BytesIO(out))
    except:
        log.exception('Error publishing demo client file')
    else:
        assert log.debug('Client demo script published:', server_url() + getPublishedLib('livedesk-embed/' + ui_demo_embed_file())) or True
{'fraction_non_alphanumeric': 0.21814964610717896, 'fraction_numerical': 0.007836198179979777, 'mean_word_length': 2.555256064690027, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2399706', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1128, 'n_words': 285}