Dear Reader,
We generally spend approximately half an hour to make a clone of any iOS Project. But today I am going to explain the easiest way in duplicating the projects.
- To run the below script, must verify whether your system has already installed the open-source software package Homebrew.
To check this run the below command in the terminal:
brew -v
If your system has installed the Homebrew, it will display the version installed like below
Now we move forward to the 2nd step.
- We need to install rename and ack formula using brew install command.
brew install rename
brew install ack
If you also want to check these formulas are already installed on your system. You can verify this using below commands in terminal.
which ack
which rename
It will give you the path of rename and ack formulas if you have already installed.
- Create a
.command
script file for below script. Follow below steps to create:
- Open TextEdit and create a new file
- Convert it to plain text by clicking Format > Make Plain Text
- Copy below script and paste to text file created in previous step. For example, you could do:
1234567 #! /bin/bashcd ~/Desktopmkdir WebkulFoldercd WebkulFolder- Run
chmod u+x ~/Desktop/myScriptFile.command
in your terminal, where~/Desktop/myScriptFile.command
is the path to your script andmyScriptFile
is the name of file. This will give the terminal permission to run the file.- You’re done! Double-click the file to run or drag over the terminal icon will also work.
I have mentioned an example here:
Points to remember:
- Do not provide the space between the app name
- Project output will be generated on the desktop.
Now run the below scripts and follow the steps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#! /bin/bash if [[ $(command -v brew) == "" ]]; then echo 'Please Install Homebrew First' echo 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"' elif [[ $(command which rename) == "" ]]; then echo 'Please Install Rename First' echo 'brew install rename' elif [[ $(command which ack) == "" ]]; then echo 'Please Install ACK First' echo 'brew install ack' else cd ~/Desktop echo Enter App Name... It must not contains any space read Appname echo Enter Git Https Path read gitpath git clone $gitpath $Appname cd ~/Desktop/$Appname intialName="$(basename $(find . -maxdepth 1 -name '*.xcodeproj'))" intialName=${intialName/.xcodeproj/''} find ~/Desktop/$Appname -name $intialName'*' -type d -execdir rename --subst-all $intialName $Appname '{}' \+ find ~/Desktop/$Appname -name $intialName'*' -print0 | xargs -0 rename --subst-all $intialName $Appname ack --literal --files-with-matches $intialName --print0 | xargs -0 sed -i '' 's/'$intialName'/'$Appname'/g' file=./Podfile if [ -e "$file" ]; then echo "File exists" pod deintegrate pod update open $Appname'.xcworkspace' else echo "Pod File does not exist" open $Appname'.xcodeproj' fi find . | grep .git | xargs rm -rf fi |
If you still face any issues, just comment below. I am waiting for your amazing feedback.