<commit_before><?php
namespace Pomander;

class Builder
{
	public function config()
	{
		foreach(glob("deploy/*.yml") as $config)
			$configs[basename($config,".yml")] = \Spyc::YAMLLoad($config);
		foreach(glob("deploy/*.php") as $config)
			$configs[basename($config,".php")] = $config;
		$this->load_environments($configs);
	}

	public function has_environments()
	{
		return count(glob("deploy/*.yml")) > 0;
	}

	public function load_environments($config)
	{
		foreach($config as $env_name=>$environment)
		{
			$env = new Environment($env_name);
			if(is_string($environment)) include($env);
			else $env->set($environment);
			task($env_name, function($app) use($env,$environment) {
				info("environment",$env->name);
				if(is_string($environment)) include($environment);
				else $env->set($environment);
				$app->env = $env;
				$app->reset();
			});
		}
	}

	public function load($plugin)
	{
		if(!class_exists($plugin))
			$plugin = "\\Pomander\\$plugin";
		$plugin::load();
	}

	public function run()
	{
		$builder = $this;
		if($this->has_environments()) $this->config();
		builder()->get_application()->default_env = "development";

		task("environment",function($app) use($builder) {
			if(!$builder->has_environments())
				warn("config","unable to locate any environments. try running 'config'");
			if(!isset($app->env)) $app->invoke($app->default_env);
		});

		task('app','environment',function($app) {
			$app->env->multi_role_support("app",$app);<commit_msg>for no_releases in development environment.<commit_after><?php
namespace Pomander;

class Builder
{
	public function config()
	{
		foreach(glob("deploy/*.yml") as $config)
			$configs[basename($config,".yml")] = \Spyc::YAMLLoad($config);
		foreach(glob("deploy/*.php") as $config)
			$configs[basename($config,".php")] = $config;
		$this->load_environments($configs);
	}

	public function has_environments()
	{
		return count(glob("deploy/*.yml")) > 0;
	}

	public function load_environments($config)
	{
		foreach($config as $env_name=>$environment)
		{
			$env = new Environment($env_name);
			if(is_string($environment)) include($env);
			else $env->set($environment);
			task($env_name, function($app) use($env,$environment) {
				info("environment",$env->name);
				if(is_string($environment)) include($environment);
				else $env->set($environment);
				$app->env = $env;
				if($env->name == "development") $app->env->releases = false;
				$app->reset();
			});
		}
	}

	public function load($plugin)
	{
		if(!class_exists($plugin))
			$plugin = "\\Pomander\\$plugin";
		$plugin::load();
	}

	public function run()
	{
		$builder = $this;
		if($this->has_environments()) $this->config();
		builder()->get_application()->default_env = "development";

		task("environment",function($app) use($builder) {
			if(!$builder->has_environments())
				warn("config","unable to locate any environments. try running 'config'");
			if(!isset($app->env)) $app->invoke($app->default_env);
		});

		task('app','environment',function($app) {
			$app->env->multi_role_support("app",$app);
{'fraction_non_alphanumeric': 0.20444880601897286, 'fraction_numerical': 0.0006542361792607131, 'mean_word_length': 5.079522862823062, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 42, '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': '7357321', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1008, 'n_words': 167}