From 2365ff532b79dc7d59a53e14eb05b8227b694b31 Mon Sep 17 00:00:00 2001 From: allfro Date: Tue, 19 Mar 2013 19:42:34 -0400 Subject: [PATCH] Added additional version and banner commands --- src/canari/commands/__init__.py | 4 ++- src/canari/commands/banner.py | 45 +++++++++++++++++++++++++++ src/canari/commands/common.py | 34 ++++++++++---------- src/canari/commands/create_package.py | 9 +++--- src/canari/commands/version.py | 36 +++++++++++++++++++++ 5 files changed, 106 insertions(+), 22 deletions(-) create mode 100644 src/canari/commands/banner.py create mode 100644 src/canari/commands/version.py diff --git a/src/canari/commands/__init__.py b/src/canari/commands/__init__.py index 19ea954..bc9b245 100644 --- a/src/canari/commands/__init__.py +++ b/src/canari/commands/__init__.py @@ -26,5 +26,7 @@ __all__ = [ 'rename_transform', 'list_commands', 'run_server', - 'generate_entities' + 'generate_entities', + 'version', + 'banner' ] \ No newline at end of file diff --git a/src/canari/commands/banner.py b/src/canari/commands/banner.py new file mode 100644 index 0000000..e24f1ba --- /dev/null +++ b/src/canari/commands/banner.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from common import get_commands, cmd_name +from argparse import ArgumentParser +from sys import modules + +import canari + + +__author__ = 'Nadeem Douba' +__copyright__ = 'Copyright 2012, Canari Project' +__credits__ = [] + +__license__ = 'GPL' +__version__ = '0.1' +__maintainer__ = 'Nadeem Douba' +__email__ = 'ndouba@gmail.com' +__status__ = 'Development' + + +parser = ArgumentParser( + description='Show banner of Canari framework that is currently active.', + usage='canari %s' % cmd_name(__name__) +) + + +def help(): + parser.print_help() + + +def description(): + return parser.description + + +def run(args): + print """ + Your running ... +_________ _____ _______ _______ +__ ____/_____ _____________ __________(_) ___ ___ __ \ __( __ ) +_ / _ __ `/_ __ \ __ `/_ ___/_ / __ | / / / / / _ __ | +/ /___ / /_/ /_ / / / /_/ /_ / _ / __ |/ // /_/ /__/ /_/ / +\____/ \__,_/ /_/ /_/\__,_/ /_/ /_/ _____/ \____/_(_)____/ + + ... http://canariproject.com + """ \ No newline at end of file diff --git a/src/canari/commands/common.py b/src/canari/commands/common.py index 8c213e2..0127041 100644 --- a/src/canari/commands/common.py +++ b/src/canari/commands/common.py @@ -1,21 +1,30 @@ #!/usr/bin/env python -import os -import subprocess -import sys -import unicodedata -from canari.utils.fs import fmutex - +from distutils.command.install import install from pkg_resources import resource_filename from distutils.dist import Distribution -from distutils.command.install import install from datetime import datetime from string import Template +import unicodedata +import subprocess +import threading +import sys +import os + from canari.config import CanariConfigParser -import threading +__author__ = 'Nadeem Douba' +__copyright__ = 'Copyright 2012, Canari Project' +__credits__ = [] + +__license__ = 'GPL' +__version__ = '0.3' +__maintainer__ = 'Nadeem Douba' +__email__ = 'ndouba@gmail.com' +__status__ = 'Development' + def synchronized(func): @@ -27,15 +36,6 @@ def synchronized(func): return synced_func -__author__ = 'Nadeem Douba' -__copyright__ = 'Copyright 2012, Canari Project' -__credits__ = [] - -__license__ = 'GPL' -__version__ = '0.2' -__maintainer__ = 'Nadeem Douba' -__email__ = 'ndouba@gmail.com' -__status__ = 'Development' def fix_etree(): try: diff --git a/src/canari/commands/create_package.py b/src/canari/commands/create_package.py index 2bcb2ed..d9e054c 100644 --- a/src/canari/commands/create_package.py +++ b/src/canari/commands/create_package.py @@ -1,19 +1,20 @@ #!/usr/bin/env python -from common import read_template, write_template, generate_all, build_skeleton, cmd_name, parse_bool - from argparse import ArgumentParser from datetime import datetime from getpass import getuser from os import path +from common import read_template, write_template, generate_all, build_skeleton, cmd_name, parse_bool +import canari + __author__ = 'Nadeem Douba' __copyright__ = 'Copyright 2012, Canari Project' __credits__ = [] __license__ = 'GPL' -__version__ = '0.5' +__version__ = '0.6' __maintainer__ = 'Nadeem Douba' __email__ = 'ndouba@gmail.com' __status__ = 'Development' @@ -150,7 +151,7 @@ def run(args): 'maintainer' : getuser(), 'example' : True, 'description' : '', - 'canari_version' : __version__ + 'canari_version' : canari.__version__ } ask_user(values) diff --git a/src/canari/commands/version.py b/src/canari/commands/version.py new file mode 100644 index 0000000..d50e258 --- /dev/null +++ b/src/canari/commands/version.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +from common import get_commands, cmd_name +from argparse import ArgumentParser +from sys import modules + +import canari + + +__author__ = 'Nadeem Douba' +__copyright__ = 'Copyright 2012, Canari Project' +__credits__ = [] + +__license__ = 'GPL' +__version__ = '0.1' +__maintainer__ = 'Nadeem Douba' +__email__ = 'ndouba@gmail.com' +__status__ = 'Development' + + +parser = ArgumentParser( + description='Show version of Canari framework that is currently active.', + usage='canari %s' % cmd_name(__name__) +) + + +def help(): + parser.print_help() + + +def description(): + return parser.description + + +def run(args): + print 'Your running *Canari Framework v%s*' % canari.__version__ \ No newline at end of file -- 2.45.1