<commit_before>#/usr/bin/env bash

ROOTDIR=$(dirname "$0")
read -p "Enter Your GitHub Token: " TOKEN
echo

write_version() {
  read file version
  echo $version > $ROOTDIR/shared/definitions/$file
}

getLatest() {
  curl -H "Authorization: token $TOKEN" --silent "https://api.github.com/repos/$1/releases/latest" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["name"].delete_prefix("v")'
}

getLatestTag() {
  PAGES=$(curl -H "Authorization: token $TOKEN" -I --silent "https://api.github.com/repos/$1/tags" | fgrep 'Link:' | awk -F, '{print $2}' | sed -Ee 's/.*<(.*)>.*/\1/g' | awk -F= '{print $2}')
  for PAGE in $(seq 1 ${PAGES:-1}); do curl -H "Authorization: token $TOKEN" --silent "https://api.github.com/repos/$1/tags?page=$PAGE"; done | ruby -rjson -e 'puts JSON.parse(STDIN.read.gsub(/\][\n]*\[/,",")).map{|e|e["name"]}.reject{|e|["rc","gitgui","fips","levitte","-engine-","beta","ssleay","master","before","after","pre","post","rsaref"].any?{|s|e.downcase.include?(s)}}.map{|s|s.delete_prefix("v").delete_prefix("OpenSSL_").gsub("_",".")}.sort_by{|a,b| a.split(".").map{|s|s.to_i(36)} }.reject{|s|s.start_with?("1.1.")}.last'
}

echo starting ccache…
getLatest ccache/ccache > $ROOTDIR/shared/definitions/ccache_version
echo starting curl…
getLatest curl/curl     > $ROOTDIR/shared/definitions/curl_version
echo starting geoip…<commit_msg>add another string to reject versions with in update script<commit_after>#/usr/bin/env bash

ROOTDIR=$(dirname "$0")
read -p "Enter Your GitHub Token: " TOKEN
echo

write_version() {
  read file version
  echo $version > $ROOTDIR/shared/definitions/$file
}

getLatest() {
  curl -H "Authorization: token $TOKEN" --silent "https://api.github.com/repos/$1/releases/latest" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["name"].delete_prefix("v")'
}

getLatestTag() {
  PAGES=$(curl -H "Authorization: token $TOKEN" -I --silent "https://api.github.com/repos/$1/tags" | fgrep 'Link:' | awk -F, '{print $2}' | sed -Ee 's/.*<(.*)>.*/\1/g' | awk -F= '{print $2}')
  for PAGE in $(seq 1 ${PAGES:-1}); do curl -H "Authorization: token $TOKEN" --silent "https://api.github.com/repos/$1/tags?page=$PAGE"; done | ruby -rjson -e 'puts JSON.parse(STDIN.read.gsub(/\][\n]*\[/,",")).map{|e|e["name"]}.reject{|e|["rc","gitgui","fips","levitte","-engine-","beta","ssleay","master","before","after","pre","post","rsaref","alpha"].any?{|s|e.downcase.include?(s)}}.map{|s|s.delete_prefix("v").delete_prefix("OpenSSL_").gsub("_",".")}.sort_by{|a,b| a.split(".").map{|s|s.to_i(36)} }.reject{|s|s.start_with?("1.1.")}.last'
}

echo starting ccache…
getLatest ccache/ccache > $ROOTDIR/shared/definitions/ccache_version
echo starting curl…
getLatest curl/curl     > $ROOTDIR/shared/definitions/curl_version
echo starting geoip…
{'fraction_non_alphanumeric': 0.24272197962154293, 'fraction_numerical': 0.009461426491994178, 'mean_word_length': 5.108888888888889, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '39284', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1047, 'n_words': 190}