Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding plugins from specific revision Github project to the Cordova project

I have setup the android project using cordova command-line-interface with the help of node.js. I have added the required plugin from Github to our project by the following command:

C:Users/Admin/>cordova plugin add https://github.com/phonegap-build/PushPlugin.git

For now it is working fine, but what if they suddenly changes the plugin.So I want to stick with the specific revision of plugin. So how can i get the plugin which is specific to particular revision. Shall i add the revision number or commit number to the above url?

like image 374
M.S.Naidu Avatar asked Aug 05 '14 13:08

M.S.Naidu


People also ask

How plugins are used in Apache Cordova?

A plugin is a package of injected code that allows the Cordova webview within which the app renders to communicate with the native platform on which it runs. Plugins provide access to device and platform functionality that is ordinarily unavailable to web-based apps.

What are different plugins in Cordova?

A Cordova plugin provides a JavaScript interface to the native components. These plugins consist of various elements that are as follows: Common JavaScript Interface. A manifest file, i.e., xml.

How do you make a Cordova plugin from scratch?

So, you must install your application on a device to use any off-platform Cordova plugins. To do so, navigate to the Development tab and switch from DEVELOPMENT to the NATIVE PLATFORMS section under your mobile project module. Then click GENERATE ANDROID APP.


2 Answers

I got the answer finally, I could get the plugin code upto particular commit:

The following command is what I used to get the latest plugin code:

D:sampleproject/>  cordova plugin add https://github.com/phonegap-build/PushPlugin#2345fd8fe48572eae3df631cf8fb262ef2804779 
like image 198
M.S.Naidu Avatar answered Sep 23 '22 02:09

M.S.Naidu


I don't know a way to stick to a particular revision (other than cloning it first and after the clone add it with a file path) but I know it is possible to install from a specific git tag which might be sufficient in most cases.

Command to install from a specific git tag

cordova plugin add https://github.com/phonegap-build/PushPlugin.git#1.3.4

If you want to install from a tag and a specified sub directory (maybe because plugin.xml isn't a top-level file) you can install it with this command: cordova plugin add https://github.com/phonegap-build/PushPlugin.git#1.3.4:/plugin/sub/dir

like image 23
Dick van den Brink Avatar answered Sep 23 '22 02:09

Dick van den Brink