<commit_before>#!/usr/bin/env ruby

# coding: utf-8

require 'net/http'
require 'rexml/document'

def download(url, fn)
  puts 'Downloading: ' + url
  uri = URI.parse(url)

  Net::HTTP.start(uri.host, uri.port,
                  use_ssl: uri.scheme == 'https') do |http|
    request = Net::HTTP::Get.new uri

    http.request request do |response|
      open fn, 'wb' do |io|
        i = 9
        response.read_body do |chunk|
          print '.' if (i += 1) % 10 == 0
          io.write chunk
        end
      end
    end
  end
  puts
end

# ****************** download rsyntaxtextarea ***********************
RSYNTAX_SRC = 'https://repo1.maven.org/maven2/com/fifesoft/rsyntaxtextarea/'
MVN_DESCR = 'maven-metadata.xml'

download(RSYNTAX_SRC + MVN_DESCR, MVN_DESCR)
data = (REXML::Document.new File.read(MVN_DESCR)).root
version = data.elements['//versioning/latest'].first.to_s
File.delete MVN_DESCR

download(RSYNTAX_SRC + version + '/' + "rsyntaxtextarea-#{version}.jar",
         'rsyntaxtextarea.jar')

VERSION = '9.0.0.0'
JRUBY_SRC = 'https://s3.amazonaws.com/jruby.org/downloads/' \
            "#{VERSION}/jruby-bin-#{VERSION}.zip"
jruby_zip = 'jruby.zip'

# File.write(jruby_zip, Net::HTTP.get(URI.parse(JRUBY_SRC)))

# ****************** download jruby ***********************
download JRUBY_SRC, jruby_zip
`unzip -j #{jruby_zip} jruby-9.0.0.0/lib/jruby.jar`
File.delete jruby_zip<commit_msg>fixed classpath for standard ruby libs. jruby 9000 specific<commit_after>#!/usr/bin/env ruby

# coding: utf-8

require 'net/http'
require 'rexml/document'

def download(url, fn)
  puts 'Downloading: ' + url
  uri = URI.parse(url)

  Net::HTTP.start(uri.host, uri.port,
                  use_ssl: uri.scheme == 'https') do |http|
    request = Net::HTTP::Get.new uri

    http.request request do |response|
      open fn, 'wb' do |io|
        i = 9
        response.read_body do |chunk|
          print '.' if (i += 1) % 10 == 0
          io.write chunk
        end
      end
    end
  end
  puts
end

# ****************** download rsyntaxtextarea ***********************
RSYNTAX_SRC = 'https://repo1.maven.org/maven2/com/fifesoft/rsyntaxtextarea/'
MVN_DESCR = 'maven-metadata.xml'

download(RSYNTAX_SRC + MVN_DESCR, MVN_DESCR)
data = (REXML::Document.new File.read(MVN_DESCR)).root
version = data.elements['//versioning/latest'].first.to_s
File.delete MVN_DESCR

download(RSYNTAX_SRC + version + '/' + "rsyntaxtextarea-#{version}.jar",
         'rsyntaxtextarea.jar')

VERSION = '9.0.0.0'
JRUBY_SRC = 'https://s3.amazonaws.com/jruby.org/downloads/' \
            "#{VERSION}/jruby-bin-#{VERSION}.zip"
jruby_zip = 'jruby.zip'

# File.write(jruby_zip, Net::HTTP.get(URI.parse(JRUBY_SRC)))

# ****************** download jruby ***********************
download JRUBY_SRC, jruby_zip

jruby_lib = "jruby-#{VERSION}/lib/"
#`unzip -j #{jruby_zip} #{jruby_lib}/jruby.jar`
`unzip #{jruby_zip}`
%w(ruby jruby.jar).each { |file| `mv -v #{jruby_lib + file} ./` }

File.delete jruby_zip
`rm -r jruby-#{VERSION}`
{'fraction_non_alphanumeric': 0.2021985343104597, 'fraction_numerical': 0.011325782811459028, 'mean_word_length': 3.416176470588235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7455703', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1123, 'n_words': 209}