Skip to content

Commit

Permalink
Standardise case on references to "Changelog"
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
Damian Mooyman committed Mar 17, 2016
1 parent f104d94 commit fb56b2a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

namespace SilverStripe\Cow\Commands\Release;

use SilverStripe\Cow\Steps\Release\CreateChangeLog;
use SilverStripe\Cow\Steps\Release\CreateChangelog;

/**
* Description of Create
*
* @author dmooyman
*/
class ChangeLog extends Release
class Changelog extends Release
{
/**
*
* @var string
*/
protected $name = 'release:changelog';

protected $description = 'Generate changelog';

protected function fire()
{
// Get arguments
Expand All @@ -28,7 +28,7 @@ protected function fire()
$modules = $this->getReleaseModules($directory);

// Steps
$step = new CreateChangeLog($this, $version, $fromVersion, $directory, $modules);
$step = new CreateChangelog($this, $version, $fromVersion, $directory, $modules);
$step->run($this->input, $this->output);
}
}
10 changes: 5 additions & 5 deletions src/Commands/Release/Release.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use SilverStripe\Cow\Commands\Command;
use SilverStripe\Cow\Model\ReleaseVersion;
use SilverStripe\Cow\Steps\Release\CreateBranch;
use SilverStripe\Cow\Steps\Release\CreateChangeLog;
use SilverStripe\Cow\Steps\Release\CreateChangelog;
use SilverStripe\Cow\Steps\Release\CreateProject;
use SilverStripe\Cow\Steps\Release\RunTests;
use SilverStripe\Cow\Steps\Release\UpdateTranslations;
Expand All @@ -21,7 +21,7 @@
class Release extends Command
{
protected $name = 'release';

protected $description = 'Execute each release step in order to publish a new version';

const BRANCH_AUTO = 'auto';
Expand Down Expand Up @@ -55,17 +55,17 @@ protected function fire()
// Change to the correct temp branch (if given)
$branch = new CreateBranch($this, $directory, $branch, $modules);
$branch->run($this->input, $this->output);

// Update all translations
$translate = new UpdateTranslations($this, $directory, $modules);
$translate->run($this->input, $this->output);

// Run tests
$test = new RunTests($this, $directory);
$test->run($this->input, $this->output);

// Generate changelog
$changelogs = new CreateChangeLog($this, $version, $fromVersion, $directory, $modules);
$changelogs = new CreateChangelog($this, $version, $fromVersion, $directory, $modules);
$changelogs->run($this->input, $this->output);

// Output completion
Expand Down
10 changes: 5 additions & 5 deletions src/Model/ChangeLog.php → src/Model/Changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* A changelog which can be generated from a project
*/
class ChangeLog
class Changelog
{
/**
* List of source modules
Expand Down Expand Up @@ -36,15 +36,15 @@ public function __construct(array $modules, ReleaseVersion $fromVersion)

/**
* Get the list of changes for this module
*
*
* @param OutputInterface $output
* @param Module $module
* @return array
*/
protected function getModuleLog(OutputInterface $output, Module $module)
{
$items = array();

// Get raw log
$fromVersion = $this->fromVersion->getValue();
$range = $fromVersion."..HEAD";
Expand Down Expand Up @@ -103,7 +103,7 @@ public function getMarkdown(OutputInterface $output)
if (empty($commits)) {
continue;
}

$output .= "\n### $groupName\n\n";
foreach ($commits as $commit) {
$output .= $commit->getMarkdown();
Expand Down Expand Up @@ -137,7 +137,7 @@ protected function sortByType($commits)

// List types
$groupedByType = array();
foreach (ChangeLogItem::get_types() as $type) {
foreach (ChangelogItem::get_types() as $type) {
$groupedByType[$type] = array();
}

Expand Down
16 changes: 8 additions & 8 deletions src/Model/ChangeLogItem.php → src/Model/ChangelogItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
/**
* Represents a line-item in a changelog
*/
class ChangeLogItem
class ChangelogItem
{
/**
* @var Module
*/
protected $module;

/**
* @var Commit
*/
protected $commit;

/**
* Rules for ignoring commits
*
Expand Down Expand Up @@ -84,7 +84,7 @@ public function __construct(Module $module, Commit $commit)
$this->module = $module;
$this->commit = $commit;
}

/**
* Get the raw commit
*
Expand All @@ -94,10 +94,10 @@ public function getCommit()
{
return $this->commit;
}

/**
* Should this commit be ignored?
*
*
* @return boolean
*/
public function isIgnored()
Expand Down Expand Up @@ -186,12 +186,12 @@ public function getType()
}
}
}

// Fallback check for CVE (not at start of string)
if ($this->getSecurityCVE()) {
return 'Security';
}

return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

use Exception;
use SilverStripe\Cow\Commands\Command;
use SilverStripe\Cow\Model\ChangeLog;
use SilverStripe\Cow\Model\Changelog;
use SilverStripe\Cow\Model\ReleaseVersion;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Creates a new changelog
*/
class CreateChangeLog extends ModuleStep
class CreateChangelog extends ModuleStep
{
/**
* @var ReleaseVersion
*/
protected $version;

/**
*
* @var ReleaseVersion
Expand All @@ -28,7 +28,7 @@ class CreateChangeLog extends ModuleStep
/**
* Paths to check for changelog folder
*
* @var type
* @var array
*/
protected $paths = array(
"framework/docs/en/04_Changelogs",
Expand Down Expand Up @@ -66,7 +66,7 @@ public function run(InputInterface $input, OutputInterface $output)
$this->log($output, "Generating changelog content");

// Generate changelog content
$changelog = new ChangeLog($this->getModules(), $this->from);
$changelog = new Changelog($this->getModules(), $this->from);
$content = $changelog->getMarkdown($output);

// Now we need to merge this content with the file, or otherwise create it
Expand Down Expand Up @@ -101,6 +101,7 @@ protected function getChangelogPath()
* Find best changelog folder for this repo
*
* @return string
* @throws Exception
*/
protected function getChangelogFolder()
{
Expand All @@ -123,14 +124,18 @@ protected function getChangelogFolder()
* @param string $content
* @param string $path
*/
protected function writeChangeLog(OutputInterface $output, $content, $path)
protected function writeChangelog(OutputInterface $output, $content, $path)
{
$header = $this->getFileHeader($output, $path);
file_put_contents($path, $header.$content);
}

/**
* Get header component to put before the changelog content
*
* @param OutputInterface $output
* @param string $path File path to check for existing header
* @return string
*/
protected function getFileHeader(OutputInterface $output, $path)
{
Expand Down Expand Up @@ -161,7 +166,8 @@ public function getStepName()
* Commit changes to git
*
* @param OutputInterface $output
* @param type $path
* @param string $path
* @throws Exception
*/
public function commitChanges(OutputInterface $output, $path)
{
Expand Down

0 comments on commit fb56b2a

Please sign in to comment.