Created
September 9, 2016 12:46
-
-
Save lolgear/d92368af53ab1525c7a0f3410b02c374 to your computer and use it in GitHub Desktop.
when you have too many xcworkspaces in your project, you could gather them in a directory and put it in dock
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
# find ./AirkeyObjC -name '*.xcworkspace' | grep -v 'xcworkspace/' | grep -v 'xcodeproj' | perl -ln -MFile::Spec -MFile::Basename -e 'chomp; $old = $_; $_ = basename($_); $old = File::Spec->rel2abs($old); $new = File::Spec->rel2abs(qq(./AirkeyObjCProjects/$_)); $t = qx(ln -s $old $new); print $t;' | |
use File::Spec; | |
use File::Basename; | |
sub findInDirectory { | |
my $directory = shift; | |
[qx(find ./$directory -name '*.xcworkspace' | grep -v 'xcworkspace/' | grep -v 'xcodeproj')]; | |
} | |
sub copyProjects { | |
my $projects = shift; | |
my $directory = shift; | |
for my $project (map{chomp; $_}@$projects) { | |
my $old = $project; | |
$project = basename($project); | |
$old = File::Spec->rel2abs($old); | |
$new = File::Spec->rel2abs(qq(./$directory/$project)); | |
$t = qx(ln -s $old $new); | |
print $t; | |
} | |
} | |
sub MainWork { | |
my $in = shift; | |
my $out = shift; | |
die "cant find in $in directory\n" unless ($in); | |
die "cant find out $out directory\n" unless ($out); | |
print "start search in directory: $in\n"; | |
my $projects = findInDirectory($in); | |
print "find projects: @$projects\n"; | |
copyProjects($projects, $out); | |
} | |
MainWork(@ARGV); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment