mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 04:50:20 -06:00
Remove unused ruby activate script
This commit is contained in:
@@ -79,29 +79,6 @@ def _install_rbenv(
|
||||
_extract_resource('ruby-download.tar.gz', plugins_dir)
|
||||
_extract_resource('ruby-build.tar.gz', plugins_dir)
|
||||
|
||||
activate_path = prefix.path(directory, 'bin', 'activate')
|
||||
with open(activate_path, 'w') as activate_file:
|
||||
# This is similar to how you would install rbenv to your home directory
|
||||
# However we do a couple things to make the executables exposed and
|
||||
# configure it to work in our directory.
|
||||
# We also modify the PS1 variable for manual debugging sake.
|
||||
activate_file.write(
|
||||
'#!/usr/bin/env bash\n'
|
||||
"export RBENV_ROOT='{directory}'\n"
|
||||
'export PATH="$RBENV_ROOT/bin:$PATH"\n'
|
||||
'eval "$(rbenv init -)"\n'
|
||||
'export PS1="(rbenv)$PS1"\n'
|
||||
# This lets us install gems in an isolated and repeatable
|
||||
# directory
|
||||
"export GEM_HOME='{directory}/gems'\n"
|
||||
'export PATH="$GEM_HOME/bin:$PATH"\n'
|
||||
'\n'.format(directory=prefix.path(directory)),
|
||||
)
|
||||
|
||||
# If we aren't using the system ruby, add a version here
|
||||
if version != C.DEFAULT:
|
||||
activate_file.write(f'export RBENV_VERSION="{version}"\n')
|
||||
|
||||
|
||||
def _install_ruby(
|
||||
prefix: Prefix,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import os.path
|
||||
import shlex
|
||||
|
||||
from pre_commit.languages.ruby import _install_rbenv
|
||||
from pre_commit.languages import ruby
|
||||
from pre_commit.prefix import Prefix
|
||||
from pre_commit.util import cmd_output
|
||||
from testing.util import xfailif_windows_no_ruby
|
||||
@@ -10,31 +9,20 @@ from testing.util import xfailif_windows_no_ruby
|
||||
@xfailif_windows_no_ruby
|
||||
def test_install_rbenv(tempdir_factory):
|
||||
prefix = Prefix(tempdir_factory.get())
|
||||
_install_rbenv(prefix)
|
||||
ruby._install_rbenv(prefix)
|
||||
# Should have created rbenv directory
|
||||
assert os.path.exists(prefix.path('rbenv-default'))
|
||||
# We should have created our `activate` script
|
||||
activate_path = prefix.path('rbenv-default', 'bin', 'activate')
|
||||
assert os.path.exists(activate_path)
|
||||
|
||||
# Should be able to activate using our script and access rbenv
|
||||
cmd_output(
|
||||
'bash', '-c',
|
||||
'. {} && rbenv --help'.format(
|
||||
shlex.quote(prefix.path('rbenv-default', 'bin', 'activate')),
|
||||
),
|
||||
)
|
||||
with ruby.in_env(prefix, 'default'):
|
||||
cmd_output('rbenv', '--help')
|
||||
|
||||
|
||||
@xfailif_windows_no_ruby
|
||||
def test_install_rbenv_with_version(tempdir_factory):
|
||||
prefix = Prefix(tempdir_factory.get())
|
||||
_install_rbenv(prefix, version='1.9.3p547')
|
||||
ruby._install_rbenv(prefix, version='1.9.3p547')
|
||||
|
||||
# Should be able to activate and use rbenv install
|
||||
cmd_output(
|
||||
'bash', '-c',
|
||||
'. {} && rbenv install --help'.format(
|
||||
shlex.quote(prefix.path('rbenv-1.9.3p547', 'bin', 'activate')),
|
||||
),
|
||||
)
|
||||
with ruby.in_env(prefix, '1.9.3p547'):
|
||||
cmd_output('rbenv', 'install', '--help')
|
||||
|
||||
Reference in New Issue
Block a user