Associate version to entry files (#1060)

* Associate version to entry files

* Modified path joins for configs

* Made changes based on comments
This commit is contained in:
vera-liu 2016-09-15 17:20:18 -07:00 committed by GitHub
parent 2132f6715e
commit 2432c3155a
15 changed files with 54 additions and 28 deletions

View File

@ -14,9 +14,6 @@ from flask_appbuilder.baseviews import expose
from flask_cache import Cache
from flask_migrate import Migrate
from caravel import version
VERSION = version.VERSION_STRING
APP_DIR = os.path.dirname(__file__)
CONFIG_MODULE = os.environ.get('CARAVEL_CONFIG', 'caravel.config')

View File

@ -1,6 +1,6 @@
{
"name": "caravel",
"version": "0.1.0",
"version": "0.10.0",
"description": "Caravel is a data exploration platform designed to be visual, intuitive, and interactive.",
"directories": {
"doc": "docs",

View File

@ -1,5 +1,6 @@
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
// input dir
const APP_DIR = path.resolve(__dirname, './');
@ -7,6 +8,8 @@ const APP_DIR = path.resolve(__dirname, './');
// output dir
const BUILD_DIR = path.resolve(__dirname, './dist');
const VERSION_STRING = JSON.parse(fs.readFileSync('package.json')).version;
const config = {
entry: {
'css-theme': APP_DIR + '/javascripts/css-theme.js',
@ -19,7 +22,7 @@ const config = {
},
output: {
path: BUILD_DIR,
filename: '[name].entry.js',
filename: `[name].${VERSION_STRING}.entry.js`,
},
resolve: {
extensions: [

View File

@ -73,7 +73,7 @@ def version(verbose):
"-----------------------\n"
"Caravel {version}\n"
"-----------------------").format(
boat=ascii_art.boat, version=caravel.VERSION)
boat=ascii_art.boat, version=config.get('VERSION_STRING'))
print(s)
if verbose:
print("[DB] : " + "{}".format(db.engine))

View File

@ -8,7 +8,9 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caravel import app
import json
import os
from dateutil import tz
@ -22,6 +24,11 @@ if not os.path.exists(DATA_DIR):
# ---------------------------------------------------------
# Caravel specific config
# ---------------------------------------------------------
PACKAGE_DIR = os.path.join(BASE_DIR, 'static', 'assets')
PACKAGE_FILE = os.path.join(PACKAGE_DIR, 'package.json')
with open(PACKAGE_FILE) as package_file:
VERSION_STRING = json.load(package_file)['version']
ROW_LIMIT = 50000
CARAVEL_WORKERS = 16

View File

@ -8,10 +8,14 @@
{% block head_js %}
{{super()}}
<script src="/static/assets/dist/css-theme.entry.js"></script>
{% with filename="css-theme" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% endblock %}
{% block tail_js %}
{{super()}}
<script src="/static/assets/dist/common.entry.js"></script>
{{super()}}
{% with filename="common" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% endblock %}

View File

@ -13,7 +13,9 @@
<link rel="icon" type="image/png" href="/static/assets/images/favicon.png">
{% endblock %}
{% block head_js %}
<script src="/static/assets/dist/css-theme.entry.js"></script>
{% with filename="css-theme" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% endblock %}
</head>

View File

@ -2,7 +2,9 @@
{% block head_js %}
{{ super() }}
<script src="/static/assets/dist/dashboard.entry.js"></script>
{% with filename="dashboard" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% endblock %}
{% block title %}[dashboard] {{ dashboard.dashboard_title }}{% endblock %}
{% block body %}

View File

@ -335,5 +335,7 @@
{% block tail_js %}
{{ super() }}
<script src="/static/assets/dist/explore.entry.js"></script>
{% with filename="explore" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,4 @@
{% set VERSION_STRING = appbuilder.get_app.config.get("VERSION_STRING") %}
{% block tail_js %}
<script src="/static/assets/dist/{{filename}}.{{VERSION_STRING}}.entry.js"></script>
{% endblock %}

View File

@ -2,5 +2,7 @@
{% block tail_js %}
{{ super() }}
<script src="/static/assets/dist/sqllab.entry.js"></script>
{% with filename="sqllab" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% endblock %}

View File

@ -23,7 +23,11 @@
<div id="{{ viz.token }}_con" class="slice_container" style="height: 100%; width: 100%"></div>
</div>
</body>
<script src="/static/assets/dist/css-theme.entry.js"></script>
<script src="/static/assets/dist/standalone.entry.js"></script>
{% with filename="css-theme" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% with filename="standalone" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
</html>

View File

@ -1,8 +1,10 @@
{% extends "caravel/basic.html" %}
{% block head_js %}
{{ super() }}
<script src="/static/assets/dist/welcome.entry.js"></script>
{{ super() }}
{% with filename="welcome" %}
{% include "caravel/partials/_script_tag.html" %}
{% endwith %}
{% endblock %}
{% block title %}{{ _("Welcome!") }}{% endblock %}

View File

@ -1,7 +0,0 @@
VERSION_MAJOR = 0
VERSION_MINOR = 10
VERSION_BUILD = 0
VERSION_INFO = (VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD)
VERSION_STRING = "%d.%d.%d" % VERSION_INFO
__version__ = VERSION_INFO

View File

@ -1,16 +1,20 @@
import imp
import os
import json
from setuptools import setup, find_packages
version = imp.load_source(
'version', os.path.join('caravel', 'version.py'))
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
PACKAGE_DIR = os.path.join(BASE_DIR, 'caravel', 'static', 'assets')
PACKAGE_FILE = os.path.join(PACKAGE_DIR, 'package.json')
with open(PACKAGE_FILE) as package_file:
version_string = json.load(package_file)['version']
setup(
name='caravel',
description=(
"A interactive data visualization platform build on SqlAlchemy "
"and druid.io"),
version=version.VERSION_STRING,
version=version_string,
packages=find_packages(),
include_package_data=True,
zip_safe=False,
@ -55,7 +59,7 @@ setup(
author_email='maximebeauchemin@gmail.com',
url='https://github.com/airbnb/caravel',
download_url=(
'https://github.com/airbnb/caravel/tarball/' + version.VERSION_STRING),
'https://github.com/airbnb/caravel/tarball/' + version_string),
classifiers=[
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',