[Pharo] Personal fitness tracker web app.
Use perltidy and update deployment script.
deploy.pl
@@ -1,7 +1,7 @@
1
1
#!/usr/bin/perl
2
2
# -*- mode: cperl; -*-
3
3
4
Removed:
use 5.38.2;
4
Added:
use 5.40.2;
5
5
use strict;
6
6
use warnings;
7
7
@@ -36,14 +36,12 @@
36
36
37
37
my ( $source, $destination ) = @ARGV;
38
38
if ( not defined $source ) {
39
Removed:
pod2usage "No development image specified.";
39
Added:
pod2usage "No development image specified.";
40
Added:
} elsif ( not -e $source ) {
41
Added:
pod2usage "$source does not exist.";
42
Added:
} elsif ( not defined $destination ) {
43
Added:
pod2usage "No destination host specified.";
40
44
}
41
Removed:
elsif ( not -e $source ) {
42
Removed:
pod2usage "$source does not exist.";
43
Removed:
}
44
Removed:
elsif ( not defined $destination ) {
45
Removed:
pod2usage "No destination host specified.";
46
Removed:
}
47
45
48
46
my $iso8601 = strftime '%Y-%m-%dT%H:%M:%SZ', localtime;
49
47
@@ -55,37 +53,35 @@
55
53
open my $fh, '<', "${path_devel}/pharo.version";
56
54
chomp( my $pharo_version = <$fh> );
57
55
close $fh;
58
Removed:
print "Pharo version for $image_devel is $pharo_version.\n";
56
Added:
say "Pharo version for $image_devel is $pharo_version.";
59
57
my $pharo_vm = $ENV{HOME} . "/Pharo/vms/${pharo_version}-x64/pharo";
60
58
if ( -x $pharo_vm ) {
61
Removed:
print "Found Pharo VM $pharo_vm.\n";
59
Added:
say "Found Pharo VM $pharo_vm.";
60
Added:
} else {
61
Added:
die "$pharo_vm is not a valid Pharo VM executable path";
62
62
}
63
Removed:
else {
64
Removed:
die "$pharo_vm is not a valid Pharo VM executable path";
65
Removed:
}
66
63
67
64
# Staging image
68
65
69
66
make_path $path_staging or die $!;
70
Removed:
print "Copying development image $image_devel to staging image...\n";
67
Added:
say "Copying development image $image_devel to staging image...";
71
68
copy "${path_devel}/${image_devel}", "${path_staging}/${image_staging}"
72
69
or die $!;
73
70
74
71
my $script = "MFTUtils createDeploymentImage";
75
Removed:
print "Building staging image at $path_staging...\n";
72
Added:
say "Building staging image at $path_staging...";
76
73
system "$pharo_vm --headless ${path_staging}/${image_staging} eval $script";
77
74
if ($?) {
78
Removed:
die "Failed to build staging image";
75
Added:
die "Failed to build staging image";
76
Added:
} else {
77
Added:
say "Staging image built at ${path_staging}/${image_staging}.";
79
78
}
80
Removed:
else {
81
Removed:
print "Staging image built at ${path_staging}/${image_staging}.\n";
82
Removed:
}
83
79
84
80
# Production image
85
81
86
82
my $image_prod = "${destination}:/var/www/myfitnesstracker.io/${image_staging}";
87
83
88
Removed:
print "Deploying production image at $image_prod...\n";
84
Added:
say "Deploying production image at $image_prod...";
89
85
system 'rsync', qw( --verbose --progress --human-readable --compress ),
90
86
"${path_staging}/${image_staging}", $image_prod;
91
87
@@ -99,4 +95,4 @@
99
95
# print "Successfully restarted mft.service on $destination.\n"
100
96
# }
101
97
102
Removed:
print "$image_devel successfully deployed to $image_prod.\n"
98
Added:
say "$image_devel successfully deployed to $image_prod."