Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1489df2

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID d1489df29cba94ddf3a9f6dc6a1f310033a90924
  • Vorgänger 512bdfe4
  • Nachfolger ea7c7035

Loginbildschirm: Unter Versionsnummer auch aktuelle Git-Revisionsnummer anzeigen

Conflicts:
locale/de/all

Unterschiede anzeigen:

SL/Git.pm
1
package SL::Git;
2

  
3
use strict;
4
use warnings;
5

  
6
use parent qw(Rose::Object);
7

  
8
use Carp;
9
use List::Util qw(first);
10

  
11
sub is_git_installation {
12
  my ($self) = @_;
13

  
14
  return $self->git_exe && -d ".git" && -f ".git/config" ? 1 : 0;
15
}
16

  
17
sub git_exe {
18
  my ($self) = @_;
19

  
20
  return $self->{git_exe} if $self->{_git_exe_search};
21

  
22
  $self->{_git_exe_search} = 1;
23
  $self->{git_exe}         = first { -x } map { "${_}/git" } split m/:/, $ENV{PATH};
24

  
25
  return $self->{git_exe};
26
}
27

  
28
sub get_log {
29
  my ($self, %params) = @_;
30

  
31
  croak "No git executable found" if !$self->git_exe;
32

  
33
  my $since_until = join '..', $params{since}, $params{until};
34
  my $in          = IO::File->new($self->git_exe . qq! log --format='tformat:\%H|\%an|\%ae|\%ai|\%s' ${since_until} |!);
35

  
36
  if (!$in) {
37
    $::lxdebug->message(LXDebug::WARN(), "Error spawning git: $!");
38
    return ();
39
  }
40

  
41
  my @log = grep { $_ } map { $self->_parse_log_line($_) } <$in>;
42
  $in->close;
43

  
44
  return @log;
45
}
46

  
47
sub _parse_log_line {
48
  my ($self, $line) = @_;
49

  
50
  chomp $line;
51

  
52
  my @fields = split m/\|/, $line, 5;
53
  return undef unless scalar(@fields) == 5;
54

  
55
  my %commit     = (
56
    hash         => $fields[0],
57
    author_name  => $fields[1],
58
    author_email => $fields[2],
59
    subject      => $fields[4],
60
  );
61

  
62
  if ($fields[3] =~ m/^(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)\s+?([\+\-]?\d+)?$/) {
63
    $commit{author_date} = DateTime->new(year => $1, month => $2, day => $3, hour => $4, minute => $5, second => $6, time_zone => $7);
64
  }
65

  
66
  return \%commit;
67
}
68

  
69
1;
bin/mozilla/login.pl
31 31
use SL::Auth;
32 32
use SL::User;
33 33
use SL::Form;
34
use SL::Git;
34 35

  
35 36
require "bin/mozilla/common.pl";
36 37
require "bin/mozilla/todo.pl";
......
51 52
  $form->{title}      =  $::locale->text('kivitendo');
52 53
  $form->{interface}  = $::dispatcher->interface_type;
53 54

  
55
  my $git             = SL::Git->new;
56
  ($form->{git_head}) = $git->get_log(since => 'HEAD~1', until => 'HEAD') if $git->is_git_installation;
57

  
54 58
  # create the logo screen
55 59
  $form->header() unless $form->{noheader};
56 60

  
locale/de/all
930 930
  'General ledger and cash'     => 'Finanzbuchhaltung und Zahlungsverkehr',
931 931
  'General ledger corrections'  => 'Korrekturen im Hauptbuch',
932 932
  'Generic Tax Report'          => 'USTVA Bericht',
933
  'Git revision: #1, #2 #3'     => 'Git-Revision: #1, #2 #3',
933 934
  'Given Name'                  => 'Vorname',
934 935
  'Go one step back'            => 'Einen Schritt zur&uuml;ck',
935 936
  'Go one step forward'         => 'Einen Schritt vorw&auml;rts',
templates/webpages/login/company_logo.html
12 12

  
13 13
  <h3 class="login">[% 'kivitendo' | $T8 %] [% version %]</h3>
14 14

  
15
[%- IF git_head %]
16
  <p>[%- LxERP.t8("Git revision: #1, #2 #3", git_head.hash.substr(0, 7), git_head.author_date.to_kivitendo, git_head.author_date.strftime('%H:%M:%S %Z')) %]</p>
17
[%- END %]
18

  
15 19
  <p>[% 'companylogo_subtitle' | $T8 %]</p>
16 20
  <p>
17 21
   <b>
......
56 60
 </center>
57 61

  
58 62
 [%- todo_list %]
59

  

Auch abrufbar als: Unified diff