#!/usr/bin/env php
<?php

set_time_limit(0);

try {
  if (file_exists($autoloadFile = __DIR__ . '/vendor/autoload.php')
    || file_exists($autoloadFile = __DIR__ . '/../autoload.php')
    || file_exists($autoloadFile = __DIR__ . '/../../autoload.php')
    || file_exists($autoloadFile = __DIR__ . '/../../../autoload.php')
  ) {
    include_once($autoloadFile);
  } else {
    throw new \Exception(sprintf("Could not locate autoload.php. __DIR__ is %s, cwd is %s", __DIR__, getcwd()));
  }

  $transformer = new \Fruition\MacDevShim\ComposeEnvironmentTransformer();
  $transformer->transform();
}
catch (\Throwable $e) {
  echo sprintf("Fatal error: %s\n", $e->getMessage());
  exit(1);
}
