def _enable_jasmine(): """Set jasmine sources and specs if it's enabled. Jasmine is used for javascript tests and is not installed on the production environment, that is why we must check if it enabled before tying to import it. """ if getattr(settings, "ENABLE_JASMINE", False): from flask.ext.jasmine import Asset from flask.ext.jasmine import Jasmine # Configure Flask-Jasmine, for dev mode unit testing jasmine = Jasmine(app) jasmine.sources(Asset("dashboard-js"), Asset("dashboard-js-spec-helpers"), Asset("dashboard-js-templates")) jasmine.specs(Asset("dashboard-js-specs"))
# Configure webassets for app from . import assets app.jinja_env.add_extension('webassets.ext.jinja2.assets') app.jinja_env.assets_environment = assets.environment # Configure Jinja2 extensions for app app.jinja_env.add_extension('jinja2.ext.autoescape') app.jinja_env.add_extension('jinja2.ext.with_') app.jinja_env.add_extension('hamlpy.ext.HamlPyExtension') # Initialize services import ggrc.services ggrc.services.init_all_services(app) # Initialize views import ggrc.views ggrc.views.init_all_object_views(app) # Initialize configured and default extensions from ggrc.fulltext import get_indexer ggrc.indexer = get_indexer() if settings.ENABLE_JASMINE: # Configure Flask-Jasmine, for dev mode unit testing from flask.ext.jasmine import Jasmine, Asset jasmine = Jasmine(app) jasmine.sources(Asset("dashboard-js"), Asset("dashboard-js-spec-helpers")) jasmine.specs(Asset("dashboard-js-specs"))
# Configure Jinja2 extensions for app app.jinja_env.add_extension('jinja2.ext.autoescape') app.jinja_env.autoescape = True app.jinja_env.add_extension('jinja2.ext.with_') app.jinja_env.add_extension('hamlpy.ext.HamlPyExtension') # Initialize services import ggrc.services ggrc.services.init_all_services(app) # Initialize views import ggrc.views ggrc.views.init_all_object_views(app) # Initialize configured and default extensions from ggrc.fulltext import get_indexer ggrc.indexer = get_indexer() if settings.ENABLE_JASMINE: # Configure Flask-Jasmine, for dev mode unit testing from flask.ext.jasmine import Jasmine, Asset jasmine = Jasmine(app) jasmine.sources( Asset("dashboard-js"), Asset("dashboard-js-spec-helpers")) jasmine.specs( Asset("dashboard-js-specs"))