";
my $line_counter = 1;
foreach my $line ( split("\n", $raw_file) ) {
print $fh "$line_counter\t$line";
$line_counter++;
}
print $fh "
";
close $fh;
$logger->info("Generated line numbers for file");
return $html_file;
}
sub gen_diff_colors($$) {
my $raw_diff = shift;
my $logger = shift;
my $html_diff;
open my $fh, '>>', \$html_diff or die "Can't open variable: $!";
print $fh "";
my $line_counter = 1;
foreach my $line ( split("\n", $raw_diff) ) {
if ( $line =~ m/^\+/ ) {
print $fh "$line_counter\t$line";
} elsif ( $line =~ m/^\-/ ) {
print $fh "$line_counter\t$line";
} elsif ( $line =~ m/^@@/ ) {
print $fh "$line_counter\t$line";
} else {
print $fh "$line_counter\t$line";
}
$line_counter++;
}
print $fh "
";
close $fh;
return $html_diff;
}
# Main sub for generating project page
# Might make more sense to split into more subs?
sub write_project_content($$$$) {
my $project_dirs_ref = shift;
my $trimmed_project_dirs_ref = shift;
my $web_projects_dir = shift;
my $logger = shift;
# Make these array's easier to work with in a hash
# Key is path to actual git dir, val is path to associated web dir
my %projects_map;
@projects_map{@$project_dirs_ref} = @$trimmed_project_dirs_ref;
$logger->info("Assembling data structures of git info");
# Write files part of project index
foreach my $project_path ( keys %projects_map ) {
my $spec_web_dir = $web_projects_dir . $projects_map{$project_path};
my $project_index = $spec_web_dir . "index.html";
write_file("",$project_index);
append_file("