<commit_before># -*- mode: ruby -*-
# vi: set ft=ruby :

required_plugins = %w(
  vagrant-vbguest
<#if machine.synchronization?lower_case == "rsync">
  vagrant-gatling-rsync
</#if>
)

plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
if not plugins_to_install.empty?
  puts "Installing plugins: ${"#"}{plugins_to_install.join(' ')}"
  if system "vagrant plugin install ${"#"}{plugins_to_install.join(' ')}"
    exec "vagrant ${"#"}{ARGV.join(' ')}"
  else
    abort "Installation of one or more plugins has failed. Aborting."
  end
end

Vagrant.configure("2") do |config|
  config.vm.box = '${machine.box}'

  config.vm.provider "virtualbox" do |v|
    v.memory = ${machine.memory?c}
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  end
<#if machine.synchronization?lower_case == "rsync">

  config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [ ".git/", ".idea/", "node_modules/" ]

  config.gatling.latency = 2.5
  config.gatling.time_format = "%H:%M:%S"
  config.gatling.rsync_on_startup = false
</#if>

  # TODO: loop all exposed ports of containers
  # forwarded ports
  # config.vm.network 'forwarded_port', guest: 8080, host: 8080, auto_correct: true

  config.vm.provision "docker"

  config.vm.provision 'ansible', run: 'always', type: 'ansible_local' do |a|
    a.become = true
    a.verbose = '-vvv'
    a.playbook = './playbook.yml'
    a.extra_vars = './workspace/workspace.yml'
  end<commit_msg>Generate forwarded ports for all docker's containers<commit_after># -*- mode: ruby -*-
# vi: set ft=ruby :

required_plugins = %w(
  vagrant-vbguest
<#if machine.synchronization?lower_case == "rsync">
  vagrant-gatling-rsync
</#if>
)

plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
if not plugins_to_install.empty?
  puts "Installing plugins: ${"#"}{plugins_to_install.join(' ')}"
  if system "vagrant plugin install ${"#"}{plugins_to_install.join(' ')}"
    exec "vagrant ${"#"}{ARGV.join(' ')}"
  else
    abort "Installation of one or more plugins has failed. Aborting."
  end
end

Vagrant.configure("2") do |config|
  config.vm.box = '${machine.box}'

  config.vm.provider "virtualbox" do |v|
    v.memory = ${machine.memory?c}
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  end
<#if machine.synchronization?lower_case == "rsync">

  config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [ ".git/", ".idea/", "node_modules/" ]

  config.gatling.latency = 2.5
  config.gatling.time_format = "%H:%M:%S"
  config.gatling.rsync_on_startup = false
</#if>

  ### http/https ###
  # config.vm.network 'forwarded_port', guest: 8080, host: 8080, auto_correct: false
  # config.vm.network 'forwarded_port', guest: 8443, host: 8443, auto_correct: false
<#list containers?keys as name>
  <#assign container = containers[name]>

  ### ${name} ###
  <#list container.ports?keys as key>
  # config.vm.network 'forwarded_port', guest: ${container.ports[key]}, host: ${key}, auto_correct: false
  </#list>
</#list>

  config.vm.provision "docker"

  config.vm.provision 'ansible', run: 'always', type: 'ansible_local' do |a|
    a.become = true
    a.verbose = '-vvv'
    a.playbook = './playbook.yml'
    a.extra_vars = './workspace/workspace.yml'
  end
{'fraction_non_alphanumeric': 0.17645340344726848, 'fraction_numerical': 0.00993280747881975, 'mean_word_length': 4.1878787878787875, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '125130', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1265, 'n_words': 277}