Skip to content

Commit

Permalink
Version handling improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiborsimon committed Jul 7, 2016
1 parent 8f9d34b commit 15412e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ There is a strict order where you can place each features. Between each feature
_mandatory_

```
v1.0.1
v1.0.2
...
```

This feature will define the earliest version that is compatible with the used __Projectfile__ format. All __projects__ versions greater or equal to the defined one will be compatible with the format, but earlier versions may have problems with future features. The first release version is v1.0.1.
This feature will define the earliest version that is compatible with the used __Projectfile__ format. All __projects__ versions greater or equal to the defined one will be compatible with the format, but earlier versions may have problems with future features. The first release version is v1.0.2.

If there are more __Projectfiles__ in your project and the defined versions are different, the smallest version will be used to maximize the functionality.

Expand Down Expand Up @@ -303,7 +303,7 @@ The command body defines what commands __projects__ needs to execute if you invo
The following __Projectfile__ can be generated with the `p (-i|--init)` command:

```
from v1.0.1
from v1.0.2
"""
This is a template Projectfile you have created with the 'p (-i|--init])' command.
Expand Down Expand Up @@ -399,7 +399,7 @@ If you have multiple __Projectfiles__ in your project and there are command head
```
╔═══════════════════════════════════╦═══════════════════════════════════╗
║ $ cat ./Projectfile ║ $ cat ./dir/Projectfile ║
║ from v1.0.1 ║ from v1.0.1
║ from v1.0.2 ║ from v1.0.2
║ my_command: ║ my_command: ║
║ echo "This is the root." ║ echo "This is a subdir." ║
╠═══════════════════════════════════╩═══════════════════════════════════╣
Expand Down Expand Up @@ -444,14 +444,14 @@ The following example will demonstrate this behavior:
```
╔═══════════════════════════════════╦═══════════════════════════════════╗
║ $ cat ./Projectfile ║ $ cat ./A/Projectfile ║
║ from v1.0.1 ║ from v1.0.1
║ from v1.0.2 ║ from v1.0.2
║ my_command: ║ my_command: ║
║ echo "pre root" ║ echo "pre A" ║
║ === ║ === ║
║ echo "post root" ║ echo "post A" ║
╠═══════════════════════════════════╬═══════════════════════════════════╣
║ $ cat ./A/B/Projectfile ║ $ cat ./C/Projectfile ║
║ from v1.0.1 ║ from v1.0.1
║ from v1.0.2 ║ from v1.0.2
║ my_command: ║ my_command: ║
║ echo "listing inside A/B" ║ echo "pre C" ║
║ ls -1 ║ === ║
Expand Down
10 changes: 5 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import pydoc
from projects import doc_generator

__version__ = (1, 0, 1)
__printable_version__ = '{}.{}.{}'.format(__version__[0], __version__[1], __version__[2])
from pkg_resources import get_distribution
__version__ = get_distribution('projects').version

help_text = '''\
===============================================================================
Expand Down Expand Up @@ -581,7 +581,7 @@
TIP: You can always create a template Projectfile with the "(-i|--init)"
command.
'''.format(version=__printable_version__)
'''.format(version=__version__)

return_path = ''

Expand Down Expand Up @@ -629,15 +629,15 @@ def main(args):
args = args[2:]
if len(args) == 1:
if args[0] in ['-v', '--version']:
print(__printable_version__)
print(__version__)
return

elif args[0] in ['-i', '--init']:
if paths.inside_project(conf['projects-path']):
if os.path.isfile('Projectfile'):
print('You already have a Projectfile in this directory.. Nothing to do ;)')
else:
projectfile_content = projectfile.DEFAULT_PROJECTFILE.format(__printable_version__)
projectfile_content = projectfile.DEFAULT_PROJECTFILE.format(__version__)
with open('Projectfile', 'w+') as f:
f.write(projectfile_content)
print('Projectfile created. Use the "p" command to invoke the manual.')
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from setuptools import find_packages, setup
from main import __printable_version__


setup(
name='projects',
version=__printable_version__,
version='1.0.2',
description='The intuitive project manager',
long_description=("projects is an easy to use project navigation tool "
"and a Makefile-like scripting engine. It's main purpose "
Expand Down

0 comments on commit 15412e4

Please sign in to comment.