Class: Kompo::RubyBuildPath::Install
- Inherits:
-
Taski::Task
- Object
- Taski::Task
- Kompo::RubyBuildPath::Install
- Defined in:
- lib/kompo/tasks/ruby_build_path.rb
Overview
Install ruby-build via git clone and return the path
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/kompo/tasks/ruby_build_path.rb', line 28 def run puts 'ruby-build not found. Installing via git...' install_dir = File.('~/.ruby-build') if Dir.exist?(install_dir) system('git', '-C', install_dir, 'pull', '--quiet') else system('git', 'clone', 'https://github.com/rbenv/ruby-build.git', install_dir) end @path = File.join(install_dir, 'bin', 'ruby-build') raise 'Failed to install ruby-build' unless File.executable?(@path) puts "ruby-build installed at: #{@path}" version_output, = Open3.capture2(@path, '--version', err: File::NULL) puts "ruby-build version: #{version_output.chomp}" end |