<commit_before># cf) https://github.com/sstephenson/ruby-build/wiki#suggested-build-environment
case node[:platform]
when "debian", "ubuntu"
  package "autoconf"
  package "bison"
  package "build-essential"
  package "libssl-dev"
  package "libyaml-dev"
  package "libreadline6-dev"
  package "zlib1g-dev"
  package "libncurses5-dev"
  package "libffi-dev"
  package "libgdbm3"
  package "libgdbm-dev"
  package "libffi-dev"
when "redhat", "fedora"
  # redhat is including CentOS
  package "gcc"
  package "openssl-devel"
  package "libyaml-devel"
  package "libffi-devel"
  package "readline-devel"
  package "zlib-devel"
  package "gdbm-devel"
  package "ncurses-devel"
  package "libffi-devel"
else
  # for backward compatibility (<= v0.2.1)
  package "libffi-devel"
  package "openssl-devel"
  package "readline-devel"
end

package "git"

require "itamae/plugin/recipe/rbenv"

git rbenv_root do
  repository "git://github.com/sstephenson/rbenv.git"
end

git "#{rbenv_root}/plugins/ruby-build" do
  repository "git://github.com/sstephenson/ruby-build.git"
  if node[:'ruby-build'] && node[:'ruby-build'][:revision]
    revision node[:'ruby-build'][:revision]
  end
end

git "#{rbenv_root}/plugins/rbenv-gem-rehash" do
  repository "git://github.com/sstephenson/rbenv-gem-rehash.git"
  if node[:'rbenv-gem-rehash'] && node[:'rbenv-gem-rehash'][:revision]
    revision node[:'rbenv-gem-rehash'][:revision]
  end
end

git "#{rbenv_root}/plugins/rbenv-default-gems" do
  repository "git://github.com/sstephenson/rbenv-default-gems.git"
  if node[:'rbenv-default-gems'] && node[:'rbenv-default-gems'][:revision]
    revision node[:'rbenv-default-gems'][:revision]
  end
end

if node[:'rbenv-default-gems'] && node[:'rbenv-default-gems'][:'default-gems']
  file "#{rbenv_root}/default-gems" do
    content node[:'rbenv-default-gems'][:'default-gems'].join("\n") + "\n"
    mode    "664"
  end
end

node[:rbenv][:versions].each do |version|
  execute "rbenv install #{version}" do
    command "#{rbenv_init} rbenv install #{version}"
    not_if  "#{rbenv_init} rbenv versions | grep #{version}"
  end
end

node[:rbenv][:global].tap do |version|
  execute "rbenv global #{version}" do
    command "#{rbenv_init} rbenv global #{version}"<commit_msg>add scheme option under proxied network<commit_after># cf) https://github.com/sstephenson/ruby-build/wiki#suggested-build-environment
case node[:platform]
when "debian", "ubuntu"
  package "autoconf"
  package "bison"
  package "build-essential"
  package "libssl-dev"
  package "libyaml-dev"
  package "libreadline6-dev"
  package "zlib1g-dev"
  package "libncurses5-dev"
  package "libffi-dev"
  package "libgdbm3"
  package "libgdbm-dev"
  package "libffi-dev"
when "redhat", "fedora"
  # redhat is including CentOS
  package "gcc"
  package "openssl-devel"
  package "libyaml-devel"
  package "libffi-devel"
  package "readline-devel"
  package "zlib-devel"
  package "gdbm-devel"
  package "ncurses-devel"
  package "libffi-devel"
else
  # for backward compatibility (<= v0.2.1)
  package "libffi-devel"
  package "openssl-devel"
  package "readline-devel"
end

package "git"

scheme = "git"
scheme = node[:rbenv][:scheme] if node[:rbenv][:scheme]

require "itamae/plugin/recipe/rbenv"

git rbenv_root do
  repository "#{scheme}://github.com/sstephenson/rbenv.git"
end

git "#{rbenv_root}/plugins/ruby-build" do
  repository "#{scheme}://github.com/sstephenson/ruby-build.git"
  if node[:'ruby-build'] && node[:'ruby-build'][:revision]
    revision node[:'ruby-build'][:revision]
  end
end

git "#{rbenv_root}/plugins/rbenv-gem-rehash" do
  repository "#{scheme}://github.com/sstephenson/rbenv-gem-rehash.git"
  if node[:'rbenv-gem-rehash'] && node[:'rbenv-gem-rehash'][:revision]
    revision node[:'rbenv-gem-rehash'][:revision]
  end
end

git "#{rbenv_root}/plugins/rbenv-default-gems" do
  repository "#{scheme}://github.com/sstephenson/rbenv-default-gems.git"
  if node[:'rbenv-default-gems'] && node[:'rbenv-default-gems'][:revision]
    revision node[:'rbenv-default-gems'][:revision]
  end
end

if node[:'rbenv-default-gems'] && node[:'rbenv-default-gems'][:'default-gems']
  file "#{rbenv_root}/default-gems" do
    content node[:'rbenv-default-gems'][:'default-gems'].join("\n") + "\n"
    mode    "664"
  end
end

node[:rbenv][:versions].each do |version|
  execute "rbenv install #{version}" do
    command "#{rbenv_init} rbenv install #{version}"
    not_if  "#{rbenv_init} rbenv versions | grep #{version}"
  end
end

node[:rbenv][:global].tap do |version|
  execute "rbenv global #{version}" do
    command "#{rbenv_init} rbenv global #{version}"
{'fraction_non_alphanumeric': 0.1665943600867679, 'fraction_numerical': 0.004338394793926247, 'mean_word_length': 4.643818849449205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3940568', 'n_tokens_mistral': 1841, 'n_tokens_neox': 1769, 'n_words': 334}