File Coverage

blib/lib/BlankOnDev/Form/github.pm
Criterion Covered Total %
statement 15 42 35.7
branch 0 8 0.0
condition 0 6 0.0
subroutine 5 6 83.3
pod 0 1 0.0
total 20 63 31.7


line stmt bran cond sub pod time code
1             package BlankOnDev::Form::github;
2 1     1   7 use strict;
  1         2  
  1         30  
3 1     1   5 use warnings FATAL => 'all';
  1         3  
  1         40  
4              
5             # Import :
6 1     1   5 use Term::ReadKey;
  1         3  
  1         77  
7 1     1   6 use BlankOnDev::Rilis;
  1         7  
  1         24  
8 1     1   309 use BlankOnDev::command;
  1         2  
  1         197  
9              
10             # Version :
11             our $VERSION = '0.1005';
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 $confirmation;
20 0           my $home_dir = $ENV{"HOME"};
21 0           my $r_gitset;
22              
23             # Get Command :
24             # ----------------------------------------------------------------
25 0           my $get_cmd = BlankOnDev::command::github();
26 0           my $getGit_cmd = $get_cmd->{'git'};
27 0           my $gitCmd_name = $getGit_cmd->{'cfg-name'};
28 0           my $gitCmd_email = $getGit_cmd->{'cfg-email'};
29              
30             # Check file config github :
31 0 0         if (-e $home_dir.'/.gitconfig') {
32             # Form Confirmation :
33 0           print "\n\n";
34 0           print "You want reconfig github ? [y or n] ";
35 0           chomp($confirmation = <STDIN>);
36 0 0         if ($confirmation eq 'y') {
37              
38 0 0 0       if ($name ne '' and $email ne '') {
39 0           system("$gitCmd_name \"$name\"");
40 0           system("$gitCmd_email \"$email\"");
41 0           $r_gitset = 1;
42             } else {
43 0           $r_gitset = 0;
44 0           print "git user.name or user.email not enter\n";
45 0           exit 0;
46             }
47             }
48             } else {
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             1;