review codeparts
This commit is contained in:
parent
89625422f7
commit
0bc36c6c74
881
21_HEOSGroup.pm
881
21_HEOSGroup.pm
File diff suppressed because it is too large
Load Diff
2045
21_HEOSMaster.pm
2045
21_HEOSMaster.pm
File diff suppressed because it is too large
Load Diff
1545
21_HEOSPlayer.pm
1545
21_HEOSPlayer.pm
File diff suppressed because it is too large
Load Diff
0
controls_HEOS.txt
Normal file
0
controls_HEOS.txt
Normal file
39
hooks/pre-commit
Executable file
39
hooks/pre-commit
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
use POSIX qw(strftime);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
my @filenames =
|
||||||
|
( 'FHEM/21_HEOSGroup.pm', 'FHEM/21_HEOSMaster.pm', 'FHEM/21_HEOSPlayer.pm' );
|
||||||
|
|
||||||
|
my $controlsfile = 'controls_HEOS.txt';
|
||||||
|
|
||||||
|
open( FH, ">$controlsfile" ) || return ("Can't open $controlsfile: $!");
|
||||||
|
|
||||||
|
for my $filename (@filenames) {
|
||||||
|
my @statOutput = stat($filename);
|
||||||
|
|
||||||
|
if ( scalar @statOutput != 13 ) {
|
||||||
|
printf 'error: stat has unexpected return value for '
|
||||||
|
. $filename . "\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $mtime = $statOutput[9];
|
||||||
|
my $date = POSIX::strftime( "%Y-%m-%d", localtime($mtime) );
|
||||||
|
my $time = POSIX::strftime( "%H:%M:%S", localtime($mtime) );
|
||||||
|
my $filetime = $date . "_" . $time;
|
||||||
|
|
||||||
|
my $filesize = $statOutput[7];
|
||||||
|
|
||||||
|
printf FH 'UPD ' . $filetime . ' ' . $filesize . ' ' . $filename . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
close(FH);
|
||||||
|
|
||||||
|
system("git add $controlsfile");
|
||||||
|
|
||||||
|
print 'Create controls File succesfully' . "\n";
|
||||||
|
|
||||||
|
exit 0;
|
Loading…
x
Reference in New Issue
Block a user