Skip to content

Commit bee56cd

Browse files
committed
Use our archives instead of pulling from gits.
1 parent 8fee06b commit bee56cd

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

pre_commit/languages/ruby.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from pre_commit.languages import helpers
77
from pre_commit.prefixed_command_runner import CalledProcessError
88
from pre_commit.util import clean_path_on_failure
9+
from pre_commit.util import resource_filename
10+
from pre_commit.util import tarfile_open
911

1012

1113
ENVIRONMENT_DIR = 'rbenv'
@@ -23,22 +25,18 @@ def in_env(repo_cmd_runner):
2325

2426

2527
def _install_rbenv(repo_cmd_runner, version='default'):
26-
repo_cmd_runner.run([
27-
'git', 'clone', 'git://github.com/sstephenson/rbenv', '{prefix}rbenv',
28-
])
28+
with tarfile_open(resource_filename('rbenv.tar.gz')) as tf:
29+
tf.extractall(repo_cmd_runner.path('.'))
2930

3031
# Only install ruby-build if the version is specified
3132
if version != 'default':
3233
# ruby-download
33-
repo_cmd_runner.run([
34-
'git', 'clone', 'git://github.com/garnieretienne/rvm-download',
35-
'{prefix}rbenv/plugins/ruby-download',
36-
])
34+
with tarfile_open(resource_filename('ruby-download.tar.gz')) as tf:
35+
tf.extractall(repo_cmd_runner.path('rbenv', 'plugins'))
36+
3737
# ruby-build
38-
repo_cmd_runner.run([
39-
'git', 'clone', 'git://github.com/sstephenson/ruby-build',
40-
'{prefix}rbenv/plugins/ruby-build',
41-
])
38+
with tarfile_open(resource_filename('ruby-build.tar.gz')) as tf:
39+
tf.extractall(repo_cmd_runner.path('rbenv', 'plugins'))
4240

4341
activate_path = repo_cmd_runner.path('rbenv', 'bin', 'activate')
4442
with io.open(activate_path, 'w') as activate_file:

tests/languages/ruby_test.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33
import os.path
44

55
from pre_commit.languages.ruby import _install_rbenv
6-
from testing.util import skipif_slowtests_false
76

87

9-
@skipif_slowtests_false
108
def test_install_rbenv(cmd_runner):
119
_install_rbenv(cmd_runner)
1210
# Should have created rbenv directory
1311
assert os.path.exists(cmd_runner.path('rbenv'))
14-
# It should be a git checkout
15-
assert os.path.exists(cmd_runner.path('rbenv', '.git'))
1612
# We should have created our `activate` script
1713
activate_path = cmd_runner.path('rbenv', 'bin', 'activate')
1814
assert os.path.exists(activate_path)
@@ -27,7 +23,6 @@ def test_install_rbenv(cmd_runner):
2723
)
2824

2925

30-
@skipif_slowtests_false
3126
def test_install_rbenv_with_version(cmd_runner):
3227
_install_rbenv(cmd_runner, version='1.9.3p547')
3328

0 commit comments

Comments
 (0)