Created
March 25, 2014 22:26
-
-
Save carlosmcevilly/9772781 to your computer and use it in GitHub Desktop.
Remove most legal boilerplate from an Apple sample project. For testing/research purposes only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $path = $ENV{'XcodeProjectPath'}; | |
$path =~ s{(.*)/\w+\.xcodeproj}{"$1"}; | |
my $cmd = "/usr/bin/find $path -type f -name \"*.[mh]\" -print"; | |
my $files = qx($cmd); | |
my @files = split("\n", $files); | |
foreach my $file (@files) { | |
fix_file($file); | |
} | |
sub fix_file { | |
my $file = shift; | |
open(IN, $file) or die "unable to open $file for reading: $!"; | |
my @data = <IN>; | |
close(IN); | |
my $data = join('', @data); | |
my $start = "Disclaimer:\\s+(?:IMPORTANT:\\s+)?This Apple software"; | |
my $end = "POSSIBILITY OF SUCH DAMAGE\\."; | |
$data =~ s{\s*$start.*?$end\s*?(\n.*)}{$1}sg; | |
open(OUT, '>', $file) or die "unable to open $file for writing: $!"; | |
print OUT $data; | |
close(OUT); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment