Skip to content

Commit

Permalink
Add bin and launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Mar 8, 2019
1 parent 608fa76 commit e4f40ee
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog-fetcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php

require __DIR__ . '/changelog_fetcher.php';
39 changes: 39 additions & 0 deletions changelog_fetcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
// Copied this from drush/drush.

use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Violinist\ChangelogFetcher\ChangelogRetriever;
use Violinist\ChangelogFetcher\FetchCommand;
use Violinist\ChangelogFetcher\ProcessFactory;

$cwd = isset($_SERVER['PWD']) && is_dir($_SERVER['PWD']) ? $_SERVER['PWD'] : getcwd();
// Set up autoloader
$loader = false;
if (file_exists($autoloadFile = __DIR__ . '/vendor/autoload.php')
|| file_exists($autoloadFile = __DIR__ . '/../autoload.php')
|| file_exists($autoloadFile = __DIR__ . '/../../autoload.php')
) {
$loader = include_once($autoloadFile);
} else {
throw new \Exception("Could not locate autoload.php. cwd is $cwd; __DIR__ is " . __DIR__);
}


$app = new Application();
$container = new ContainerBuilder();

$container->register('process_factory', ProcessFactory::class);

$container->register('changelog_retriever', ChangelogRetriever::class)
->addArgument(new Reference('dependency_repo_retriever'))
->addArgument(new Reference('process_factory'));
$container->register('dependency_repo_retriever', \Violinist\ChangelogFetcher\DependencyRepoRetriever::class)
->addArgument(new Reference('process_factory'));

$app->add(new FetchCommand($container->get('changelog_retriever')));

$app->setName('changelog-fetcher');

$app->run();

0 comments on commit e4f40ee

Please sign in to comment.