« blib/lib/auto/share/dist/Perl-Dist/default/perl-5.8.8/lib/ExtUtils/Install.pm
↑ Summary
blib/lib/Perl/Dist/Asset/Library.pm »
| 1 | package Perl::Dist::Inno::Script; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp qw{ croak }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Temp (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use IPC::Run3 (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Params::Util qw{ _STRING _IDENTIFIER }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Perl::Dist::Inno::File (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Perl::Dist::Inno::Icon (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Perl::Dist::Inno::Registry (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Perl::Dist::Inno::System (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use vars qw{$VERSION}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | $VERSION = '1.16'; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Object::Tiny qw{ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | app_id | ||||||||||||||||||||||||||||
| 23 | app_name | ||||||||||||||||||||||||||||
| 24 | app_publisher | ||||||||||||||||||||||||||||
| 25 | app_publisher_url | ||||||||||||||||||||||||||||
| 26 | default_group_name | ||||||||||||||||||||||||||||
| 27 | default_dir_name | ||||||||||||||||||||||||||||
| 28 | output_dir | ||||||||||||||||||||||||||||
| 29 | source_dir | ||||||||||||||||||||||||||||
| 30 | bin_compil32 | ||||||||||||||||||||||||||||
| 31 | 1 | }; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 0 | my $self = shift->SUPER::new(@_); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | # Apply defaults | ||||||||||||||||||||||||||||
| 37 | 0 | ▶ | unless ( defined $self->output_dir ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 0 | $self->{output_dir} = File::Spec->rel2abs( | |||||||||||||||||||||||||||
| 39 | File::Spec->curdir, | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | unless ( defined $self->default_group_name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | $self->{default_group_name} = $self->app_name; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # Check and default params | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | unless ( _IDENTIFIER($self->app_id) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | croak("Missing or invalid app_id param"); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | unless ( _STRING($self->app_name) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | croak("Missing or invalid app_name param"); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | unless ( _STRING($self->app_ver_name) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | croak("Missing or invalid app_ver_name param"); | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 0 | ▶ | unless ( _STRING($self->app_publisher) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 0 | croak("Missing or invalid app_publisher param"); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | unless ( _STRING($self->app_publisher_url) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | croak("Missing or invalid app_publisher_uri param"); | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | 0 | ▶ | unless ( _STRING($self->default_group_name) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | 0 | croak("Missing or invalid default_group_name param"); | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | unless ( _STRING($self->default_dir_name) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | croak("Missing or invalid default_dir_name"); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | unless ( _STRING($self->output_dir) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 0 | croak("Missing or invalid output_dir param"); | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | unless ( -d $self->output_dir ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 0 | croak("The output_dir " . $self->output_dir . "directory does not exist"); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | unless ( -w $self->output_dir ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 0 | croak("The output_dir directory is not writable"); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | unless ( _STRING($self->output_base_filename) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 0 | croak("Missing or invalid output_base_filename"); | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | unless ( _STRING($self->source_dir) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | croak("Missing or invalid source_dir param"); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 0 | ▶ | unless ( -d $self->source_dir ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 0 | croak("The source_dir directory does not exist"); | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | # Set ISS element collections | ||||||||||||||||||||||||||||
| 88 | 0 | $self->{files} = []; | |||||||||||||||||||||||||||
| 89 | 0 | $self->{icons} = []; | |||||||||||||||||||||||||||
| 90 | 0 | $self->{registry} = []; | |||||||||||||||||||||||||||
| 91 | 0 | $self->{system} = []; | |||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | # Find the compil32 program | ||||||||||||||||||||||||||||
| 94 | 0 | ▶ | unless ( $ENV{PROGRAMFILES} and -d $ENV{PROGRAMFILES} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ENV{"PROGRAMFILES"} and -d $ENV{"PROGRAMFILES"}
MC/DC0%0/2
$ENV{"PROGRAMFILES"} and -d $ENV{"PROGRAMFILES"}
$ENV{"PROGRAMFILES"}
-d $ENV{"PROGRAMFILES"}
Truth table0%0/3
A and B
A= $ENV{"PROGRAMFILES"}B= -d $ENV{"PROGRAMFILES"}
| |||||||||||||||||||||||||||||
| 95 | 0 | die("Failed to find the Program Files directory\n"); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | 0 | my $innosetup_dir = File::Spec->catdir( $ENV{PROGRAMFILES}, "Inno Setup 5" ); | |||||||||||||||||||||||||||
| 98 | 0 | my $innosetup_file = File::Spec->catfile( $innosetup_dir, 'Compil32.exe' ); | |||||||||||||||||||||||||||
| 99 | 0 | ▶ | unless ( -f $innosetup_file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 0 | die("Failed to find the Inno Setup Compil32.exe program"); | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | 0 | $self->{bin_compil32} = $innosetup_file; | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | return $self; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | # Default the versioned name to an unversioned name | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub app_ver_name { | ||||||||||||||||||||||||||
|
Subroutine
app_ver_name: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | $_[0]->{app_ver_name} or | ||||||||||||||||||||||||||||
| 110 | 0 | ▶ | $_[0]->app_name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | # Default the output filename to the id plus the current date | ||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub output_base_filename { | ||||||||||||||||||||||||||
|
Subroutine
output_base_filename: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 115 | $_[0]->{output_base_filename} or | ||||||||||||||||||||||||||||
| 116 | 0 | ▶ | $_[0]->app_id . '-' . $_[0]->output_date_string; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | # Convenience method | ||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub output_date_string { | ||||||||||||||||||||||||||
|
Subroutine
output_date_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 121 | 0 | my @t = localtime; | |||||||||||||||||||||||||||
| 122 | 0 | return sprintf( "%04d%02d%02d", $t[5] + 1900, $t[4] + 1, $t[3] ); | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub files { | ||||||||||||||||||||||||||
|
Subroutine
files: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 126 | 0 | return @{ $_[0]->{files} }; | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | sub icons { | ||||||||||||||||||||||||||
|
Subroutine
icons: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 130 | 0 | return @{ $_[0]->{icons} }; | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub registry { | ||||||||||||||||||||||||||
|
Subroutine
registry: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 134 | 0 | return @{ $_[0]->{registry} }; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 0 | ▶ | sub system { | ||||||||||||||||||||||||||
|
Subroutine
system: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 138 | 0 | return @{ $_[0]->{system} }; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | ##################################################################### | ||||||||||||||||||||||||||||
| 147 | # Main Methods | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub write_exe { | ||||||||||||||||||||||||||
|
Subroutine
write_exe: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 150 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | # Write out the .iss file | ||||||||||||||||||||||||||||
| 153 | 0 | my $content = $self->as_string; | |||||||||||||||||||||||||||
| 154 | 0 | my ($fh, $filename) = File::Temp::tempfile(); | |||||||||||||||||||||||||||
| 155 | 0 | $fh->print( $content ); | |||||||||||||||||||||||||||
| 156 | 0 | $fh->close; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | # Compile the .iss file | ||||||||||||||||||||||||||||
| 159 | 0 | my $cmd = [ | |||||||||||||||||||||||||||
| 160 | $self->bin_compil32, | ||||||||||||||||||||||||||||
| 161 | '/cc', | ||||||||||||||||||||||||||||
| 162 | $filename, | ||||||||||||||||||||||||||||
| 163 | ]; | ||||||||||||||||||||||||||||
| 164 | 0 | my $rv = IPC::Run3::run3( $cmd, \undef, \undef, \undef ); | |||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | # Return the name of the exe file generated | ||||||||||||||||||||||||||||
| 167 | 0 | my $output_exe = File::Spec->catfile( | |||||||||||||||||||||||||||
| 168 | $self->output_dir, | ||||||||||||||||||||||||||||
| 169 | $self->output_base_filename . '.exe', | ||||||||||||||||||||||||||||
| 170 | ); | ||||||||||||||||||||||||||||
| 171 | 0 | ▶ | unless ( -f $output_exe ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 0 | croak("Failed to find $output_exe"); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | return $output_exe; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | ##################################################################### | ||||||||||||||||||||||||||||
| 183 | # Manipulation Methods | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub add_file { | ||||||||||||||||||||||||||
|
Subroutine
add_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 186 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 187 | 0 | my $file = Perl::Dist::Inno::File->new(@_); | |||||||||||||||||||||||||||
| 188 | 0 | push @{$self->{files}}, $file; | |||||||||||||||||||||||||||
| 189 | 0 | return 1; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub add_dir { | ||||||||||||||||||||||||||
|
Subroutine
add_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 193 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 194 | 0 | my $name = shift; | |||||||||||||||||||||||||||
| 195 | 0 | $self->add_file( | |||||||||||||||||||||||||||
| 196 | source => "$name\\*", | ||||||||||||||||||||||||||||
| 197 | dest_dir => "{app}\\$name", | ||||||||||||||||||||||||||||
| 198 | recurse_subdirs => 1, | ||||||||||||||||||||||||||||
| 199 | create_all_subdirs => 1, | ||||||||||||||||||||||||||||
| 200 | ); | ||||||||||||||||||||||||||||
| 201 | 0 | return 1; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | sub add_icon { | ||||||||||||||||||||||||||
|
Subroutine
add_icon: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 205 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 206 | 0 | my $icon = Perl::Dist::Inno::Icon->new(@_); | |||||||||||||||||||||||||||
| 207 | 0 | push @{$self->{icons}}, $icon; | |||||||||||||||||||||||||||
| 208 | 0 | return 1; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 0 | ▶ | sub add_uninstall { | ||||||||||||||||||||||||||
|
Subroutine
add_uninstall: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 212 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 213 | 0 | my $name = $self->app_name; | |||||||||||||||||||||||||||
| 214 | 0 | $self->add_icon( | |||||||||||||||||||||||||||
| 215 | name => "{cm:UninstallProgram,$name}", | ||||||||||||||||||||||||||||
| 216 | filename => '{uninstallexe}', | ||||||||||||||||||||||||||||
| 217 | ); | ||||||||||||||||||||||||||||
| 218 | 0 | return 1; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub add_registry { | ||||||||||||||||||||||||||
|
Subroutine
add_registry: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 222 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 223 | 0 | my $registry = Perl::Dist::Inno::Registry->new(@_); | |||||||||||||||||||||||||||
| 224 | 0 | push @{$self->{registry}}, $registry; | |||||||||||||||||||||||||||
| 225 | 0 | return 1; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub add_env { | ||||||||||||||||||||||||||
|
Subroutine
add_env: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 229 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 230 | 0 | my $registry = Perl::Dist::Inno::Registry->env(@_); | |||||||||||||||||||||||||||
| 231 | 0 | push @{$self->{registry}}, $registry; | |||||||||||||||||||||||||||
| 232 | 0 | return 1; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub add_system { | ||||||||||||||||||||||||||
|
Subroutine
add_system: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 236 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 237 | 0 | my $system = Perl::Dist::Inno::System->new(@_); | |||||||||||||||||||||||||||
| 238 | 0 | push @{$self->{system}}, $system; | |||||||||||||||||||||||||||
| 239 | 0 | return 1; | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 0 | ▶ | sub add_run { | ||||||||||||||||||||||||||
|
Subroutine
add_run: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 243 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 244 | 0 | my $system = Perl::Dist::Inno::System->run(@_); | |||||||||||||||||||||||||||
| 245 | 0 | push @{$self->{system}}, $system; | |||||||||||||||||||||||||||
| 246 | 0 | return 1; | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub add_uninstallrun { | ||||||||||||||||||||||||||
|
Subroutine
add_uninstallrun: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 250 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 251 | 0 | my $system = Perl::Dist::Inno::System->uninstallrun(@_); | |||||||||||||||||||||||||||
| 252 | 0 | push @{$self->{system}}, $system; | |||||||||||||||||||||||||||
| 253 | 0 | return 1; | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | ##################################################################### | ||||||||||||||||||||||||||||
| 261 | # Serialization | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub as_string { | ||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 264 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 265 | 0 | my @lines = ( | |||||||||||||||||||||||||||
| 266 | '; Inno Setup Script for ' . $self->app_name, | ||||||||||||||||||||||||||||
| 267 | '; Generated by ' . ref($self), | ||||||||||||||||||||||||||||
| 268 | '', | ||||||||||||||||||||||||||||
| 269 | ); | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | # Add the setup area | ||||||||||||||||||||||||||||
| 272 | 0 | push @lines, ( | |||||||||||||||||||||||||||
| 273 | '[Setup]', | ||||||||||||||||||||||||||||
| 274 | '; Distribution Identification', | ||||||||||||||||||||||||||||
| 275 | 'AppName=' . $self->app_name, | ||||||||||||||||||||||||||||
| 276 | 'AppVerName=' . $self->app_ver_name, | ||||||||||||||||||||||||||||
| 277 | 'AppPublisher=' . $self->app_publisher, | ||||||||||||||||||||||||||||
| 278 | 'AppPublisherURL=' . $self->app_publisher_url, | ||||||||||||||||||||||||||||
| 279 | 'AppId=' . $self->app_id, | ||||||||||||||||||||||||||||
| 280 | '', | ||||||||||||||||||||||||||||
| 281 | '; Start Menu Icons', | ||||||||||||||||||||||||||||
| 282 | 'DefaultGroupName=' . $self->default_group_name, | ||||||||||||||||||||||||||||
| 283 | 'AllowNoIcons=' . 'yes', | ||||||||||||||||||||||||||||
| 284 | '', | ||||||||||||||||||||||||||||
| 285 | '; Installation Path (This is always hard-coded)', | ||||||||||||||||||||||||||||
| 286 | 'DefaultDirName=' . $self->default_dir_name, | ||||||||||||||||||||||||||||
| 287 | 'DisableDirPage=' . 'yes', | ||||||||||||||||||||||||||||
| 288 | '', | ||||||||||||||||||||||||||||
| 289 | '; Where the output goes', | ||||||||||||||||||||||||||||
| 290 | 'OutputDir=' . $self->output_dir, | ||||||||||||||||||||||||||||
| 291 | 'OutputBaseFilename=' . $self->output_base_filename, | ||||||||||||||||||||||||||||
| 292 | 'UsePreviousAppDir=' . 'no', | ||||||||||||||||||||||||||||
| 293 | '', | ||||||||||||||||||||||||||||
| 294 | '; Source location', | ||||||||||||||||||||||||||||
| 295 | 'SourceDir=' . $self->source_dir, | ||||||||||||||||||||||||||||
| 296 | '', | ||||||||||||||||||||||||||||
| 297 | '; Win2K or newer required', | ||||||||||||||||||||||||||||
| 298 | 'MinVersion=' . '4.0.950,4.0.1381', | ||||||||||||||||||||||||||||
| 299 | '', | ||||||||||||||||||||||||||||
| 300 | '; Miscellaneous settings', | ||||||||||||||||||||||||||||
| 301 | 'Compression=' . 'lzma', | ||||||||||||||||||||||||||||
| 302 | 'SolidCompression=' . 'yes', | ||||||||||||||||||||||||||||
| 303 | 'ChangesEnvironment=' . 'yes', | ||||||||||||||||||||||||||||
| 304 | '', | ||||||||||||||||||||||||||||
| 305 | '; Delete old install', | ||||||||||||||||||||||||||||
| 306 | '[InstallDelete]', | ||||||||||||||||||||||||||||
| 307 | 'Type: filesandordirs; Name: "' . $self->source_dir . '"', | ||||||||||||||||||||||||||||
| 308 | '', | ||||||||||||||||||||||||||||
| 309 | ); | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | # Start with only English for now | ||||||||||||||||||||||||||||
| 312 | 0 | push @lines, ( | |||||||||||||||||||||||||||
| 313 | '[Languages]', | ||||||||||||||||||||||||||||
| 314 | 'Name: eng; MessagesFile: compiler:Default.isl', | ||||||||||||||||||||||||||||
| 315 | '', | ||||||||||||||||||||||||||||
| 316 | ); | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | # Add the files to be installed | ||||||||||||||||||||||||||||
| 319 | 0 | push @lines, '[Files]'; | |||||||||||||||||||||||||||
| 320 | 0 | foreach my $file ( $self->files ) { | |||||||||||||||||||||||||||
| 321 | 0 | push @lines, $file->as_string; | |||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | 0 | push @lines, ''; | |||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | # Add the icons to be installed | ||||||||||||||||||||||||||||
| 326 | 0 | push @lines, '[Icons]'; | |||||||||||||||||||||||||||
| 327 | 0 | foreach my $icon ( $self->icons ) { | |||||||||||||||||||||||||||
| 328 | 0 | push @lines, $icon->as_string; | |||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | 0 | push @lines, ''; | |||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | # Add the registry entries to be added | ||||||||||||||||||||||||||||
| 333 | 0 | push @lines, '[Registry]'; | |||||||||||||||||||||||||||
| 334 | 0 | foreach my $registry ( $self->registry ) { | |||||||||||||||||||||||||||
| 335 | 0 | push @lines, $registry->as_string; | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | 0 | push @lines, ''; | |||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | # Add any (optional) entries for [Run] | ||||||||||||||||||||||||||||
| 340 | 0 | my @run = grep { $_->section eq 'Run' } $self->system; | |||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ( @run ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 342 | 0 | push @lines, '[Run]'; | |||||||||||||||||||||||||||
| 343 | 0 | foreach my $system ( @run ) { | |||||||||||||||||||||||||||
| 344 | 0 | push @lines, $system->as_string; | |||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | 0 | push @lines, ''; | |||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | # Add any (optional) entries for [UninstallRun] | ||||||||||||||||||||||||||||
| 350 | 0 | my @uninstall = grep { $_->section eq 'UninstallRun' } $self->system; | |||||||||||||||||||||||||||
| 351 | 0 | ▶ | if ( @uninstall ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 352 | 0 | push @lines, '[UninstallRun]'; | |||||||||||||||||||||||||||
| 353 | 0 | foreach my $system ( @uninstall ) { | |||||||||||||||||||||||||||
| 354 | 0 | push @lines, $system->as_string; | |||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||
| 356 | 0 | push @lines, ''; | |||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | # Combine it all | ||||||||||||||||||||||||||||
| 360 | 0 | return join "\n", @lines; | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 1 | 1; | |||||||||||||||||||||||||||