Skip to content

Commit

Permalink
Issue #513: add stub for the Dev::Git::InstallHooks console command
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Oct 5, 2020
1 parent 19b9bec commit 17731b5
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
80 changes: 80 additions & 0 deletions Kernel/System/Console/Command/Dev/Git/InstallHooks.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
--
# OTOBO is a web-based ticketing system for service organisations.
# --
# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
# Copyright (C) 2019-2020 Rother OSS GmbH, https://otobo.de/
# --
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# --

package Kernel::System::Console::Command::Dev::Git::InstallHooks;

use strict;
use warnings;

use parent qw(Kernel::System::Console::BaseCommand);

our @ObjectDependencies = (
);

sub Configure {
my ( $Self, %Param ) = @_;

# $Self->Description('Describe this command.');
# $Self->AddOption(
# Name => 'option',
# Description => "Describe this option.",
# Required => 1,
# HasValue => 1,
# ValueRegex => qr/.*/smx,
# );
# $Self->AddArgument(
# Name => 'argument',
# Description => "Describe this argument.",
# Required => 1,
# ValueRegex => qr/.*/smx,
# );

return;
}

# sub PreRun {
# my ( $Self, %Param ) = @_;
#
# # Perform any custom validations here. Command execution can be stopped with die().
#
# # my $TargetDirectory = $Self->GetOption('target-directory');
# # if ($TargetDirectory && !-d $TargetDirectory) {
# # die "Directory $TargetDirectory does not exist.\n";
# # }
#
# return;
# }

sub Run {
my ( $Self, %Param ) = @_;

$Self->Print("<yellow>Meaningful start message...</yellow>\n");

# return $Self->ExitCodeError();

$Self->Print("<green>Done.</green>\n");
return $Self->ExitCodeOk();
}

# sub PostRun {
# my ( $Self, %Param ) = @_;
#
# # This will be called after Run() (even in case of exceptions). Perform any cleanups here.
#
# return;
# }

1;
34 changes: 34 additions & 0 deletions scripts/test/Console/Command/Dev/Git/InstallHooks.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# --
# OTOBO is a web-based ticketing system for service organisations.
# --
# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
# Copyright (C) 2019-2020 Rother OSS GmbH, https://otobo.de/
# --
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# --

## no critic (Modules::RequireExplicitPackage)
use strict;
use warnings;
use utf8;

use vars (qw($Self));

my $CommandObject = $Kernel::OM->Get('Kernel::System::Console::Command::Dev::Git::InstallHooks');

my ($Result, $ExitCode);
{
local *STDOUT;
open STDOUT, '>:encoding(UTF-8)', \$Result;
$ExitCode = $CommandObject->Execute();
$Kernel::OM->Get('Kernel::System::Encode')->EncodeInput(\$Result);
}

1;

0 comments on commit 17731b5

Please sign in to comment.