Print message when installing repositories.

This commit is contained in:
Anthony Sottile 2014-04-03 23:31:45 -07:00
parent 36ecf23c2e
commit 74363e6ec2
9 changed files with 78 additions and 29 deletions

View file

@ -5,13 +5,13 @@ from pre_commit.languages import helpers
from pre_commit.util import clean_path_on_failure
RVM_ENV = 'rvm_env'
ENVIRONMENT_DIR = 'rvm_env'
class RubyEnv(helpers.Environment):
@property
def env_prefix(self):
return '. {{prefix}}{0}/bin/activate &&'.format(RVM_ENV)
return '. {{prefix}}{0}/bin/activate &&'.format(ENVIRONMENT_DIR)
@contextlib.contextmanager
@ -21,11 +21,11 @@ def in_env(repo_cmd_runner):
def install_environment(repo_cmd_runner):
# Return immediately if we already have a virtualenv
if repo_cmd_runner.exists(RVM_ENV):
if repo_cmd_runner.exists(ENVIRONMENT_DIR):
return
with clean_path_on_failure(repo_cmd_runner.path(RVM_ENV)):
repo_cmd_runner.run(['__rvm-env.sh', '{{prefix}}{0}'.format(RVM_ENV)])
with clean_path_on_failure(repo_cmd_runner.path(ENVIRONMENT_DIR)):
repo_cmd_runner.run(['__rvm-env.sh', '{{prefix}}{0}'.format(ENVIRONMENT_DIR)])
with in_env(repo_cmd_runner) as env:
env.run('cd {prefix} && bundle install')