Skip to content

Instantly share code, notes, and snippets.

@lyqflnh
Last active January 1, 2017 14:25
Show Gist options
  • Save lyqflnh/a63b2497535834d789652c5808f4f900 to your computer and use it in GitHub Desktop.
Save lyqflnh/a63b2497535834d789652c5808f4f900 to your computer and use it in GitHub Desktop.
automatically creat a podfile in your project directory, using project name according to the file: XXX.xcodeproj
#!/bin/bash
#-----
#根据项目名称(XXX.xcodeproj)创建podfile
#create a podfile by using the project name
#
#version:1.2
#create buy MQ on 17/01/01
#-----
#⚠️Note that work fine with project name contains space.
IFS=$'\n'
contentStr="xcodeproj"
allPaths=`ls`
for path in $allPaths
do
if [ -d $path ] && [ $path == *$contentStr ]
then
fileName=${path%.*}
break
fi
done
echo "platform :ios, '8.0'" > podfile
echo -e "" >> podfile
echo "target '$fileName' do" >> podfile
echo -e "" >> podfile
echo -e "" >> podfile
echo -e "" >> podfile
echo "end" >> podfile
open podfile
#USAGE:
#0.save this codes as a file named creatPodfile.sh
#1.enter your project directory
#2.open your shell program(eg:terminal), enter the project directory
#3.run the creatPodfile.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment