File: conventional-changelog

Recommend this page to a friend!
  Classes of Marco Cesarato  >  PHP Conventional Changelog  >  conventional-changelog  >  Download  
File: conventional-changelog
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Conventional Changelog
Generate changelog and release notes from commit
Author: By
Last change: fix(config): get configs from project root or working dir
Date: 3 months ago
Size: 1,007 bytes
 

Contents

Class file image Download
#!/usr/bin/env php
<?php

use ConventionalChangelog\DefaultCommand;
use
Symfony\Component\Console\Application;

// Autoload
$files = [
   
__DIR__ . '/../../autoload.php',
   
__DIR__ . '/../vendor/autoload.php',
   
__DIR__ . '/vendor/autoload.php',
];
foreach (
$files as $file) {
    if (
file_exists($file)) {
        require_once
$file;
        break;
    }
}

// Report only fatal errors
error_reporting(2039);

// Config
$config = [];
$configName = '.changelog';
$configFiles = [
   
getcwd() . '/' . $configName, // Working dir
   
__DIR__ . '/../../../' . $configName, // Project path
];
foreach (
$configFiles as $file) {
    if (
is_file($file) && empty($config)) {
       
$config = require $file;
    }
}

// Command
$command = new DefaultCommand($config);
$commandName = $command->getName();

// Run application single command
$application = new Application('conventional-changelog', '1.8.0');
$application->add($command);
$application->setDefaultCommand($commandName, true);
$application->run();


For more information send a message to info at phpclasses dot org.