mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 09:04:41 +04:00
Remove unused ruby activate script
This commit is contained in:
parent
5d767bbc49
commit
5e52a657df
2 changed files with 7 additions and 42 deletions
|
|
@ -79,29 +79,6 @@ def _install_rbenv(
|
||||||
_extract_resource('ruby-download.tar.gz', plugins_dir)
|
_extract_resource('ruby-download.tar.gz', plugins_dir)
|
||||||
_extract_resource('ruby-build.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(
|
def _install_ruby(
|
||||||
prefix: Prefix,
|
prefix: Prefix,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import os.path
|
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.prefix import Prefix
|
||||||
from pre_commit.util import cmd_output
|
from pre_commit.util import cmd_output
|
||||||
from testing.util import xfailif_windows_no_ruby
|
from testing.util import xfailif_windows_no_ruby
|
||||||
|
|
@ -10,31 +9,20 @@ from testing.util import xfailif_windows_no_ruby
|
||||||
@xfailif_windows_no_ruby
|
@xfailif_windows_no_ruby
|
||||||
def test_install_rbenv(tempdir_factory):
|
def test_install_rbenv(tempdir_factory):
|
||||||
prefix = Prefix(tempdir_factory.get())
|
prefix = Prefix(tempdir_factory.get())
|
||||||
_install_rbenv(prefix)
|
ruby._install_rbenv(prefix)
|
||||||
# Should have created rbenv directory
|
# Should have created rbenv directory
|
||||||
assert os.path.exists(prefix.path('rbenv-default'))
|
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
|
# Should be able to activate using our script and access rbenv
|
||||||
cmd_output(
|
with ruby.in_env(prefix, 'default'):
|
||||||
'bash', '-c',
|
cmd_output('rbenv', '--help')
|
||||||
'. {} && rbenv --help'.format(
|
|
||||||
shlex.quote(prefix.path('rbenv-default', 'bin', 'activate')),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@xfailif_windows_no_ruby
|
@xfailif_windows_no_ruby
|
||||||
def test_install_rbenv_with_version(tempdir_factory):
|
def test_install_rbenv_with_version(tempdir_factory):
|
||||||
prefix = Prefix(tempdir_factory.get())
|
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
|
# Should be able to activate and use rbenv install
|
||||||
cmd_output(
|
with ruby.in_env(prefix, '1.9.3p547'):
|
||||||
'bash', '-c',
|
cmd_output('rbenv', 'install', '--help')
|
||||||
'. {} && rbenv install --help'.format(
|
|
||||||
shlex.quote(prefix.path('rbenv-1.9.3p547', 'bin', 'activate')),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue