<commit_before>require "open-uri"

rvmrc = File.open('.rvmrc').gets
installed = /(\d+)/.match(rvmrc)[1].to_i

version = `curl -s https://github.com/MagLev/maglev/raw/master/version.txt | head -n 1`.chomp.strip

latest = /([\d]+?)-\d+\)$/.match(version)[1].to_i

if (latest > installed)
  puts "*" * 75
  puts "There's a later version: #{latest}."
  puts "Would you like to automatically upgrade? [Y|n]"
  upgrade = gets.chomp
  cmds = []
  cmds << "maglev stop"
  cmds << "rvm upgrade maglev-#{latest} maglev-#{installed}"
  cmds << "sed -i 's/#{installed}/#{latest}/' .rvmrc"
  cmds << "gem install --no-rdoc --no-ri rake bundler"
  cmds << "bundle"
  run = cmds.join(" && ")
  if ['', 'Y'].include?(upgrade)
    system run
  else
    puts "You can manually run this later:"
    puts run<commit_msg>Change to tilde instead of system<commit_after>require "open-uri"

rvmrc = File.open('.rvmrc').gets
installed = /(\d+)/.match(rvmrc)[1].to_i

version = `curl -s https://github.com/MagLev/maglev/raw/master/version.txt | head -n 1`.chomp.strip

latest = /([\d]+?)-\d+\)$/.match(version)[1].to_i

if (latest > installed)
  puts "*" * 75
  puts "There's a later version: #{latest}."
  puts "Would you like to automatically upgrade? [Y|n]"
  upgrade = gets.chomp
  cmds = []
  cmds << "maglev stop"
  cmds << "rvm upgrade maglev-#{latest} maglev-#{installed}"
  cmds << "sed -i 's/#{installed}/#{latest}/' .rvmrc"
  cmds << "gem install --no-rdoc --no-ri rake bundler"
  cmds << "bundle"
  run = cmds.join(" && ")
  if ['', 'Y'].include?(upgrade)
    `#{run}`
  else
    puts "You can manually run this later:"
    puts run
{'fraction_non_alphanumeric': 0.20333745364647712, 'fraction_numerical': 0.006180469715698393, 'mean_word_length': 3.3638814016172507, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1306285', 'n_tokens_mistral': 629, 'n_tokens_neox': 630, 'n_words': 153}