forked from PadreIDE/Padre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev
executable file
·166 lines (141 loc) · 3.73 KB
/
dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env perl
# This script is only used to run the application from
# its development location
#
# It should not be distributed on CPAN or downstream distributions
use 5.008005;
use strict;
use warnings;
use FindBin;
use Config;
# Collect options early
use Getopt::Long ();
use vars qw{
$USAGE
$DEBUG
$PROFILE
$PLUGINS
$FULLTRACE
$INVISIBLE
$USE
@INCLUDE
};
BEGIN {
$USAGE = 0;
$DEBUG = 0;
$PROFILE = 0;
$PLUGINS = 0;
$FULLTRACE = 0;
$INVISIBLE = 0;
@INCLUDE = ();
Getopt::Long::GetOptions(
'usage|help' => \$USAGE,
'debug|d' => \$DEBUG,
'profile' => \$PROFILE,
'a' => \$PLUGINS,
'fulltrace' => \$FULLTRACE,
'invisible' => \$INVISIBLE,
'include|i:s' => \@INCLUDE,
'use:s' => \$USE,
'trace:s' => sub {
$ENV{PADRE_DEBUG} = $_[1] || '1';
},
'die' => sub {
$ENV{PADRE_DIE} = 1;
},
) or $USAGE = 1;
}
$ENV{PADRE_DEV} = 1;
$ENV{PADRE_HOME} = $FindBin::Bin;
use lib $FindBin::Bin, "$FindBin::Bin/lib";
use privlib::Tools;
use File::Basename ();
use Locale::Msgfmt 0.15;
use Padre::Perl ();
# Due to share functionality, we must have run make
unless ( -d "$FindBin::Bin/blib" ) {
my $make = $Config::Config{make} || 'make';
error("You must now have run 'perl Makefile.PL' and '$make' in order to run dev");
}
vmsgfmt($FindBin::Bin);
my $perl =
( $^O eq 'MSWin32' )
? Padre::Perl::cperl()
: Padre::Perl::wxperl();
unless ($perl) {
error("Failed to find windowing Perl to run with");
}
my @cmd = (
qq[$perl],
qq[-I$FindBin::Bin/lib],
qq[-I$FindBin::Bin/blib/lib],
qq[-I$FindBin::Bin/blib/arch],
);
push @cmd, '-d:TraceUse'.($USE ? "=$USE" : '') if defined $USE;
push @cmd, '-MPadre::Test' if $INVISIBLE;
push @cmd, '-dt' if $DEBUG;
push @cmd, '-dt:NYTProf' if $PROFILE;
push @cmd, map {qq[-I$_]} @INCLUDE;
if ($FULLTRACE) {
eval { require Devel::Trace; };
if ($@) {
print "Error while initilizing --fulltrace while trying to load Devel::Trace:\n"
. "$@Maybe Devel::Trace isn't installed?\n";
exit(1);
}
push @cmd, '-d:Trace';
}
# Rebuild translations
if ($PLUGINS) {
print STDERR "WARNING: Doing nasty evil things to enable plugins from svn.\n";
print STDERR "Please always confirm if a bug exists without the -a option before reporting it.\n";
my $dir = File::Basename::dirname( $ENV{PADRE_HOME} );
$dir =~ s/\bbranches$/trunk/;
if ( opendir my $dh, $dir ) {
my @plugins = grep { $_ =~ /^Padre-Plugin-/ } readdir $dh;
foreach my $plugin (@plugins) {
( my $path = $plugin ) =~ s{-}{/}g;
if ( -d "$dir/$plugin/share/locale" ) {
vmsgfmt("$dir/$plugin");
} elsif ( -d "$dir/$plugin/lib/$path/share/locale" ) {
vmsgfmt("$dir/$plugin/lib/$path");
}
push @cmd, "-I$dir/$plugin/lib";
}
}
}
push @cmd, qq[$FindBin::Bin/script/padre], @ARGV;
push @cmd, '--help' if $USAGE;
if ($DEBUG) {
print "Running " . join( ' ', @cmd ) . "\n";
}
if ($USAGE) {
usage();
}
system(@cmd);
sub vmsgfmt {
msgfmt( { in => "$_[0]/share/locale/", verbose => 0 } );
}
sub error {
my $msg = shift;
$msg =~ s/\n$//s;
print "\nError:\n$msg\n\n";
exit(255);
}
sub usage {
print <<"END_USAGE";
Usage: $0
-h show this help
-d run Padre in the command line debugger (-d)
-t write tracing information to .padre/debug.log
-p profile using Devel::NYTProf
-a load all plugins in the svn checkout
--die add DIE handler
--fulltrace full sourcecode trace to STDERR
--use list loaded modules with Devel::TraceUse
--use=<opt> same with <opt> given as Devel::TraceUse options
LIST OF FILES list of files to open
The following Padre options are accepted if you put a -- between
$0 and Padre options (like "$0 --die -- --version"):
END_USAGE
}