<commit_before>#
# Author:: <NAME> (<<EMAIL>>)
#
# Copyright 2012, Riot Games
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

provides "rbenv"
provides "rbenv/root"
provides "rbenv/prefix"
provides "rbenv/global"
provides "rbenv/versions"

rbenv Mash.new unless rbenv

def rbenv_command(*args)
  run_command(:command => "<%= @rbenv_bin %> #{args.join(' ')}", :no_status_check => true)
end

def root
  status, stdout, stderr = rbenv_command("root")
  status == 0 ? stdout : nil
end

def prefix
  status, stdout, stderr = rbenv_command("prefix")
  status == 0 ? stdout : nil
end

def global
  status, stdout, stderr = rbenv_command("global")
  status == 0 ? stdout : nil
end

def versions
  status, stdout, stderr = rbenv_command("versions")
  versions = []

  if status == 0
    version_dirs = Dir[File.join(root, "versions", "*")].select { |f| File.directory?(f) }
    versions = version_dirs.map { |d| File.basename(d) }
  end
  
  versions
end

rbenv[:root]     = root
rbenv[:prefix]   = prefix
rbenv[:global]   = global
rbenv[:versions] = versions<commit_msg>add current_version and current_version_prefix to ohai plugin<commit_after>#
# Author:: <NAME> (<<EMAIL>>)
#
# Copyright 2012, Riot Games
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

provides "rbenv"
provides "rbenv/root"
provides "rbenv/current_version"
provides "rbenv/current_version_prefix"
provides "rbenv/global"
provides "rbenv/versions"

rbenv Mash.new unless rbenv

def rbenv_command(*args)
  run_command(:command => "<%= @rbenv_bin %> #{args.join(' ')}", :no_status_check => true)
end

def root
  status, stdout, stderr = rbenv_command("root")
  status == 0 ? stdout : nil
end

def version
  status, stdout, stderr = rbenv_command("version-name")
  status == 0 ? stdout : nil
end

def prefix
  status, stdout, stderr = rbenv_command("prefix")
  status == 0 ? stdout : nil
end

def global
  status, stdout, stderr = rbenv_command("global")
  status == 0 ? stdout : nil
end

def versions
  status, stdout, stderr = rbenv_command("versions")
  versions = []

  if status == 0
    version_dirs = Dir[File.join(root, "versions", "*")].select { |f| File.directory?(f) }
    versions = version_dirs.map { |d| File.basename(d) }
  end
  
  versions
end

rbenv[:root]                   = root
rbenv[:current_version]        = version
rbenv[:current_version_prefix] = prefix
rbenv[:global]                 = global
rbenv[:versions]               = versions
{'fraction_non_alphanumeric': 0.1165644171779141, 'fraction_numerical': 0.007303534910896874, 'mean_word_length': 4.072592592592593, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4654647', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1111, 'n_words': 364}