<commit_before>require 'awesome_spawn'
require "vmdb/plugins"

namespace :evm do
  namespace :ansible_runner do
    desc "Seed galaxy roles for provider playbooks"
    task :seed do
      plugins_with_req_yml = Vmdb::Plugins.select do |plugin|
        req_yml_path = plugin.root.join('content_tmp', 'ansible', 'requirements.yml')
        File.file?(req_yml_path)
      end

      plugins_with_req_yml.each do |plugin|
        puts "Seeding roles for #{plugin.name}..."

        roles_path = plugin.root.join('content_tmp', 'ansible', 'roles')
        role_file  = plugin.root.join('content_tmp', 'ansible', 'requirements.yml')

        params = {
          nil          => "install",
          :roles_path= => roles_path,
          :role_file=  => role_file
        }

        begin
          AwesomeSpawn.run!("ansible-galaxy", :params => params)
          puts "Seeding roles for #{plugin.name}...Complete"
        rescue AwesomeSpawn::CommandResultError => err
          puts "Seeding roles for #{plugin.name}...Failed - #{err.result.error}"
          raise
        end
      end
    end
  end
end<commit_msg>Improve params<commit_after>require 'awesome_spawn'
require "vmdb/plugins"

namespace :evm do
  namespace :ansible_runner do
    desc "Seed galaxy roles for provider playbooks"
    task :seed do
      plugins_with_req_yml = Vmdb::Plugins.select do |plugin|
        req_yml_path = plugin.root.join('content_tmp', 'ansible', 'requirements.yml')
        File.file?(req_yml_path)
      end

      plugins_with_req_yml.each do |plugin|
        puts "Seeding roles for #{plugin.name}..."

        roles_path = plugin.root.join('content_tmp', 'ansible', 'roles')
        role_file  = plugin.root.join('content_tmp', 'ansible', 'requirements.yml')

        params = ["install", :roles_path= => roles_path, :role_file= => role_file]

        begin
          AwesomeSpawn.run!("ansible-galaxy", :params => params)
          puts "Seeding roles for #{plugin.name}...Complete"
        rescue AwesomeSpawn::CommandResultError => err
          puts "Seeding roles for #{plugin.name}...Failed - #{err.result.error}"
          raise
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12084870848708487, 'fraction_numerical': 0.0, 'mean_word_length': 2.6270903010033444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '799122', 'n_tokens_mistral': 687, 'n_tokens_neox': 679, 'n_words': 153}