Permalink
Browse files

add version command

  • Loading branch information...
1 parent 46124b7 commit 73856a09c58f4603869c1f500b6dc0de602856ab @piranha committed Dec 9, 2013
Showing with 17 additions and 2 deletions.
  1. +10 −0 nomad/__init__.py
  2. +7 −2 setup.py
View
10 nomad/__init__.py
@@ -10,6 +10,9 @@
from nomad.utils import abort, NomadError, NomadIniNotFound
+__version__ = '1.5'
+
+
GLOBAL = [
('c', 'config', 'nomad.ini', 'path to config file'),
('D', 'define', {}, 'override config values'),
@@ -141,5 +144,12 @@ def info(**opts):
print ' Uninitialized repository'
+@app.command()
+def version():
+ '''Show app version
+ '''
+ print 'Nomad v%s' % __version__
+
+
if __name__ == '__main__':
app.dispatch()
View
9 setup.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import sys, os
+import sys, os, re
from setuptools import setup, find_packages
PY3 = sys.version_info[0] >= 3
@@ -19,13 +19,18 @@
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
+def find_version():
+ val, = re.findall(r"__version__ = '([^']+)'",
+ read('nomad/__init__.py'))
+ return val
+
config = dict(
name = 'nomad',
description = 'simple sql migration tool to save you from becoming mad',
long_description = read('README.rst'),
license = 'BSD',
- version = '1.4',
+ version = find_version(),
author = 'Alexander Solovyov',
author_email = 'alexander@solovyov.net',
url = 'http://github.com/piranha/nomad/',

0 comments on commit 73856a0

Please sign in to comment.