Skip to content

Commit

Permalink
sorted gitignore rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Jan 16, 2016
1 parent 38e6772 commit 797c0ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

# IDE & OS files
.*.swp
.idea
nbproject
.DS_Store
.buildpath
.idea
.project
.settings
Thumbs.db
.DS_Store
nbproject

# vendor dirs
vendor
Expand All @@ -26,11 +26,11 @@ composer.lock
coverage.clover

# PHARs
hidev.phar
box.phar
composer.phar
hidev.phar
php-cs-fixer.phar
phpunit.phar
composer.phar

# runtime dir
/runtime
6 changes: 2 additions & 4 deletions src/controllers/VcsignoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ public function actionLoad()
foreach ($this->takeGoal('binaries')->keys() as $name) {
$items[$name . '.phar'] = 'PHARs';
}
if ($items) {
ksort($items);
$this->takeVcs()->setIgnore($items);
}
$this->takeVcs()->setIgnore($items);
$items = $this->getFile()->load() ?: [];
$this->takeVcs()->setIgnore($items);
}

public function actionSave()
{
$this->getFile()->save($this->takeVcs()->getIgnore());

return 0;
}
}
5 changes: 3 additions & 2 deletions src/handlers/GitignoreHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ public function getHistory()
public function render($items)
{
foreach ($items as $item => $comment) {
$comments[$comment] .= $item . "\n";
$comments[$comment][$item] = $item;
}

foreach ($comments as $comment => $items) {
$res .= static::renderComment($comment) . $items;
ksort($items);
$res .= static::renderComment($comment) . implode("\n", $items) . "\n";
}

return ltrim($res);
Expand Down

0 comments on commit 797c0ed

Please sign in to comment.