Skip to content

Instantly share code, notes, and snippets.

@ugexe
Created January 8, 2016 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugexe/afcbbf0c76220c150546 to your computer and use it in GitHub Desktop.
Save ugexe/afcbbf0c76220c150546 to your computer and use it in GitHub Desktop.
unless $dist.depends.first(/'panda' | 'Panda::'/)
|| $dist.build-depends.first(/'panda' | 'Panda::'/)
|| $dist.test-depends.first(/'panda' | 'Panda::'/) {
my $legacy-fixer-code = q:to/END_LEGACY_FIX/;
class Build {
method isa($what) {
return True if $what.^name eq 'Panda::Builder';
callsame;
}
END_LEGACY_FIX
my $legacy-code = $builder-path.IO.slurp;
$legacy-code.subst-mutate(/'use Panda::' \w+ ';'/, '', :g);
$legacy-code.subst-mutate('class Build is Panda::Builder {', "{$legacy-fixer-code}\n");
$builder-path = "{$builder-path.absolute}.zef".IO;
try { $builder-path.spurt($legacy-code) } || $builder-path.subst-mutate(/'.zef'$/, '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment