Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ or
react-native addpod [pod] --podversion [version]
```

or
or (you can use only one branch/commit/tag option)

```
react-native addpod [pod] --podgit[giturl]
react-native addpod [pod] --podgit[giturl] [--podgitoption "branch=branch_name" "commit=sha" "tag=tag_name"]
```

Note that adding a pod puts the reference in your package.json. This gives the hint to react-native link to add it to your Podfile.
Expand Down
2 changes: 2 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ commander
.description("Add the named pod to the current package.json file")
.option("--podversion [version]", "version directive")
.option("--podgit [giturl]", "Git (usually github) source URL")
.option("--podgitoption [gitoption]", "Specify the branch, commit or tag like 'branch=branch_name'")
.option("--podspec [specurl]", "Podspec for full path/url pointer")
.action((a, b, c) => {
return addPod(a, c, b);
});
Expand Down
14 changes: 13 additions & 1 deletion lib/addPod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ module.exports = (podname, obj, args) => {
if (typeof podname !== "string") podname = podname[0];
podinfo = { pod: podname };
if (args) {
const { podversion: version, podgit: git, podspec: spec } = args;
const {
podversion: version,
podgit: git,
podgitoption: options,
podspec: spec
} = args;

if (git && options) {
const [key, value] = options.split('=');
if (['branch', 'commit', 'tag'].includes(key)) {
podinfo[key] = value;
}
}
podinfo = { ...podinfo, version, git, spec };
}
if (podinfo) {
Expand Down
7 changes: 6 additions & 1 deletion lib/addPodEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ module.exports = function addPodEntry(podLines, linesToAddEntry, podInfo) {
entryParts.push("'" + podInfo.version + "'");
}
if (podInfo.git) {
entryParts.push(":git => " + "'" + podInfo.git + "'");
entryParts.push("git: " + "'" + podInfo.git + "'");
Object.keys(podInfo).forEach((option) => {
if (['branch', 'commit', 'tag'].includes(option)) {
entryParts.push(option + ": '" + podInfo[option] + "'");
}
});
}
if (podInfo.spec) {
entryParts.push("podspec: '" + podInfo.spec + "'");
Expand Down
6 changes: 5 additions & 1 deletion rnplugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ module.exports = [
description: "Git (usually github) source URL"
},
{
command: "--podspec <specurl>",
command: "--podgitoption [gitption]",
description: "Specify the branch, commit or tag like 'branch=branch_name'"
},
{
command: "--podspec [specurl]",
description: "Podspec for full path/url pointer"
}
],
Expand Down