<commit_before># -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

"""Base bundles.

.. py:data:: invenio

    Invenio JavaScript scripts

.. py:data:: styles

    Stylesheets such as Twitter Bootstrap, Font-Awesome, Invenio, ...

.. py:data:: jquery

    JavaScript libraries such as jQuery, Type Ahead, Bootstrap, Hogan, ...

    .. note::
        ``bootstrap.js`` provides ``$.fn.button`` which will be overwritten by
        jQueryUI button when loaded globally. Use require.js to load only the
        jQueryUI modules of your needs.

        .. code-block:: javascript

            require(['jquery', 'ui/accordion'], function($) {
                $(function(){
                    $('#accordion').accordion()
                })
            })

.. py:data:: lessjs

    LessCSS JavaScript library that is used in debug mode to render the less
    stylesheets

.. py:data:: requirejs

    Require.js JavaScript library used in debug mode to load asynchronously the
    Javascript modules (defined using AMD).

.. py:data:: almondjs

    Require.js JavaScript library used in production mode. It cannot load
    asynchronously the module that must be bundles using ``r.js``.
"""

import mimetypes

from invenio.ext.assets import Bundle


mimetypes.add_type("text/css", ".less")


invenio = Bundle(
    "js/invenio.js",
    output="invenio.js",
    filters="requirejs",
    weight=90
)

styles = Bundle(
    "vendors/jquery-tokeninput/styles/token-input.css",
    "vendors/jquery-tokeninput/styles/token-input-facebook.css",
    "vendors/typeahead.js-bootstrap3.less/typeahead.css",
    "less/base.less",
    "less/user-menu.less",
    "less/sticky-footer.less",
    "less/footer.less",
    output="invenio.css",
    depends=[
        "less/base.less",
        "less/base/**/*.less"
    ],
    filters="less,cleancss",
    weight=50,
    bower={
        "bootstrap": "3.2.0",
        "font-awesome": "4.1.0",
        "typeahead.js-bootstrap3.less": "0.2.3",
    }
)

# FIXME
#if config.CFG_WEBSTYLE_TEMPLATE_SKIN != "default":
#    styles.contents.append("css/" + config.CFG_WEBSTYLE_TEMPLATE_SKIN + ".css")

jquery = Bundle(
    "vendors/jquery/dist/jquery.js",
    "vendors/jquery.jeditable/index.js",
    "vendors/jquery-tokeninput/src/jquery.tokeninput.js",
    "vendors/jquery.caret/dist/jquery.caret-1.5.2.js",
    "vendors/typeahead.js/dist/typeahead.bundle.js",
    "vendors/hogan/web/builds/3.0.2/hogan-3.0.2.js",
    "vendors/bootstrap/dist/js/bootstrap.js",
    "js/bootstrap-select.js",
    "js/translate.js",
    "js/init.js",
    output="jquery.js",
    filters="requirejs",
    weight=10,
    bower={
        # The dependencies marked as *orphan* are not part of any bundles
        # and loaded manually using the script tag. Usually from legacy pages.
        "flot": "latest",  # orphan
        "jquery": "~1.11",
        "jquery.caret": "https://github.com/acdvorak/jquery.caret.git",
        "jquery-form": "latest",  # orphan
        "jquery.hotkeys": "https://github.com/jeresig/"  # orphan
                          "jquery.hotkeys.git",
        "jquery.jeditable": "http://invenio-software.org/download/jquery/"
                            "v1.5/js/jquery.jeditable.mini.js",
        "jquery-migrate": "latest",  # orphan
        "jquery-multifile": "svn+http://jquery-multifile-plugin.googlecode.com"
                            "/svn/",  # orphan
        "jquery-tablesorter": "http://invenio-software.org/download/jquery/"
                              "jquery.tablesorter.20111208.zip",  # orphan
        "jquery-tokeninput": "latest",
        "jquery.treeview": "latest",  # orphan, to be replaced by jqTree
        "json2": "latest",  # orphan
        "hogan": "~3",
        "MathJax": "~2.4",  # orphan
        "swfobject": "latest",  # orphan
        "typeahead.js": "latest",
        "uploadify": "latest"  # orphan
        #"bootstrap": "*", is set by invenio.css already.
    }
)

# less.js is only used when the following configuration is set:
#
#  - ASSETS_DEBUG is True
#  - LESS_RUN_IN_DEBUG is False
#
lessjs = Bundle(
    "vendors/less/dist/less-1.7.0.js",
    output="less.js",
    filters="uglifyjs",
    weight=0,
    bower={
        "less": "latest"
    }
)

# require.js is only used when:
#
#  - ASSETS_DEBUG is True
#  - REQUIREJS_RUN_IN_DEBUG is not False
requirejs = Bundle(
    "vendors/requirejs/require.js",
    "js/settings.js",
    output="require.js",
    filters="uglifyjs",
    weight=0,
    bower={
        "requirejs": "latest",
        "requirejs-hogan-plugin": "latest"
    }
)

# almond.js is only used when:
#
#  - ASSETS_DEBUG is False
#  - or REQUIREJS_RUN_IN_DEBUG is True
almondjs = Bundle(
    "vendors/almond/almond.js",
    "js/settings.js",
    output="almond.js",
    filters="uglifyjs",
    weight=0,
    bower={
        "almond": "latest"
    }
)
<commit_msg>base: removal of typeahead.js from bundles<commit_after># -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

"""Base bundles.

.. py:data:: invenio

    Invenio JavaScript scripts

.. py:data:: styles

    Stylesheets such as Twitter Bootstrap, Font-Awesome, Invenio, ...

.. py:data:: jquery

    JavaScript libraries such as jQuery, Type Ahead, Bootstrap, Hogan, ...

    .. note::
        ``bootstrap.js`` provides ``$.fn.button`` which will be overwritten by
        jQueryUI button when loaded globally. Use require.js to load only the
        jQueryUI modules of your needs.

        .. code-block:: javascript

            require(['jquery', 'ui/accordion'], function($) {
                $(function(){
                    $('#accordion').accordion()
                })
            })

.. py:data:: lessjs

    LessCSS JavaScript library that is used in debug mode to render the less
    stylesheets

.. py:data:: requirejs

    Require.js JavaScript library used in debug mode to load asynchronously the
    Javascript modules (defined using AMD).

.. py:data:: almondjs

    Require.js JavaScript library used in production mode. It cannot load
    asynchronously the module that must be bundles using ``r.js``.
"""

import mimetypes

from invenio.ext.assets import Bundle


mimetypes.add_type("text/css", ".less")


invenio = Bundle(
    "js/invenio.js",
    output="invenio.js",
    filters="requirejs",
    weight=90
)

styles = Bundle(
    "vendors/jquery-tokeninput/styles/token-input.css",
    "vendors/jquery-tokeninput/styles/token-input-facebook.css",
    "vendors/typeahead.js-bootstrap3.less/typeahead.css",
    "less/base.less",
    "less/user-menu.less",
    "less/sticky-footer.less",
    "less/footer.less",
    output="invenio.css",
    depends=[
        "less/base.less",
        "less/base/**/*.less"
    ],
    filters="less,cleancss",
    weight=50,
    bower={
        "bootstrap": "3.2.0",
        "font-awesome": "4.1.0",
        "typeahead.js-bootstrap3.less": "0.2.3",
    }
)

# FIXME
#if config.CFG_WEBSTYLE_TEMPLATE_SKIN != "default":
#    styles.contents.append("css/" + config.CFG_WEBSTYLE_TEMPLATE_SKIN + ".css")

jquery = Bundle(
    "vendors/jquery/dist/jquery.js",
    "vendors/jquery.jeditable/index.js",
    "vendors/jquery-tokeninput/src/jquery.tokeninput.js",
    "vendors/jquery.caret/dist/jquery.caret-1.5.2.js",
    "vendors/hogan/web/builds/3.0.2/hogan-3.0.2.js",
    "vendors/bootstrap/dist/js/bootstrap.js",
    "js/bootstrap-select.js",
    "js/translate.js",
    "js/init.js",
    output="jquery.js",
    filters="requirejs",
    weight=10,
    bower={
        # The dependencies marked as *orphan* are not part of any bundles
        # and loaded manually using the script tag. Usually from legacy pages.
        "flot": "latest",  # orphan
        "jquery": "~1.11",
        "jquery.caret": "https://github.com/acdvorak/jquery.caret.git",
        "jquery-form": "latest",  # orphan
        "jquery.hotkeys": "https://github.com/jeresig/"  # orphan
                          "jquery.hotkeys.git",
        "jquery.jeditable": "http://invenio-software.org/download/jquery/"
                            "v1.5/js/jquery.jeditable.mini.js",
        "jquery-migrate": "latest",  # orphan
        "jquery-multifile": "svn+http://jquery-multifile-plugin.googlecode.com"
                            "/svn/",  # orphan
        "jquery-tablesorter": "http://invenio-software.org/download/jquery/"
                              "jquery.tablesorter.20111208.zip",  # orphan
        "jquery-tokeninput": "latest",
        "jquery.treeview": "latest",  # orphan, to be replaced by jqTree
        "json2": "latest",  # orphan
        "hogan": "~3",
        "MathJax": "~2.4",  # orphan
        "swfobject": "latest",  # orphan
        "typeahead.js": "latest",
        "uploadify": "latest"  # orphan
        #"bootstrap": "*", is set by invenio.css already.
    }
)

# less.js is only used when the following configuration is set:
#
#  - ASSETS_DEBUG is True
#  - LESS_RUN_IN_DEBUG is False
#
lessjs = Bundle(
    "vendors/less/dist/less-1.7.0.js",
    output="less.js",
    filters="uglifyjs",
    weight=0,
    bower={
        "less": "latest"
    }
)

# require.js is only used when:
#
#  - ASSETS_DEBUG is True
#  - REQUIREJS_RUN_IN_DEBUG is not False
requirejs = Bundle(
    "vendors/requirejs/require.js",
    "js/settings.js",
    output="require.js",
    filters="uglifyjs",
    weight=0,
    bower={
        "requirejs": "latest",
        "requirejs-hogan-plugin": "latest"
    }
)

# almond.js is only used when:
#
#  - ASSETS_DEBUG is False
#  - or REQUIREJS_RUN_IN_DEBUG is True
almondjs = Bundle(
    "vendors/almond/almond.js",
    "js/settings.js",
    output="almond.js",
    filters="uglifyjs",
    weight=0,
    bower={
        "almond": "latest"
    }
)

{'fraction_non_alphanumeric': 0.1413805500629157, 'fraction_numerical': 0.012403379471508179, 'mean_word_length': 2.596315449256626, 'pattern_counts': {'":': 52, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7185121', 'n_tokens_mistral': 3783, 'n_tokens_neox': 3602, 'n_words': 904}