diff --git a/README.rst b/README.rst index 06273916..979d1a34 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,8 @@ The main commands are ```install``, ``uninstall``, and ``lock``, which generates Basic Concepts ////////////// -- When no parameters are passed to ``install``, a virtualenv will be created if it doesn't exist, and all packages specified will be installed. +- A virtualenv will automatically be created, when one doesn't exist. +- When no parameters are passed to ``install``, all packages specified will be installed. - When no parameters are passed to ``uninstall``, all packages will be uninstalled. Other Commands diff --git a/pipenv/cli.py b/pipenv/cli.py index 7b755d6d..42a3afa9 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -81,6 +81,18 @@ def do_install_dependencies(dev=False, only=False, bare=False): click.echo(crayons.blue(c.out)) +def do_create_virtualenv(): + """Creates a virtualenv.""" + click.echo(crayons.yellow('Creating a virtualenv for this project...')) + + # Actually create the virtualenv. + c = delegator.run(['virtualenv', project.virtualenv_location, '--prompt=({})'.format(project.name)], block=False) + click.echo(crayons.blue(c.out)) + + # Say where the virtualenv is. + do_where(virtualenv=True, bare=False) + + def do_lock(): """Executes the freeze functionality.""" @@ -181,14 +193,7 @@ def do_init(dev=False, skip_virtualenv=False): do_where(bare=False) if not project.virtualenv_exists: - click.echo(crayons.yellow('Creating a virtualenv for this project...')) - - # Actually create the virtualenv. - c = delegator.run(['virtualenv', project.virtualenv_location, '--prompt=({})'.format(project.name)], block=False) - click.echo(crayons.blue(c.out)) - - # Say where the virtualenv is. - do_where(virtualenv=True, bare=False) + do_create_virtualenv() # Write out the lockfile if it doesn't exist. if project.lockfile_exists: @@ -256,6 +261,9 @@ def where(venv=False, bare=False): @click.option('--dev','-d', is_flag=True, default=False) def install(package_name=False, dev=False): + if not project.virtualenv_exists: + do_create_virtualenv() + # Install all dependencies, if none was provided. if package_name is False: click.echo(crayons.yellow('No package provided, installing all dependencies.'))