What is the correct way to change the repo on a podspec? - frameworks

I created my first cocoapod from a personal repo, and deployed it to cocoapods via the pod trunk push command. Since it is my first framework, I wanted to develop it on a personal repo to keep my messy commits private. Now that the product is ready, I need to migrate the work over to an open source repo, and update the cocoapod's source.
I tried changing the s.homepage and s.source lines of the podspec, but I get this fatal: Remote branch 1.0.0 not found in upstream origin error.
Updating spec repo `master`
Validating podspec
-> EvolvKit (1.0.0)
- ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone https://github.com/evolv-ai/EvolvKit.git /var/folders/jb/xlkpf4sn6fl9wtsh3g7pkqrh0000gp/T/d20190729-87754-7w53ir --template= --single-branch --depth 1 --branch 1.0.0
Cloning into '/var/folders/jb/xlkpf4sn6fl9wtsh3g7pkqrh0000gp/T/d20190729-87754-7w53ir'...
warning: Could not find remote branch 1.0.0 to clone.
fatal: Remote branch 1.0.0 not found in upstream origin
) during validation.
[!] The spec did not pass validation, due to 1 error and 1 warning.
➜ EvolvKit git:(master)
old pod spec:
Pod::Spec.new do |s|
# more configs
s.homepage = 'https://github.com/<personal_repo>/EvolvKit'
s.license = { :type => 'APACHE', :file => 'LICENSE' }
s.author = { 'PhyllisWong' => 'phyllis.wong#evolv.ai' }
s.source = { :git => 'https://github.com/<personal_repo>/EvolvKit.git', :tag => s.version.to_s }
# more configs
end
The new podspec lines changed:
s.homepage = 'https://github.com/<opensource_repo>/EvolvKit'
s.source = { :git => 'https://github.com/<opensource_repo>/EvolvKit.git', :tag => s.version.to_s }
Some things I tried are:
0. update git tag with version 1.0.0
1. updating the urls in the pod spec
2. clone the repo into a new directory, create a new git repo, and follow steps to trunk push
3. deleting the pod (was only able to delete versions) ...no one is using this pod btw.
4. considered changing the pod name, but that is less than ideal
Any ideas about a good way to go forward is greatly appreciated.
edit
Turns out I was missing a step in updating my repo with the git tag. Needed to push the tags.

Building off of my above comment about tagging the branch, did you git push --tags as well? Applying tags is a two step process, and without both, you can get the above error.

Related

When using yarn-berry, should I apply the unplugged to the git repository when implementing zero-installs?

When using yarn-berry, should I apply the unplugged to the git repository when implementing zero-installs?
As far as I know, in the case of zero-installs, we proceed with yarn start immediately after receiving
git clone from the git repository.
However, because of the Unplugged Folder, we have to proceed with yarn installs inevitably.
Of course, there are ways to put UnpluggedFolder in git repository using git-ignore, but I'm not sure if this is the correct way to run zero-installs.
When I tried yarnstart
$ yarn start
C:\Users\com\Desktop\zero3\project\.pnp.cjs:25991
Error.captureStackTrace(firstError);
^
Error: Required unplugged package missing from disk. This may happen when switching branches without running unplugged packages must be fully materialized on disk to work).
Missing package: open#npm:8.4.0
Expected package location: C:\Users\com\Desktop\zero3\project\.yarn\unplugged\open-npm-8.4.0-df63cfe5dules\open\
gitignore
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# !.yarn/unplugged

Deployment Failure - Adding submodule issues - Using Netlify

I am trying to deploy my site to Netlify, when I try to trigger deployment, I am getting this error:
1:46:02 PM: Error checking out submodules: fatal: No url found for submodule path 'startbootstrap-grayscale' in .gitmodules
1:46:02 PM: Failing build: Failed to prepare repo
1:46:02 PM: failed during stage 'preparing repo': Error checking out submodules: fatal: No url found for submodule path 'startbootstrap-grayscale' in .gitmodules
My Folder directory is the one I want to deploy and these are the contents within that directory.
LICENSE node_modules
README.md package-lock.json
css package.json
gulpfile.js scss
img startbootstrap-grayscale
index.html vendor
js
As you can see, the error is pointing to the startbootstrap-grayscale directory.
Within that startbootstrap-grayscale directory, everything you see above is within that same directory. (Not sure what I did there to have that happen). If I cd into the 2nd startbootstrap-grayscale directory, there is nothing inside of it.
I was told that I need to git submodule add <my github name> but am not sure what else to add in order to resolve this issue.
git submodule add -f asks for more info:
usage: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: git submodule [--quiet] init [--] [<path>...]
or: git submodule [--quiet] deinit [-f|--force] (--all| [--] <path>...)
or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference <repository>] [--recursive] [--] [<path>...]
or: git submodule [--quiet] summary [--cached|--files] [--su mmary-limit <n>] [commit] [--] [<path>...]
or: git submodule [--quiet] foreach [--recursive] <command>
or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
or: git submodule [--quiet] absorbgitdirs [--] [<path>...]
Any suggestions as to what to add in order to fix this issue? Appreciate any help.
I've had a similar issue in different projects a few times before. My solution was usually to decouple the submodule and move the code into my codebase (or using a managed package for this).
To decouple the module go into your submodule folder, delete the .git folder and add the files to your git repository. On the command line I would do it like this:
// going into the submodule - might need to tweaked, depending on the exact path
cd startbootstrap-grayscale
// delete the git submodule
rm -rf .git
// going out of the directory
cd ..
// adding everything to git
git add .
With these steps (and potentially minor tweaks to the paths) I've been able to resolve this issue for me.
I was able to figure it out, I needed to get rid of my startbootstrap-grayscale folder by using rm -r startbootstrap-grayscale and pushing the changes. I had too many nested folders of the same type for some reason.
Completely nuking my git directory and then starting over with a new git commit worked for me. Not ideal but I was trying to get rid of git submodules and it didn't work. Now my site is live! https://connorleech.info/
rm -rf .git
git init
git remote add origin YOUR_URL
git add .
git commit -m 'restart history'
git push origin master

Unrecognized `swift_version` key

I can’t push a new version of my pod to the CocoaPods specs repository.
Running pod trunk push MyPod.podspec results in the following error:
[!] The Pod Specification did not pass validation.
The following validation failed:
- Warnings: Unrecognized `swift_version` key.
Here’s my podspec:
Pod::Spec.new do |spec|
spec.name = "MyPod"
spec.version = "0.1.1"
spec.summary = "[REDACTED]"
spec.homepage = "[REDACTED]"
spec.license = "Apache License, version 2"
spec.author = "[REDACTED]"
spec.social_media_url = "[REDACTED]"
spec.module_name = "MyPod"
spec.swift_version = "5.0"
spec.platform = :ios, "8.0"
spec.source = { :git => "https://github.com/[REDACTED].git", :tag => "v#{spec.version}" }
spec.source_files = "MyPod/**/*.{h,m,swift}"
end
What am I doing wrong?
I first noticed these errors before updating to Swift 5 and Xcode 10.2.
It seems to be a server-side bug. It’s been reported on GitHub.
However, since it’s a warning, not an error (despite it’s in red font color, which is confusing), it can be ignored with the --allow-warnings argument.
Summary, to update a pod:
Update the version and the tag in podspec beforehand
Commit, push code to git
Create new tag with the current code, make sure it's the same tag as the one in podspec
git tag 0.1.1
git push origin 0.1.1
Call pod spec lint to check and pod trunk push to update it on repo master list
pod lib lint YourSDK.podspec
pod trunk push YourSDK.podspec
It appears that your podfile is using the tag v0.1.1, however the tag in your repository is 0.1.1 without the v. This would also cause linting to fail.

error installing package on a branch with install_github

I've forked a package from github have made some changes. I'm trying to install the version of the package to which I've made changes with install_github(), but am getting an error message. Any suggestions?
The forked version: https://github.com/embruna/refnet
The edited version on the branch: https://github.com/embruna/refnet/tree/proposed-updates
I can install the forked version with:
install_github("embruna/refnet", subdir="pkg")
I tried to install the version on the branch with the following:
install_github("embruna/refnet#proposed-updates", subdir="pkg")
But then get this error:
** help
*** installing help indices
** building package indices
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 1 did not have 6 elements
ERROR: installing package indices failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/refnet’
Error: Command failed (1)
Thanks for any suggestions.
EDIT: There were two problems: 1) the install_github syntax I used incorrect and 2) there was a folder in "pkg" that was throwing an error even after correcting the syntax. See below for details.
I'm guessing that specifying the branch with # but the subdirectory with the subdir argument is confusing devtools.
This works for me (specifying both subdir and branch in the repo argument):
install_github("embruna/refnet/pkg#proposed-updates",
So does this (specifying both branch and subdir as separate arguments):
devtools::install_github("embruna/refnet",
ref = "proposed-updates", subdir = "pkg")
The output starts this way ...
Using GitHub PAT from envvar GITHUB_PAT
Downloading GitHub repo embruna/refnet#proposed-updates
from URL https://api.github.com/repos/embruna/refnet/zipball/proposed-updates
Installing refnet
This is with devtools 1.12.0
I was able to install your proposed-updates branch with this:
install_github("embruna/refnet", branch = "proposed-updates", subdir = "pkg")
I get a bunch of warnings, but no error messages.

Cocoapods - podspec validates but can't be pushed to repo

I am setting up a Swift framework through CocoaPods.
Goals are:
Use a private repo for the Podspecs
Have the framework to be distributed as binary (as opposed to source code)
I've read already the CocoaPods frameworks, Making a CocoaPod plus other references (can't seem to be able to include more than 2 links with current SO reputation but I can point sources in comments).
The Podspec I am using is:
Pod::Spec.new do |s|
s.name = 'SDK'
s.version = '0.0.1'
s.summary = 'My SDK'
s.description = 'SDKs description'
s.homepage = 'https://github.com/XXX/sdk'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'XXX' => 'xxx#xxx.com' }
s.source = { :git => 'https://github.com/XXX/sdk.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.platform = :ios, '9.0'
s.source_files = 'SDK/Classes/**/*'
s.preserve_paths = 'Frameworks/SDK.framework'
s.ios.vendored_frameworks = 'Frameworks/SDK.framework'
end
The Pods xcode project was changed to build also i386 arch besides the standard (arm64, armv7).
This spec successfully validates locally with, provided that I copy the SDK.framework file to the /Frameworks folder in the .podspec folder:
pod lib lint
Issue: when I try to push the spec to the repo, the validation fails as the output below show:
pod repo push mySDKPrivateRepo SDK.podspec
Validating spec
-> SDK (0.0.1)
- ERROR | [iOS] file patterns: The `source_files` pattern did not match any file.
- ERROR | file patterns: The `preserve_paths` pattern did not match any file.
- ERROR | [iOS] file patterns: The `vendored_frameworks` pattern did not match any file.
[!] The `SDK.podspec` specification does not validate.
Questions:
How can I make the podspec validation successful when pushing it to repo?
Other notes:
Copying the SDK.framework to /Frameworks works manually.
If I include a Copy Files build step in the Pods Xcode project the file is not copied.
Using CocoaPods 1.1.0.
I was having a similar problem, the culprit was the project structure itself.
Be sure to check your at which directory you're pointing your source_files to. I've found that maintaining any kind of structure in this way is very difficult and it's easier to include all of your files in a single folder.
s.source_files = '<InsertName>/**/Classes/*'
Take a look at cocoapods advice on File Patters for some help on this.
By a process of elimination, I would suggest trying to push to the repo commenting out source_files in the podspec first, and work your way forward from there.