line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Padre::Plugin::YAML; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
148107
|
use v5.10.1; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
103
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
1722
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1173
|
use English qw( -no_match_vars ); # Avoids reg-ex performance penalty |
|
2
|
|
|
|
|
5905
|
|
|
2
|
|
|
|
|
14
|
|
8
|
2
|
|
|
2
|
|
2424
|
use Padre::Plugin (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Padre::Wx (); |
10
|
|
|
|
|
|
|
use Try::Tiny; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
13
|
|
|
|
|
|
|
use parent qw(Padre::Plugin); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Child modules we need to unload when disabled |
16
|
|
|
|
|
|
|
use constant CHILDREN => qw{ |
17
|
|
|
|
|
|
|
Padre::Plugin::YAML |
18
|
|
|
|
|
|
|
Padre::Plugin::YAML::Document |
19
|
|
|
|
|
|
|
Padre::Plugin::YAML::Syntax |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
####### |
23
|
|
|
|
|
|
|
# Called by padre to know the plugin name |
24
|
|
|
|
|
|
|
####### |
25
|
|
|
|
|
|
|
sub plugin_name { |
26
|
|
|
|
|
|
|
return Wx::gettext('YAML'); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
####### |
30
|
|
|
|
|
|
|
# Called by padre to check the required interface |
31
|
|
|
|
|
|
|
####### |
32
|
|
|
|
|
|
|
sub padre_interfaces { |
33
|
|
|
|
|
|
|
return ( |
34
|
|
|
|
|
|
|
'Padre::Plugin' => '0.94', |
35
|
|
|
|
|
|
|
'Padre::Document' => '0.94', |
36
|
|
|
|
|
|
|
'Padre::Wx' => '0.94', |
37
|
|
|
|
|
|
|
'Padre::Task::Syntax' => '0.94', |
38
|
|
|
|
|
|
|
'Padre::Logger' => '0.94', |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
######### |
43
|
|
|
|
|
|
|
# We need plugin_enable |
44
|
|
|
|
|
|
|
# as we have an external dependency |
45
|
|
|
|
|
|
|
######### |
46
|
|
|
|
|
|
|
sub plugin_enable { |
47
|
|
|
|
|
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
my $correct_yaml_install = 0; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Tests for externals used by Preference's |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
if ( $OSNAME =~ /Win32/i ) { |
53
|
|
|
|
|
|
|
try { |
54
|
|
|
|
|
|
|
if ( require YAML ) { |
55
|
|
|
|
|
|
|
$correct_yaml_install = 1; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
} else { |
59
|
|
|
|
|
|
|
try { |
60
|
|
|
|
|
|
|
if ( require YAML::XS ) { |
61
|
|
|
|
|
|
|
$correct_yaml_install = 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
return $correct_yaml_install; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
####### |
71
|
|
|
|
|
|
|
# Called by padre to know which document to register for this plugin |
72
|
|
|
|
|
|
|
####### |
73
|
|
|
|
|
|
|
sub registered_documents { |
74
|
|
|
|
|
|
|
return ( |
75
|
|
|
|
|
|
|
'text/x-yaml' => 'Padre::Plugin::YAML::Document', |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
####### |
80
|
|
|
|
|
|
|
# Called by padre to build the menu in a simple way |
81
|
|
|
|
|
|
|
####### |
82
|
|
|
|
|
|
|
sub menu_plugins_simple { |
83
|
|
|
|
|
|
|
my $self = shift; |
84
|
|
|
|
|
|
|
return $self->plugin_name => [ |
85
|
|
|
|
|
|
|
Wx::gettext('About...') => sub { |
86
|
|
|
|
|
|
|
$self->plugin_about; |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
]; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
####### |
92
|
|
|
|
|
|
|
# plugin_about |
93
|
|
|
|
|
|
|
####### |
94
|
|
|
|
|
|
|
sub plugin_about { |
95
|
|
|
|
|
|
|
my $self = shift; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# my $share = $self->plugin_directory_share or return; |
98
|
|
|
|
|
|
|
# my $file = File::Spec->catfile( $share, 'icons', '48x48', 'git.png' ); |
99
|
|
|
|
|
|
|
# return unless -f $file; |
100
|
|
|
|
|
|
|
# return unless -r $file; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
my $info = Wx::AboutDialogInfo->new; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# $info->SetIcon( Wx::Icon->new( $file, Wx::wxBITMAP_TYPE_PNG ) ); |
105
|
|
|
|
|
|
|
$info->SetName('Padre::Plugin::YAML'); |
106
|
|
|
|
|
|
|
$info->SetVersion($VERSION); |
107
|
|
|
|
|
|
|
$info->SetDescription( Wx::gettext('A Simple YAML syntax checker for Padre') ); |
108
|
|
|
|
|
|
|
$info->SetCopyright('(c) 2008-2013 The Padre development team'); |
109
|
|
|
|
|
|
|
$info->SetWebSite('http://padre.perlide.org/trac/wiki/PadrePluginYAML'); |
110
|
|
|
|
|
|
|
$info->AddDeveloper('Zeno Gantner '); |
111
|
|
|
|
|
|
|
$info->AddDeveloper('Kevin Dawson '); |
112
|
|
|
|
|
|
|
$info->AddDeveloper('Ahmad M. Zawawi '); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# $info->SetArtists( |
115
|
|
|
|
|
|
|
# [ 'Scott Chacon ', |
116
|
|
|
|
|
|
|
# 'Licence ' |
117
|
|
|
|
|
|
|
# ] |
118
|
|
|
|
|
|
|
# ); |
119
|
|
|
|
|
|
|
Wx::AboutBox($info); |
120
|
|
|
|
|
|
|
return; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
####### |
125
|
|
|
|
|
|
|
# Called by Padre when this plugin is disabled |
126
|
|
|
|
|
|
|
####### |
127
|
|
|
|
|
|
|
sub plugin_disable { |
128
|
|
|
|
|
|
|
my $self = shift; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# Unload all our child classes |
131
|
|
|
|
|
|
|
# TODO: Switch to Padre::Unload once Padre 0.96 is released |
132
|
|
|
|
|
|
|
for my $package (CHILDREN) { |
133
|
|
|
|
|
|
|
require Padre::Unload; |
134
|
|
|
|
|
|
|
Padre::Unload->unload($package); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
$self->SUPER::plugin_disable(@_); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
return 1; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
__END__ |