Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
Only creat one virtual enviroment for run, priority to -e parameter o…
Browse files Browse the repository at this point in the history
…ver -v
  • Loading branch information
constrict0r committed Nov 25, 2018
1 parent 4cc3ae2 commit 921ddb9
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 28 deletions.
2 changes: 1 addition & 1 deletion amanita/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"""amanita - Create custom python projects"""

__title__ = 'amanita'
__version__ = '0.0.1'
__version__ = '0.1.0'
__author__ = 'constrict0r <constrict0r@protonmail.com>'
__all__ = []
13 changes: 9 additions & 4 deletions amanita/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ def create(path, direnv=False, venv=False, venv_path=None,
'project.', fg='red'))
sys.exit(1)

# Create virtual enviroment inside.
if venv is True:
amanita.project.Project.venv_setup(path)

# Create virtual enviroment outside.
if venv_path is not None:
amanita.project.Project.venv_setup(venv_path)

# Create virtual enviroment inside.
elif venv is True:
amanita.project.Project.venv_setup(path)

# Create direnv configuration.
if direnv and venv is True:
click.echo(click.style('Running direnv-setup.sh ...',
fg='green'))

return True

# Create virtual enviroment.
Expand Down
Binary file removed docs/uml/amanita-main.png
Binary file not shown.
10 changes: 0 additions & 10 deletions docs/uml/amanita-main.txt

This file was deleted.

Binary file added docs/uml/direnv.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/uml/direnv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@startuml
start

if (direnv installed by apt?) then (yes)
else (no)
:Install direnv by apt;
endif

end
@enduml
Binary file removed docs/uml/get-parameters.png
Binary file not shown.
10 changes: 0 additions & 10 deletions docs/uml/get-parameters.txt

This file was deleted.

Binary file added docs/uml/main.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions docs/uml/main.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@startuml
start
:Get arguments;

if (venv only?) then (yes)
:Create venv on PATH;
else (no)
:Create project on PATH;
endif

stop
@enduml
Binary file added docs/uml/project.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/uml/project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@startuml
start
:Create layout;

if (venv-path not empty) then (yes)
:Create venv on given path;
else (no)
if (venv?) then (yes)
:Create venv inside project;
:Set venv path = .venv;
else (no)
endif
endif

if (OS = linux and venv_path not empty?) then (yes)
:Handle direnv configuration;
endif
end
@enduml
6 changes: 3 additions & 3 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ def test_create_project_venv_out_forbidden():
shell=True)


# Create project with virtual enviroment inside and
# outside the project directory.
# Create project with virtual enviroment outside the project
# even when inside and outside locations are specified.
def test_create_project_venv_in_out():

shutil.rmtree(os.path.join('muscaria'))
subprocess.check_call('amanita muscaria -v -e venv',
env=os.environ.copy(),
shell=True)
assert os.path.isdir('muscaria/.venv')
assert not os.path.isdir('muscaria/.venv')
assert os.path.isdir('venv')
shutil.rmtree(os.path.join('muscaria'))
shutil.rmtree(os.path.join('venv'))

0 comments on commit 921ddb9

Please sign in to comment.