1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/usr/bin/perl
- use strict;
- use warnings;
- my $pwd = `echo \$PWD`;
- chomp $pwd;
- print "PWD is: $pwd\n";
- sub find_origin {
- my $path = shift;
- my $configFile = $path . "config";
- if ( -f $configFile ) {
- my $origin = `cat $configFile | grep url | awk {'print \$3}'`;
- chomp $origin;
- my $replaceSite = "spwbk.site:";
- if ( $origin =~ m/@(.*)\:/ ) {
- if ( $1 ne "spwbk.site" ) {
- print "$path has origin: $origin that does not match spwbk.site\n";
- print "cd'ing into $path...\n";
- my $replaceCmd = "sed -i s?$1:spesk1/?$replaceSite?g $configFile";
- print "Using sed to replace $1 with spwbk.site -> $replaceCmd\n";
- my $output = `$replaceCmd`;
- chomp $output;
- print "Output was: $output\n";
- }
- }
- }
- }
- sub find_git {
- my $path = shift;
- my $gitDirPath = $path . ".git/";
- if ( -d $gitDirPath ) {
- find_origin($gitDirPath);
- }
- }
- foreach my $dir ( split("\n",`ls -d */`) ) {
- chomp $dir;
- find_git($dir);
- }
|