Skip to content

Commit

Permalink
fixed getting package start year with git log
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Jan 19, 2016
1 parent d78e476 commit 66e1684
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2014-2016, HiQDev (http://hiqdev.com/)
Copyright © 2015-2016, HiQDev (http://hiqdev.com/)
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ And see the magic.
This project is released under the terms of the BSD-3-Clause [license](LICENSE).
Read more [here](http://choosealicense.com/licenses/bsd-3-clause).

Copyright © 2014-2016, HiQDev (http://hiqdev.com/)
Copyright © 2015-2016, HiQDev (http://hiqdev.com/)
13 changes: 13 additions & 0 deletions src/controllers/GitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,17 @@ public function getUserEmail()
{
return trim(`git config --get user.email`);
}

public function getYear()
{
$tags = $this->getTags();
if ($tags) {
$date = array_pop($this->getTags());
} else {
$date = `git log --reverse --pretty=%ai | head -n 1`;
}
$year = $date ? date('Y', strtotime($date)) : '';

return $year;
}
}
5 changes: 5 additions & 0 deletions src/controllers/PackageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public function getYears()
return ($old && $old < $cur ? $this->year . '-' : '') . $cur;
}

public function getYear()
{
return $this->getItem('year') ?: $this->takeVcs()->getYear();
}

public function getLicense()
{
return $this->getItem('license') ?: $this->takeVendor()->license ?: 'No license';
Expand Down

0 comments on commit 66e1684

Please sign in to comment.