line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Padre::Plugin::Autodia; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Autodia UML creator plugin for Padre |
4
|
2
|
|
|
2
|
|
93707
|
use 5.010001; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
87
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
80
|
|
7
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
94
|
|
8
|
|
|
|
|
|
|
# turn of experimental warnings |
9
|
2
|
|
|
2
|
|
3789
|
no if $] > 5.017010, warnings => 'experimental::smartmatch'; |
|
2
|
|
|
|
|
22
|
|
|
2
|
|
|
|
|
11
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
1079
|
use Padre::Wx (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Padre::Constant (); |
15
|
|
|
|
|
|
|
use Padre::Current (); |
16
|
|
|
|
|
|
|
use Try::Tiny; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Cwd; |
19
|
|
|
|
|
|
|
use Autodia; |
20
|
|
|
|
|
|
|
use GraphViz; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use File::Find qw(find); |
23
|
|
|
|
|
|
|
use File::Spec; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use parent qw( |
26
|
|
|
|
|
|
|
Padre::Plugin |
27
|
|
|
|
|
|
|
Padre::Role::Task |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use Data::Printer {caller_info => 1, colored => 1,}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
####### |
33
|
|
|
|
|
|
|
# Called by padre to know the plugin name |
34
|
|
|
|
|
|
|
####### |
35
|
|
|
|
|
|
|
sub plugin_name { |
36
|
|
|
|
|
|
|
return Wx::gettext('Autodia UML Support'); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
######### |
40
|
|
|
|
|
|
|
# We need plugin_enable |
41
|
|
|
|
|
|
|
# as we have an external dependency autodia |
42
|
|
|
|
|
|
|
######### |
43
|
|
|
|
|
|
|
sub plugin_enable { |
44
|
|
|
|
|
|
|
my $self = shift; |
45
|
|
|
|
|
|
|
my $autodia_exists = 0; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
try { |
48
|
|
|
|
|
|
|
if (File::Which::which('dia')) { |
49
|
|
|
|
|
|
|
$autodia_exists = 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return $autodia_exists; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
####### |
57
|
|
|
|
|
|
|
# Called by padre to check the required interface |
58
|
|
|
|
|
|
|
####### |
59
|
|
|
|
|
|
|
sub padre_interfaces { |
60
|
|
|
|
|
|
|
return ( |
61
|
|
|
|
|
|
|
# Default, required |
62
|
|
|
|
|
|
|
'Padre::Plugin' => '0.96', |
63
|
|
|
|
|
|
|
'Padre::Task' => '0.96', |
64
|
|
|
|
|
|
|
'Padre::Unload' => '0.96', |
65
|
|
|
|
|
|
|
'Padre::Util' => '0.97', |
66
|
|
|
|
|
|
|
'Padre::Wx' => '0.96', |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Child modules we need to unload when disabled |
71
|
|
|
|
|
|
|
use constant CHILDREN => qw{ |
72
|
|
|
|
|
|
|
Padre::Plugin::Autodia |
73
|
|
|
|
|
|
|
Padre::Plugin::Autodia::Task::Autodia_cmd |
74
|
|
|
|
|
|
|
Padre::Plugin::Autodia::Task::Autodia_dia |
75
|
|
|
|
|
|
|
Autodia |
76
|
|
|
|
|
|
|
GraphViz |
77
|
|
|
|
|
|
|
}; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
####### |
80
|
|
|
|
|
|
|
# Add Plugin to Padre Menu |
81
|
|
|
|
|
|
|
####### |
82
|
|
|
|
|
|
|
sub menu_plugins_simple { |
83
|
|
|
|
|
|
|
my $self = shift; |
84
|
|
|
|
|
|
|
return $self->plugin_name => [ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Wx::gettext('About') => sub { |
87
|
|
|
|
|
|
|
# $self->show_about; |
88
|
|
|
|
|
|
|
# }, |
89
|
|
|
|
|
|
|
Wx::gettext('UML jpg') => [ |
90
|
|
|
|
|
|
|
Wx::gettext('Class Diagram (Current File jpg)') => sub { |
91
|
|
|
|
|
|
|
$self->draw_this_file; |
92
|
|
|
|
|
|
|
}, |
93
|
|
|
|
|
|
|
Wx::gettext('Class Diagram (select file jpg)') => sub { |
94
|
|
|
|
|
|
|
$self->draw_all_files; |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
], |
97
|
|
|
|
|
|
|
Wx::gettext('UML dia') => [ |
98
|
|
|
|
|
|
|
Wx::gettext('Project Class Diagram (jpg)') => sub { |
99
|
|
|
|
|
|
|
$self->project_jpg; |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
Wx::gettext('Project Class Diagram (dia)') => sub { |
102
|
|
|
|
|
|
|
$self->project_dia; |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
], |
105
|
|
|
|
|
|
|
Wx::gettext('About...') => sub { |
106
|
|
|
|
|
|
|
$self->plugin_about; |
107
|
|
|
|
|
|
|
}, |
108
|
|
|
|
|
|
|
]; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
my @files_found = (); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# http://docs.wxwidgets.org/stable/wx_wxfiledialog.html |
114
|
|
|
|
|
|
|
my $orig_wildcards = join('|', |
115
|
|
|
|
|
|
|
Wx::gettext("JavaScript Files"), "*.js;*.JS", |
116
|
|
|
|
|
|
|
Wx::gettext("Perl Files"), "*.pm;*.PM;*.pl;*.PL", |
117
|
|
|
|
|
|
|
Wx::gettext("PHP Files"), "*.php;*.php5;*.PHP", |
118
|
|
|
|
|
|
|
Wx::gettext("Python Files"), "*.py;*.PY", |
119
|
|
|
|
|
|
|
Wx::gettext("Ruby Files"), "*.rb;*.RB", |
120
|
|
|
|
|
|
|
Wx::gettext("SQL Files"), "*.slq;*.SQL", |
121
|
|
|
|
|
|
|
Wx::gettext("Text Files"), "*.txt;*.TXT;*.yml;*.conf;*.ini;*.INI", |
122
|
|
|
|
|
|
|
Wx::gettext("Web Files"), "*.html;*.HTML;*.htm;*.HTM;*.css;*.CSS", |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# get language and wildcard |
126
|
|
|
|
|
|
|
my $languages = { |
127
|
|
|
|
|
|
|
Javascript => [qw/.js .JS/], |
128
|
|
|
|
|
|
|
Perl => [qw/.pm .PM .pl .PL .t/], |
129
|
|
|
|
|
|
|
PHP => [qw/.php .php3 .php4 .php5 .PHP/], |
130
|
|
|
|
|
|
|
}; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $wildcards = join( |
133
|
|
|
|
|
|
|
'|', |
134
|
|
|
|
|
|
|
map { |
135
|
|
|
|
|
|
|
sprintf(Wx::gettext("%s Files"), $_) => |
136
|
|
|
|
|
|
|
join(';', map { "*$_", @{$languages->{$_}} }) |
137
|
|
|
|
|
|
|
} sort keys %$languages |
138
|
|
|
|
|
|
|
); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
$wildcards |
141
|
|
|
|
|
|
|
.= (Padre::Constant::WIN32) |
142
|
|
|
|
|
|
|
? Wx::gettext("All Files") . "|*.*|" |
143
|
|
|
|
|
|
|
: Wx::gettext("All Files") . "|*|"; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub draw_this_file { |
147
|
|
|
|
|
|
|
my $self = shift; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
my $document = $self->current->document or return; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
my $filename = $document->filename || $document->tempfile; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
my $outfile = "${filename}.draw_this_file.jpg"; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
(my $language = lc($document->mimetype)) =~ s|application/[x\-]*||; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
my $autodia_handler = $self->_get_handler( |
158
|
|
|
|
|
|
|
{ |
159
|
|
|
|
|
|
|
filenames => [$filename], |
160
|
|
|
|
|
|
|
outfile => $outfile, |
161
|
|
|
|
|
|
|
graphviz => 1, |
162
|
|
|
|
|
|
|
language => $language |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
my $processed_files = $autodia_handler->process(); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
$autodia_handler->output(); |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Padre::Wx::launch_browser("file://$outfile"); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
return; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub draw_all_files { |
176
|
|
|
|
|
|
|
my $self = shift; |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $directory = Cwd::getcwd(); |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
# show dialog, get files |
181
|
|
|
|
|
|
|
my $dialog = Wx::FileDialog->new( |
182
|
|
|
|
|
|
|
Padre->ide->wx->main, |
183
|
|
|
|
|
|
|
Wx::gettext('Open File'), |
184
|
|
|
|
|
|
|
$directory, '', $wildcards, Wx::wxFD_MULTIPLE, |
185
|
|
|
|
|
|
|
); |
186
|
|
|
|
|
|
|
if ($dialog->ShowModal == Wx::wxID_CANCEL) { |
187
|
|
|
|
|
|
|
return; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
$directory = $dialog->GetDirectory; |
191
|
|
|
|
|
|
|
my @filenames = map {"$directory/$_"} $dialog->GetFilenames; |
192
|
|
|
|
|
|
|
p @filenames; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
# get language for first file |
195
|
|
|
|
|
|
|
my $language = 'perl'; |
196
|
|
|
|
|
|
|
foreach my $this_language (keys %$languages) { |
197
|
|
|
|
|
|
|
if (grep { $filenames[0] =~ m/$_$/ } @{$languages->{$this_language}}) { |
198
|
|
|
|
|
|
|
$language = lc($this_language); |
199
|
|
|
|
|
|
|
last; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
# run autodia on files |
204
|
|
|
|
|
|
|
my $outfile = Cwd::getcwd() . "/padre.draw_these_files.jpg"; |
205
|
|
|
|
|
|
|
my $autodia_handler = $self->_get_handler( |
206
|
|
|
|
|
|
|
{ |
207
|
|
|
|
|
|
|
filenames => \@filenames, |
208
|
|
|
|
|
|
|
outfile => $outfile, |
209
|
|
|
|
|
|
|
graphviz => 1, |
210
|
|
|
|
|
|
|
language => $language |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
); |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
my $processed_files = $autodia_handler->process(); |
215
|
|
|
|
|
|
|
$autodia_handler->output(); |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# display generated output in browser |
218
|
|
|
|
|
|
|
Padre::Wx::launch_browser("file://$outfile"); |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
return; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub _get_handler { |
224
|
|
|
|
|
|
|
my $self = shift; |
225
|
|
|
|
|
|
|
my $args = shift; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $config = { |
228
|
|
|
|
|
|
|
language => $args->{language}, |
229
|
|
|
|
|
|
|
graphviz => $args->{graphviz} || 0, |
230
|
|
|
|
|
|
|
use_stdout => 0, |
231
|
|
|
|
|
|
|
filenames => $args->{filenames} |
232
|
|
|
|
|
|
|
}; |
233
|
|
|
|
|
|
|
$config->{templatefile} = $args->{template} || undef; |
234
|
|
|
|
|
|
|
$config->{outputfile} = $args->{outfile} || "autodia-plugin.out"; |
235
|
|
|
|
|
|
|
p $config; |
236
|
|
|
|
|
|
|
# unless ($language_handlers) { |
237
|
|
|
|
|
|
|
my $language_handlers = Autodia->getHandlers(); |
238
|
|
|
|
|
|
|
p $language_handlers; |
239
|
|
|
|
|
|
|
# } |
240
|
|
|
|
|
|
|
my $handler_module = $language_handlers->{lc($args->{language})}; |
241
|
|
|
|
|
|
|
p $handler_module; |
242
|
|
|
|
|
|
|
eval { require $handler_module } |
243
|
|
|
|
|
|
|
or die "can't run '$handler_module' : $@\n"; |
244
|
|
|
|
|
|
|
my $handler = "$handler_module"->new($config); |
245
|
|
|
|
|
|
|
p $handler; |
246
|
|
|
|
|
|
|
return $handler; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
####### |
250
|
|
|
|
|
|
|
# Add icon to Plugin |
251
|
|
|
|
|
|
|
####### |
252
|
|
|
|
|
|
|
sub plugin_icon { |
253
|
|
|
|
|
|
|
my $class = shift; |
254
|
|
|
|
|
|
|
my $share = $class->plugin_directory_share or return; |
255
|
|
|
|
|
|
|
my $file = File::Spec->catfile($share, 'icons', '16x16', 'dia.png'); |
256
|
|
|
|
|
|
|
return unless -f $file; |
257
|
|
|
|
|
|
|
return unless -r $file; |
258
|
|
|
|
|
|
|
return Wx::Bitmap->new($file, Wx::wxBITMAP_TYPE_PNG); |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
######## |
262
|
|
|
|
|
|
|
# plugin_disable |
263
|
|
|
|
|
|
|
######## |
264
|
|
|
|
|
|
|
sub plugin_disable { |
265
|
|
|
|
|
|
|
my $self = shift; |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# Close the dialog if it is hanging around |
268
|
|
|
|
|
|
|
# $self->clean_dialog; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
# Unload all our child classes |
271
|
|
|
|
|
|
|
for my $package (CHILDREN) { |
272
|
|
|
|
|
|
|
require Padre::Unload; |
273
|
|
|
|
|
|
|
Padre::Unload->unload($package); |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
$self->SUPER::plugin_disable(@_); |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
return 1; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
####### |
282
|
|
|
|
|
|
|
# plugin_about |
283
|
|
|
|
|
|
|
####### |
284
|
|
|
|
|
|
|
sub plugin_about { |
285
|
|
|
|
|
|
|
my $self = shift; |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
my $share = $self->plugin_directory_share or return; |
288
|
|
|
|
|
|
|
my $file = File::Spec->catfile($share, 'icons', '48x48', 'dia.png'); |
289
|
|
|
|
|
|
|
return unless -f $file; |
290
|
|
|
|
|
|
|
return unless -r $file; |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
my $info = Wx::AboutDialogInfo->new; |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
$info->SetIcon(Wx::Icon->new($file, Wx::wxBITMAP_TYPE_PNG)); |
295
|
|
|
|
|
|
|
$info->SetName('Padre::Plugin::Autodia'); |
296
|
|
|
|
|
|
|
$info->SetVersion($VERSION); |
297
|
|
|
|
|
|
|
$info->SetDescription( |
298
|
|
|
|
|
|
|
Wx::gettext('Generate UML Class documentation for Dia')); |
299
|
|
|
|
|
|
|
$info->SetCopyright('(c) 2008-2012 The Padre development team'); |
300
|
|
|
|
|
|
|
$info->SetWebSite('http://padre.perlide.org/'); |
301
|
|
|
|
|
|
|
$info->AddDeveloper('Kevin Dawson '); |
302
|
|
|
|
|
|
|
$info->AddDeveloper('Ahmad M. Zawawi '); |
303
|
|
|
|
|
|
|
$info->AddDeveloper('Aaron Trevena '); |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# $info->SetArtists( |
306
|
|
|
|
|
|
|
# [ 'Scott Chacon ', |
307
|
|
|
|
|
|
|
# 'Licence ' |
308
|
|
|
|
|
|
|
# ] |
309
|
|
|
|
|
|
|
# ); |
310
|
|
|
|
|
|
|
Wx::AboutBox($info); |
311
|
|
|
|
|
|
|
return; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
### |
315
|
|
|
|
|
|
|
# End of Padre API Methods |
316
|
|
|
|
|
|
|
###### |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
sub class_dia { |
320
|
|
|
|
|
|
|
my $self = shift; |
321
|
|
|
|
|
|
|
my $main = $self->main; |
322
|
|
|
|
|
|
|
my $document = $main->current->document; |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# $document->filename |
325
|
|
|
|
|
|
|
return; |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
sub project_jpg { |
329
|
|
|
|
|
|
|
my $self = shift; |
330
|
|
|
|
|
|
|
my $main = $self->main; |
331
|
|
|
|
|
|
|
my $document = $main->current->document; |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
my $language = 'perl'; |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
# $document->project_dir =~ /\/(?\w+)$/; |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
# my $outfile = File::Spec->catfile( $document->project_dir, "$+{project}.jpg" ); |
338
|
|
|
|
|
|
|
my @project_dir = File::Spec->splitdir($document->project_dir); |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
my $outfile |
341
|
|
|
|
|
|
|
= File::Spec->catfile($document->project_dir, "$project_dir[-1].jpg"); |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
require Padre::Plugin::Autodia::Task::Autodia_cmd; |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
# # Fire the task |
346
|
|
|
|
|
|
|
$self->task_request( |
347
|
|
|
|
|
|
|
task => 'Padre::Plugin::Autodia::Task::Autodia_cmd', |
348
|
|
|
|
|
|
|
action => 'autodia.pl -d lib -r -z ', |
349
|
|
|
|
|
|
|
outfile => $outfile, |
350
|
|
|
|
|
|
|
language => $language, |
351
|
|
|
|
|
|
|
project_dir => $document->project_dir, |
352
|
|
|
|
|
|
|
on_finish => 'on_finish', |
353
|
|
|
|
|
|
|
); |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
return; |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
sub project_dia { |
360
|
|
|
|
|
|
|
my $self = shift; |
361
|
|
|
|
|
|
|
my $main = $self->main; |
362
|
|
|
|
|
|
|
my $document = $main->current->document; |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
# get language for first file |
365
|
|
|
|
|
|
|
my $language = 'perl'; |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
# $document->project_dir =~ /\/(?\w+)$/; |
368
|
|
|
|
|
|
|
# my @project_dir = File::Spec->splitdir( $document->project_dir ); |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
my $outfile |
371
|
|
|
|
|
|
|
= File::Spec->catfile($document->project_dir, "autodia.out.dia"); |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
require Padre::Plugin::Autodia::Task::Autodia_dia; |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
# Fire the task |
376
|
|
|
|
|
|
|
$self->task_request( |
377
|
|
|
|
|
|
|
task => 'Padre::Plugin::Autodia::Task::Autodia_dia', |
378
|
|
|
|
|
|
|
action => 'autodia.pl -d lib -r -K -o', |
379
|
|
|
|
|
|
|
outfile => $outfile, |
380
|
|
|
|
|
|
|
language => $language, |
381
|
|
|
|
|
|
|
project_dir => $document->project_dir, |
382
|
|
|
|
|
|
|
on_finish => 'on_finish', |
383
|
|
|
|
|
|
|
); |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
return; |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
sub project_files { |
389
|
|
|
|
|
|
|
my $self = shift; |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
my $file = $File::Find::name; |
392
|
|
|
|
|
|
|
return if $file =~ /\.[svn|git]/; |
393
|
|
|
|
|
|
|
return if $file !~ /\.p[lm]$/; |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
push @files_found, $file; |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
return; |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
####### |
401
|
|
|
|
|
|
|
# on compleation of task do this |
402
|
|
|
|
|
|
|
####### |
403
|
|
|
|
|
|
|
sub on_finish { |
404
|
|
|
|
|
|
|
my $self = shift; |
405
|
|
|
|
|
|
|
my $task = shift; |
406
|
|
|
|
|
|
|
my $main = $self->main; |
407
|
|
|
|
|
|
|
my $output = $main->output; |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
$main->show_output(1); |
410
|
|
|
|
|
|
|
$output->clear; |
411
|
|
|
|
|
|
|
$output->AppendText($task->{output}); |
412
|
|
|
|
|
|
|
$output->AppendText("Ouput written to -> $task->{outfile}"); |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
given ($task->{outfile}) { |
415
|
|
|
|
|
|
|
when (/.jpg$/) { Padre::Wx::launch_browser("file://$task->{outfile}") } |
416
|
|
|
|
|
|
|
when (/.dia$/) { system "dia", $task->{outfile} } |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
p $task; |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
return; |
422
|
|
|
|
|
|
|
} |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
1; |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
__END__ |