Sha256: ee196f8ab3fdd43facad8dea046aaee0fc3adf34e5db4930b4b50ccdbc21aaf4
Contents?: true
Size: 1.6 KB
Versions: 24
Compression:
Stored size: 1.6 KB
Contents
# Usage: # # Jets::Gems::Extract::Ruby.new("2.5.0", # downloads_root: cache_area, # defaults to /tmp/lambdagem # dest: cache_area, # defaults to . (project_root) # ).run # module Jets::Gems::Extract class Ruby < Base class NotFound < RuntimeError; end def run say "Looking for #{full_ruby_name}" clean_downloads(:rubies) if @options[:clean] tarball_path = download_ruby unpack_tarball(tarball_path) say("Ruby #{full_ruby_name} unpacked at #{project_root}", :debug) end def download_ruby url = ruby_url tarball_dest = download_file(url, download_path(File.basename(url))) unless tarball_dest message = "Url: #{url} not found" if @options[:exit_on_error] say message exit else raise NotFound.new(message) end end say "Tarball downloaded to: #{tarball_dest}" tarball_dest end def download_path(filename) "#{@downloads_root}/downloads/rubies/#{filename}" end # If only the ruby version is given, then append ruby- in front. Otherwise # leave alone. # # Example: # # 2.5.0 -> ruby-2.5.0-linux-x86_64.tgz # ruby-2.5.0 -> ruby-2.5.0-linux-x86_64.tgz # test-ruby-2.5.0 -> test-ruby-2.5.0-linux-x86_64.tgz def full_ruby_name md = @name.match(/^(\d+\.\d+\.\d+)$/) if md ruby_version = md[1] "ruby-#{ruby_version}-linux-x86_64.tgz" else "#{@name}-linux-x86_64.tgz" end end def ruby_url "#{source_url}/rubies/#{full_ruby_name}" end end end
Version data entries
24 entries across 24 versions & 1 rubygems