I am following a github repository. When I go to create the podfile using pod init the terminal says
[!] Existing Podfile found in directory
When I show the project in the finder, I see a pdfile as a exec instead of a text file so to speak.
Should I delete it and run pod init once more? What is the best way to successfully clone this github repo using cocoa pods?
Thats all right. You can open it via any text editor (like Sublime Text). Or just run pod install, open your Demo.xcworkspace and in Pods you will see your Podfile.So you can edit it directly from Xcode.
Related
Ive been trying to add a Xcode project to a repository on GitHub and it worked however the pods are not within the project and says they are missing. What is the proper way to add a project with the pods to GitHub?
It depends on what your project needs are.
Benefits of checking in the Pods directory
After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no need to run pod install, and no Internet connection is necessary.
The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.
Benefits of ignoring the Pods directory
The source control repo will be smaller and take up less space.
As long as the sources (e.g. GitHub) for all Pods are available, CocoaPods is generally able to recreate the same installation. (Technically there is no guarantee that running pod install will fetch and recreate identical artifacts when not using a commit SHA in the Podfile. This is especially true when using zip files in the Podfile.)
There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod versions.
Source
I personally have the following in my .gitignore file:
# CocoaPods
#
Pods/
If you want to create you own cocoapods with storyboards, XIBs, resources and with other frameworks such as Alamofire, MBProgressHUD etc.
Easy steps to create Cocoapod from existing xcode project
Create a repository on your git account (Repo name, check README,
choose MIT under license).
Copy the url of your repository.Open terminal and run following command.
git clone copied your repository url
Now copy your Xcode project inside the cloned repository folder on
your Mac. Now run following commands
git add -u to add all files (if not added use: git add filepath/folder)
git commit -m "your custom message"
git push origin master
Create a new release to go to your git repository or run following commands
git tag 1.0.0
git push --tags
First, we need to make sure that you have CocoaPods installed and
ready to use in your Terminal. run the following command:
sudo gem install cocoapods --pre
Creating a Podspec
All Pods have a podspec file. A podspec, as its name suggests,
defines the specifications of the Pod! Now let’s make one, run
following command on terminal
touch PodName.podspec
After adding and modifying your .podspec file. Validate your .podspec
file by hitting following command on terminal
pod lib lint
Once you validate it successfully without errors run following
command to register you and build cocoapod respectively
pod trunk register
pod trunk push PodName.podspec
If all goes well, you will get this on terminal
🚀 PodName (1.0.0) successfully published
📅 February 5th, 02:32
🌎 https://cocoapods.org/pods/PodName
👍 Tell your friends!
Yeah!!!!! congrats you have got your pod link. Use wherever you want to use it.
Here is some useful links . You can follow the same.
https://www.appcoda.com/cocoapods-making-guide/
https://www.raywenderlich.com/5823-how-to-create-a-cocoapod-in-swift
So I'm using a library that's been abandoned but I've made quite a few changes within its files under Pods. If the pods are reinstalled, the library won't work. What's the best practice for this sort of thing?
I have forked the project over and updated it with my changes.
Instead of having the line:
pod "PodToIntall"
I have
pod "PodToInstall", git: => "the url to my fork", branch: => "master"
If I try to pod install I get the error
[!] Unable to find a specification for 'PodToInstall'
The project is dead so if I can't get the owner to merge my changes is there any way to pull it off my github?
Check that all steps are done from the following list:
Change the source files from your forked pod project.
Commit it & push to GitHub (if pod is hosted here).
Update the Podfile within your main project to use forked pod.
Run in terminal pod update PodToInstall.
Also CocoaPods and GitHub forks might be useful.
I'm working on an Xcode project (Swift) that utilizes cocoapods. After completing my tasks, everything worked. I then committed and pushed to my GitHub repository. Then I downloaded the project as a zip from the repository to make sure everything was good. Everything looks fine, but the pods are not there. As a result, in the downloaded version the pods are in red. Is there any way to fix this?
(sorry if this is really simple, I'm just new to GitHub and I haven't found a solution anywhere online)
The question here is basically: How do I make everything compile after cloning/downloading my project.
It seems that you did not commit your Pods into your source control, so the short answer is: Just run pod install
If you want more details about wether you should commit your Pods or only your Podfile, and about Cocoapods in general, this guide is a good starting point.
When you push everything to github, you will need to check the “select all files”. so that your push to github actually sends the pod directory and the Podfile.lock.
Sometimes you need to manually go into the proj3ct directory in terminal and type “git add .” (Hope that’s the command)
Check your github repo and see if they exist and contain files.
You probably don’t have a .gitignore, but if you do, the. Make sure that you are not ignoring pod files. Otherwise they will never be written to the repository.
If the pod files are in the repo you shouldn’t need to do a pod install. But if all else fails, that’s what you need to do.
I have a nodejs app on openshift an one of the things the app does is write a text file.
Problem is, whenever I update code in the app and deploy it, the text file is gone because the live repo address has changed.
Is there a way using build hooks to get any files saved in a particular folder, add them to my git repo and then deploy the app? I'm not completely clear what I would write in a hook or what to save the hook as so any help would be awesome!
Thank you!
You need to store the file inside of your OPENSHIFT_DATA_DIR so that it will not get over-written each time. You can not copy the file into your git repo on the gear. You might want to try something like the WordPress cartridge does, which is create a symlink (using the deploy action hook) to create a folder in your repo dir that is linked to your OPENSHIFT_DATA_DIR (https://github.com/openshift/wordpress-example/blob/master/.openshift/action_hooks/deploy)