Skip to content

Commit

Permalink
Adding version subcommand to CLI (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Apr 14, 2016
1 parent 21b3a5f commit 0a94b36
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 2 additions & 0 deletions caravel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from flask.ext.cache import Cache
from flask.ext.migrate import Migrate

VERSION = '0.8.6'

APP_DIR = os.path.dirname(__file__)
CONFIG_MODULE = os.environ.get('CARAVEL_CONFIG', 'caravel.config')

Expand Down
9 changes: 9 additions & 0 deletions caravel/ascii_art.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,12 @@
=======================================================================================================
-------------------------------------------------------------------------------------------------------
"""

boat = """\
+ +
)`.).
)``)``) .~~
).-'.-')|)
|-).-).-'_'-/
~~~\ `o-o-o' /~~~~
~~~'---.____/~~~"""
16 changes: 13 additions & 3 deletions caravel/bin/caravel
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ from __future__ import unicode_literals
import logging
from datetime import datetime
from subprocess import Popen
import textwrap

from flask.ext.migrate import MigrateCommand
from flask.ext.script import Manager

import caravel
from caravel import app
from caravel import data, utils
from caravel import db
from caravel import app, ascii_art, db, data, utils

config = app.config

Expand Down Expand Up @@ -57,6 +56,17 @@ def init():
"""Inits the Caravel application"""
utils.init(caravel)

@manager.command
def version():
"""Prints the current version number"""
s = (
"\n{boat}\n\n"
"-----------------------\n"
"Caravel {version}\n"
"-----------------------\n").format(
boat=ascii_art.boat, version=caravel.VERSION)
print(s)

@manager.option(
'-s', '--sample', action='store_true',
help="Only load 1000 rows (faster, used for testing)")
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from setuptools import setup, find_packages

version = '0.8.6'
VERSION = '0.8.6'


setup(
name='caravel',
description=(
"A interactive data visualization platform build on SqlAlchemy "
"and druid.io"),
version=version,
version=VERSION,
packages=find_packages(),
include_package_data=True,
zip_safe=False,
Expand Down Expand Up @@ -40,5 +41,5 @@
author_email='maximebeauchemin@gmail.com',
url='https://github.com/airbnb/caravel',
download_url=(
'https://github.com/airbnb/caravel/tarball/' + version),
'https://github.com/airbnb/caravel/tarball/' + VERSION),
)

0 comments on commit 0a94b36

Please sign in to comment.