158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/kompo/tasks/install_ruby.rb', line 158
def run
ruby_build = RubyBuildPath.path
@ruby_version = Taski.args.fetch(:ruby_version, RUBY_VERSION)
@ruby_major_minor = ruby_major_and_minor(@ruby_version)
@kompo_cache = Taski.args.fetch(:kompo_cache, File.expand_path("~/.kompo/cache"))
@version_cache_dir = File.join(@kompo_cache, @ruby_version)
cache_metadata_path = File.join(@version_cache_dir, "metadata.json")
if cache_valid?(cache_metadata_path)
restore_from_cache(cache_metadata_path)
else
build_and_cache(ruby_build)
end
puts "Ruby installed at: #{@ruby_install_dir}"
version_output, = Open3.capture2(@ruby_path, "--version", err: File::NULL)
puts "Ruby version: #{version_output.chomp}"
end
|