| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::VTide::Command::Refresh; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2016-03-22 15:42:06 |
|
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
|
5
|
|
|
|
|
|
|
# $Id$ |
|
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
|
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
944
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
10
|
1
|
|
|
1
|
|
2552
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use version; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
5
|
|
|
12
|
1
|
|
|
1
|
|
59
|
use Carp; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
50
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use English qw/ -no_match_vars /; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
14
|
1
|
|
|
1
|
|
345
|
use YAML::Syck; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
406
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'App::VTide::Command::Run'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = version->new('1.0.4'); |
|
19
|
|
|
|
|
|
|
our $NAME = 'refresh'; |
|
20
|
|
|
|
|
|
|
our $OPTIONS = [ |
|
21
|
|
|
|
|
|
|
'force|f', |
|
22
|
|
|
|
|
|
|
'verbose|v+', |
|
23
|
|
|
|
|
|
|
]; |
|
24
|
0
|
|
|
0
|
1
|
|
sub details_sub { return ( $NAME, $OPTIONS )}; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub run { |
|
27
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# re-read sub-comand configs |
|
30
|
0
|
|
|
|
|
|
$self->vtide->_generate_sub_command; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# check that all the sessions still exist |
|
33
|
0
|
|
|
|
|
|
$self->clean_sessions(); |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub clean_sessions { |
|
39
|
0
|
|
|
0
|
1
|
|
my ( $self) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $file = $self->history; |
|
42
|
0
|
|
0
|
|
|
|
my $sessions = eval { LoadFile( $file ) } || {}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
for my $session (keys %{ $sessions->{sessions} }) { |
|
|
0
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $dir = ref $sessions->{sessions}{$session} |
|
46
|
|
|
|
|
|
|
? $sessions->{sessions}{$session}{dir} |
|
47
|
0
|
0
|
|
|
|
|
: $sessions->{sessions}{$session}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
0
|
0
|
|
|
|
if ( ! -d $dir || ! -f "$dir/.vtide.yml" ) { |
|
50
|
0
|
|
|
|
|
|
warn "$session ($dir) is missing\n"; |
|
51
|
0
|
|
|
|
|
|
$self->hooks->run('refresh_session_missing', $session, $dir); |
|
52
|
0
|
0
|
|
|
|
|
delete $sessions->{sessions}{$session} if $self->defaults->{force}; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
DumpFile( $file, $sessions ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub auto_complete { |
|
62
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
App::VTide::Command::Refresh - Refresh App::VTide configurations |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 VERSION |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This documentation refers to App::VTide::Command::Refresh version 1.0.4 |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
vtide refresh [-f|--force] |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
OPTIONS |
|
82
|
|
|
|
|
|
|
-f --force When sessions are mising this will force the removal of the reference |
|
83
|
|
|
|
|
|
|
-v --verbose Show environment as well as config |
|
84
|
|
|
|
|
|
|
--help Show this help |
|
85
|
|
|
|
|
|
|
--man Show the full man page |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head3 C<run ()> |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Run the command |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 C<clean_sessions ()> |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Clean up sessions which no longer exist. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 C<auto_complete ()> |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Auto completes sub-commands that can have help shown |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 C<details_sub ()> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns the commands details |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
There are no known bugs in this module. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Patches are welcome. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright (c) 2016 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
|
130
|
|
|
|
|
|
|
All rights reserved. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
|
133
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
|
134
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
135
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
136
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |