| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::bif::new::identity; |
|
2
|
41
|
|
|
41
|
|
8741
|
use strict; |
|
|
41
|
|
|
|
|
93
|
|
|
|
41
|
|
|
|
|
1286
|
|
|
3
|
41
|
|
|
41
|
|
257
|
use warnings; |
|
|
41
|
|
|
|
|
123
|
|
|
|
41
|
|
|
|
|
1472
|
|
|
4
|
41
|
|
|
41
|
|
224
|
use Bif::Mo; |
|
|
41
|
|
|
|
|
96
|
|
|
|
41
|
|
|
|
|
370
|
|
|
5
|
41
|
|
|
41
|
|
232
|
use Config::Tiny; |
|
|
41
|
|
|
|
|
92
|
|
|
|
41
|
|
|
|
|
1262
|
|
|
6
|
41
|
|
|
41
|
|
1013
|
use DBIx::ThinSQL qw/bv/; |
|
|
41
|
|
|
|
|
27865
|
|
|
|
41
|
|
|
|
|
364
|
|
|
7
|
41
|
|
|
41
|
|
30174
|
use IO::Prompt::Tiny qw/prompt/; |
|
|
41
|
|
|
|
|
21602
|
|
|
|
41
|
|
|
|
|
3355
|
|
|
8
|
41
|
|
|
41
|
|
257
|
use Path::Tiny qw/path/; |
|
|
41
|
|
|
|
|
86
|
|
|
|
41
|
|
|
|
|
33171
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.1.5_7'; |
|
11
|
|
|
|
|
|
|
extends 'App::bif'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub run { |
|
14
|
44
|
|
|
44
|
1
|
106
|
my $self = shift; |
|
15
|
44
|
|
|
|
|
269
|
my $opts = $self->opts; |
|
16
|
44
|
|
|
|
|
305
|
my $dbw = $self->dbw; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$dbw->txn( |
|
19
|
|
|
|
|
|
|
sub { |
|
20
|
42
|
|
|
42
|
|
4610
|
my $start = time; |
|
21
|
42
|
|
|
|
|
455
|
$self->pause_work; |
|
22
|
|
|
|
|
|
|
|
|
23
|
42
|
|
|
|
|
144
|
my $name = ''; |
|
24
|
42
|
|
|
|
|
96
|
my $email = ''; |
|
25
|
42
|
|
|
|
|
91
|
my $spacer = ''; |
|
26
|
|
|
|
|
|
|
|
|
27
|
42
|
100
|
|
|
|
192
|
if ( $opts->{self} ) { |
|
28
|
41
|
|
|
|
|
33819
|
print "Creating \"self\" identity:\n"; |
|
29
|
|
|
|
|
|
|
|
|
30
|
41
|
|
|
|
|
476
|
my $git_conf_file = |
|
31
|
|
|
|
|
|
|
path( File::HomeDir->my_home, '.gitconfig' ); |
|
32
|
41
|
|
50
|
|
|
3958
|
my $git_conf = Config::Tiny->read($git_conf_file) || {}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
41
|
|
50
|
|
|
4327
|
$name = $git_conf->{user}->{name} || 'Your Name'; |
|
35
|
41
|
|
50
|
|
|
268
|
$email = $git_conf->{user}->{email} || 'your@email.adddr'; |
|
36
|
|
|
|
|
|
|
|
|
37
|
41
|
|
|
|
|
233
|
$name =~ s/(^")|("$)//g; |
|
38
|
41
|
|
|
|
|
255
|
$email =~ s/(^")|("$)//g; |
|
39
|
|
|
|
|
|
|
|
|
40
|
41
|
|
|
|
|
176
|
$spacer = ' '; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
42
|
|
50
|
|
|
366
|
$opts->{name} ||= prompt( $spacer . 'Name:', $name ) |
|
|
|
|
66
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|| return $self->err( 'NameRequired', 'name is required' ); |
|
45
|
|
|
|
|
|
|
|
|
46
|
42
|
|
|
|
|
3190
|
my $short = join( '', $opts->{name} =~ m/(\b\w)/g ); |
|
47
|
42
|
|
50
|
|
|
379
|
$opts->{shortname} ||= prompt( $spacer . 'Short Name:', $short ) |
|
|
|
|
33
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|| return $self->err( 'NameRequired', 'shortname is required' ); |
|
49
|
|
|
|
|
|
|
|
|
50
|
42
|
|
50
|
|
|
2875
|
$opts->{method} ||= prompt( $spacer . 'Contact Method:', 'email' ) |
|
|
|
|
66
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|| return $self->err( 'MethodRequired', 'method is required' ); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$opts->{value} ||= |
|
54
|
42
|
|
50
|
|
|
2682
|
prompt( $spacer . 'Contact ' . ucfirst( $opts->{method} ) . ':', |
|
|
|
|
66
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$email ) |
|
56
|
|
|
|
|
|
|
|| return $self->err( 'ValueRequired', 'value is required' ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
42
|
|
100
|
|
|
2508
|
$opts->{message} ||= ''; |
|
59
|
42
|
|
|
|
|
434
|
$opts->{id} = $dbw->nextval('nodes'); |
|
60
|
42
|
|
|
|
|
13985
|
$opts->{ecm_id} = $dbw->nextval('nodes'); |
|
61
|
|
|
|
|
|
|
|
|
62
|
42
|
100
|
|
|
|
10944
|
if ( $opts->{self} ) { |
|
63
|
|
|
|
|
|
|
$opts->{change_id} = $self->new_change( |
|
64
|
|
|
|
|
|
|
author => $opts->{name}, |
|
65
|
|
|
|
|
|
|
author_contact => bv( $opts->{value}, DBI::SQL_VARCHAR ), |
|
66
|
|
|
|
|
|
|
author_contact_method => $opts->{method}, |
|
67
|
|
|
|
|
|
|
author_shortname => $opts->{shortname}, |
|
68
|
41
|
|
|
|
|
324
|
); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
else { |
|
71
|
1
|
|
|
|
|
12
|
$opts->{change_id} = $self->new_change(); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$dbw->xdo( |
|
75
|
|
|
|
|
|
|
insert_into => 'func_new_identity', |
|
76
|
|
|
|
|
|
|
values => { |
|
77
|
|
|
|
|
|
|
id => $opts->{id}, |
|
78
|
|
|
|
|
|
|
change_id => $opts->{change_id}, |
|
79
|
|
|
|
|
|
|
name => $opts->{name}, |
|
80
|
|
|
|
|
|
|
shortname => $opts->{shortname}, |
|
81
|
|
|
|
|
|
|
self => $opts->{self}, |
|
82
|
41
|
|
50
|
|
|
1051
|
bill => $opts->{bill} // 0, |
|
83
|
|
|
|
|
|
|
}, |
|
84
|
|
|
|
|
|
|
); |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$dbw->xdo( |
|
87
|
|
|
|
|
|
|
insert_into => 'func_new_identity_contact_method', |
|
88
|
|
|
|
|
|
|
values => { |
|
89
|
|
|
|
|
|
|
change_id => $opts->{change_id}, |
|
90
|
|
|
|
|
|
|
id => $opts->{ecm_id}, |
|
91
|
|
|
|
|
|
|
identity_id => $opts->{id}, |
|
92
|
|
|
|
|
|
|
method => $opts->{method}, |
|
93
|
|
|
|
|
|
|
mvalue => bv( $opts->{value}, DBI::SQL_VARCHAR ), |
|
94
|
41
|
|
50
|
|
|
114457
|
bill => $opts->{bill} // 0, |
|
95
|
|
|
|
|
|
|
}, |
|
96
|
|
|
|
|
|
|
); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$dbw->xdo( |
|
99
|
|
|
|
|
|
|
insert_into => 'func_update_identity', |
|
100
|
|
|
|
|
|
|
values => { |
|
101
|
|
|
|
|
|
|
change_id => $opts->{change_id}, |
|
102
|
|
|
|
|
|
|
id => $opts->{id}, |
|
103
|
|
|
|
|
|
|
contact_id => $opts->{id}, |
|
104
|
|
|
|
|
|
|
default_contact_method_id => $opts->{ecm_id}, |
|
105
|
|
|
|
|
|
|
}, |
|
106
|
41
|
|
|
|
|
90691
|
); |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
$self->save_new_work( |
|
109
|
|
|
|
|
|
|
change_id => $opts->{change_id}, |
|
110
|
|
|
|
|
|
|
node_id => $opts->{id}, |
|
111
|
41
|
|
|
|
|
75634
|
start => $start, |
|
112
|
|
|
|
|
|
|
stop => time, |
|
113
|
|
|
|
|
|
|
comment => "new identity", |
|
114
|
|
|
|
|
|
|
bill => 1, |
|
115
|
|
|
|
|
|
|
); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$self->end_change( |
|
118
|
|
|
|
|
|
|
id => $opts->{change_id}, |
|
119
|
|
|
|
|
|
|
message => $opts->{message}, |
|
120
|
|
|
|
|
|
|
action_format => "new identity %s " |
|
121
|
|
|
|
|
|
|
. "$opts->{name} ($opts->{shortname})", |
|
122
|
|
|
|
|
|
|
action_node_id_1 => $opts->{id}, |
|
123
|
41
|
|
|
|
|
75145
|
); |
|
124
|
|
|
|
|
|
|
|
|
125
|
41
|
|
|
|
|
413
|
$self->resume_work; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
42
|
|
|
|
|
454
|
); |
|
128
|
|
|
|
|
|
|
|
|
129
|
41
|
|
|
|
|
64424
|
return $self->ok('NewIdentity'); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
|
133
|
|
|
|
|
|
|
__END__ |