| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package BlankOnDev::Form::github; |
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings FATAL => 'all'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Import : |
|
6
|
1
|
|
|
1
|
|
5
|
use Term::ReadKey; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
83
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use BlankOnDev::Rilis; |
|
|
1
|
|
|
|
|
10
|
|
|
|
1
|
|
|
|
|
21
|
|
|
8
|
1
|
|
|
1
|
|
316
|
use BlankOnDev::command; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
342
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Version : |
|
11
|
|
|
|
|
|
|
our $VERSION = '0.1004'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Subroutine for config github : |
|
14
|
|
|
|
|
|
|
# ------------------------------------------------------------------------ |
|
15
|
|
|
|
|
|
|
sub form_config_github { |
|
16
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $email) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Prepare form : |
|
19
|
0
|
|
|
|
|
|
my %data = (); |
|
20
|
0
|
|
|
|
|
|
my $confirmation; |
|
21
|
|
|
|
|
|
|
my $form_cache; |
|
22
|
0
|
|
|
|
|
|
my $form_clear; |
|
23
|
0
|
|
|
|
|
|
my $data_cache; |
|
24
|
0
|
|
|
|
|
|
my $home_dir = $ENV{"HOME"}; |
|
25
|
0
|
|
|
|
|
|
my $read_fileCfg; |
|
26
|
|
|
|
|
|
|
my $gitname; |
|
27
|
0
|
|
|
|
|
|
my $gitemail; |
|
28
|
0
|
|
|
|
|
|
my $r_gitset; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Get Command : |
|
31
|
|
|
|
|
|
|
# ---------------------------------------------------------------- |
|
32
|
0
|
|
|
|
|
|
my $get_cmd = BlankOnDev::command::github(); |
|
33
|
0
|
|
|
|
|
|
my $getGit_cmd = $get_cmd->{'git'}; |
|
34
|
0
|
|
|
|
|
|
my $gitCmd_name = $getGit_cmd->{'cfg-name'}; |
|
35
|
0
|
|
|
|
|
|
my $gitCmd_email = $getGit_cmd->{'cfg-email'}; |
|
36
|
0
|
|
|
|
|
|
my $gitCmd_authCache = $getGit_cmd->{'cfg-credential-cache'}; |
|
37
|
0
|
|
|
|
|
|
my $gitCmd_authCache_clear = $getGit_cmd->{'cfg-creden-cache-clear'}; |
|
38
|
0
|
|
|
|
|
|
my $gitCmd_list = $getGit_cmd->{'cfg-list'}; |
|
39
|
0
|
|
|
|
|
|
my $gnupg_cmd = $get_cmd->{'gpg'}; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Check file config github : |
|
42
|
0
|
0
|
|
|
|
|
if (-e $home_dir.'/.gitconfig') { |
|
43
|
|
|
|
|
|
|
# Form Confirmation : |
|
44
|
0
|
|
|
|
|
|
print "\n\n"; |
|
45
|
0
|
|
|
|
|
|
print "You want reconfig github ? [y or n] "; |
|
46
|
0
|
|
|
|
|
|
chomp($confirmation = <STDIN>); |
|
47
|
0
|
0
|
|
|
|
|
if ($confirmation eq 'y') { |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
0
|
0
|
|
|
|
if ($name ne '' and $email ne '') { |
|
50
|
0
|
|
|
|
|
|
system("$gitCmd_name \"$name\""); |
|
51
|
0
|
|
|
|
|
|
system("$gitCmd_email \"$email\""); |
|
52
|
0
|
|
|
|
|
|
$r_gitset = 1; |
|
53
|
|
|
|
|
|
|
} else { |
|
54
|
0
|
|
|
|
|
|
$r_gitset = 0; |
|
55
|
0
|
|
|
|
|
|
print "git user.name or user.email not enter\n"; |
|
56
|
0
|
|
|
|
|
|
exit 0; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Check Data cache : |
|
61
|
0
|
|
|
|
|
|
$read_fileCfg = BlankOnDev::Utils::file->read($home_dir."/.gitconfig"); |
|
62
|
0
|
0
|
|
|
|
|
if ($read_fileCfg =~ m/(helper)\s(\=)\s(.*)/) { |
|
63
|
0
|
|
|
|
|
|
print "\n"; |
|
64
|
0
|
|
|
|
|
|
print "You want to clear cache usename and password ? [y or n] "; |
|
65
|
0
|
|
|
|
|
|
chomp($form_cache = <STDIN>); |
|
66
|
0
|
0
|
0
|
|
|
|
if ($form_cache eq 'y' or $form_cache eq 'Y') { |
|
67
|
0
|
|
|
|
|
|
system($gitCmd_authCache_clear); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
} else { |
|
70
|
0
|
|
|
|
|
|
print "\n"; |
|
71
|
0
|
|
|
|
|
|
print "You want to cache username and password github ? [y or n] "; |
|
72
|
0
|
|
|
|
|
|
chomp($form_cache = <STDIN>); |
|
73
|
0
|
0
|
0
|
|
|
|
if ($form_cache eq 'y' or $form_cache eq 'Y') { |
|
74
|
0
|
|
|
|
|
|
system("$gitCmd_authCache --timeout=86400"); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} else { |
|
80
|
0
|
0
|
0
|
|
|
|
if ($name ne '' and $email ne '') { |
|
81
|
0
|
|
|
|
|
|
system("$gitCmd_name \"$name\""); |
|
82
|
0
|
|
|
|
|
|
system("$gitCmd_email \"$email\""); |
|
83
|
0
|
|
|
|
|
|
$r_gitset = 1; |
|
84
|
|
|
|
|
|
|
} else { |
|
85
|
0
|
|
|
|
|
|
$r_gitset = 0; |
|
86
|
0
|
|
|
|
|
|
print "git user.name or user.email not enter\n"; |
|
87
|
0
|
|
|
|
|
|
exit 0; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
print "\n"; |
|
91
|
0
|
|
|
|
|
|
print "You want to clear cache ? [y or n]"; |
|
92
|
0
|
|
|
|
|
|
chomp($form_cache = <STDIN>); |
|
93
|
0
|
0
|
0
|
|
|
|
if ($form_cache eq 'y' or $form_cache eq 'Y') { |
|
94
|
0
|
|
|
|
|
|
system($gitCmd_authCache_clear); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
1; |