Skip to content

Commit

Permalink
added git/vcs/ignore components
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Apr 27, 2017
1 parent 6153121 commit bb64fa9
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 4 deletions.
42 changes: 42 additions & 0 deletions src/components/Git.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Automation tool mixed with code generator for easier continuous development
*
* @link https://github.com/hiqdev/hidev
* @package hidev
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\components;

/**
* Git component.
*/
class Git extends Vcs
{
protected $_before = ['.gitignore'];

/**
* @var string current tag
*/
protected $tag;

public function getUserName()
{
return trim(`git config --get user.name`);
}

public function getUserEmail()
{
return trim(`git config --get user.email`);
}

public function getYear()
{
$date = `git log --reverse --pretty=%ai | head -n 1`;
$year = $date ? date('Y', strtotime($date)) : '';

return $year;
}
}
6 changes: 3 additions & 3 deletions src/controllers/VcsController.php → src/components/Vcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\components;

/**
* Controller for VCSs (Version Control Systems).
* VCSs (Version Control Systems) component.
*/
class VcsController extends CommonController
class Vcs extends \hidev\base\Component
{
protected $_ignore;

Expand Down
32 changes: 32 additions & 0 deletions src/components/Vcsignore.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Automation tool mixed with code generator for easier continuous development
*
* @link https://github.com/hiqdev/hidev
* @package hidev
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\components;

/**
* VCS ignore component.
*/
class Vcsignore extends \hidev\base\Component
{
protected $_items = [
'hidev-local.yml' => 'hidev internals',
'.hidev/composer.json' => 'hidev internals',
'.hidev/composer.lock' => 'hidev internals',
'.hidev/vendor' => 'hidev internals',
'.*.swp' => 'IDE & OS files',
'.idea' => 'IDE & OS files',
'nbproject' => 'IDE & OS files',
'.buildpath' => 'IDE & OS files',
'.project' => 'IDE & OS files',
'.settings' => 'IDE & OS files',
'Thumbs.db' => 'IDE & OS files',
'.DS_Store' => 'IDE & OS files',
];
}
5 changes: 4 additions & 1 deletion src/config/basis.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'class' => 'hidev\base\Request',
],*/
'view' => [
'class' => \hidev\base\View::class,
'class' => \yii\base\View::class,
'renderers' => [
'twig' => [
'class' => \yii\twig\ViewRenderer::class,
Expand All @@ -56,6 +56,9 @@
'vcsignore' => [
'class' => \hidev\components\Vcsignore::class,
],
'git' => [
'class' => \hidev\components\Git::class,
],
'github' => [
'class' => \hidev\components\GitHub::class,
],
Expand Down

0 comments on commit bb64fa9

Please sign in to comment.