Skip to content

Commit

Permalink
Empty project bug solved. Closes #6.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiborsimon committed Jul 9, 2016
1 parent f514e76 commit e109c7f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 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.6
v1.0.7
...
```

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.6.
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.7.

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.6
from v1.0.7
"""
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.6 ║ from v1.0.6
║ from v1.0.7 ║ from v1.0.7
║ 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.6 ║ from v1.0.6
║ from v1.0.7 ║ from v1.0.7
║ 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.6 ║ from v1.0.6
║ from v1.0.7 ║ from v1.0.7
║ my_command: ║ my_command: ║
║ echo "listing inside A/B" ║ echo "pre C" ║
║ ls -1 ║ === ║
Expand Down
29 changes: 15 additions & 14 deletions projects/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,21 @@ def execute(args, data, conf):
def main(args):
try:
conf = config.get()

if not os.path.isdir(conf['projects-path']):
os.mkdir(conf['projects-path'])
print("Projects root was created: {}".format(conf['projects-path']))
print("You can put your projects here.")
with open(os.path.join(os.path.expanduser('~'), '.p-path'), 'w+') as f:
f.write(conf['projects-path'])
return
else:
if not os.listdir(conf['projects-path']):
print("Your projects directory is empty. Nothing to do..")
with open(os.path.join(os.path.expanduser('~'), '.p-path'), 'w+') as f:
f.write(conf['projects-path'])
return

args = args[2:]
if len(args) == 1:
if args[0] in ['-v', '--version']:
Expand Down Expand Up @@ -701,20 +716,6 @@ def main(args):
print("A markdown file named \"{}\" was generated into your project's root.".format(name))
return

if not os.path.isdir(conf['projects-path']):
os.mkdir(conf['projects-path'])
print("Projects root was created: {}".format(conf['projects-path']))
print("You can put your projects here.")
with open(os.path.join(os.path.expanduser('~'), '.p-path'), 'w+') as f:
f.write(conf['projects-path'])
return
else:
if not os.listdir(conf['projects-path']):
print("Your projects directory is empty. Nothing to do..")
with open(os.path.join(os.path.expanduser('~'), '.p-path'), 'w+') as f:
f.write(conf['projects-path'])
return

if paths.inside_project(conf['projects-path']):
handle_inside_project(args, conf)
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='projects',
version='1.0.6',
version='1.0.7',
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 e109c7f

Please sign in to comment.