<commit_before>node.php.multi.phps.each do |php_version|
  phpfarm_compile php_version do
    owner "vagrant"
    group "vagrant"

    action :create
  end

  phpfarm_path = "#{node.phpfarm.home}/.phpfarm"
  pyrus_bin = "#{phpfarm_path}/inst/bin/pyrus-#{php_version}"
  phpunit_bin = "#{phpfarm_path}/inst/php-#{php_version}/bin/phpunit"
  bash "install phpunit" do
    user "vagrant"
    group "vagrant"
    environment Hash["HOME" => node.phpfarm.home]
    cwd phpfarm_path
    code <<-EOF
    . #{pyrus_bin} channel-discover pear.phpunit.de
    . #{pyrus_bin} channel-discover pear.symfony-project.com
    . #{pyrus_bin} install phpunit/PHPUnit
    EOF
    not_if "test -f #{phpunit_bin}"
  end

end<commit_msg>Manage multi php versions with phpenv.<commit_after>include_recipe "phpfarm"
include_recipe "phpenv"

phpfarm_path = "#{node.phpfarm.home}/.phpfarm"
phpenv_path = "#{node.phpenv.home}/.phpenv"

# symlink php versions installed by phpfarm into phpenv
link "#{phpenv_path}/versions" do
  to "#{phpfarm_path}/inst"
end

node.php.multi.phps.each do |php_version|

  phpfarm_compile php_version do
    owner "vagrant"
    group "vagrant"

    action :create
  end

  pyrus_bin = "#{phpfarm_path}/inst/bin/pyrus-#{php_version}"
  phpunit_bin = "#{phpfarm_path}/inst/php-#{php_version}/bin/phpunit"
  bash "install phpunit" do
    user "vagrant"
    group "vagrant"
    environment Hash["HOME" => node.phpfarm.home]
    cwd phpfarm_path
    code <<-EOF
    . #{pyrus_bin} channel-discover pear.phpunit.de
    . #{pyrus_bin} channel-discover pear.symfony-project.com
    . #{pyrus_bin} install phpunit/PHPUnit
    EOF
    not_if "test -f #{phpunit_bin}"
  end

end
{'fraction_non_alphanumeric': 0.12934131736526946, 'fraction_numerical': 0.0, 'mean_word_length': 3.73371104815864, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '6332401', 'n_tokens_mistral': 663, 'n_tokens_neox': 646, 'n_words': 124}