Sugar Cordova
Instructions to set up Sugar Cordova
The procedure below is for GNU/Linux (must run for Mac OS too)
Setting up Cordova development environment
Pre-Requirements: must have node and npm installed
- Git clone : https://github.com/apache/cordova-cli , https://github.com/apache/cordova-lib and https://github.com/apache/cordova-plugman in a directory
- Go inside cordova-lib, you'll find another cordova-lib inside it, issue the command npm install, npm link inside it.
- Now cd to cordova-cli, and issue npm install in it then issue npm link cordova-lib
- cd to cordova-plugman, and repeat the steps for cordova-cli here - ( issuing npm install - same way to correct if any error , issue npm link cordova-lib)
Addition for setting up the Sugar platform
1. Add the following in cordova-cli/node_modules/cordova-lib/src/cordova/platforms.js [Note the s in platforms, it differentiates from platform.js] :
'sugar':{ parser: './metadata/sugar_parser', url : 'https://github.com/puneetgkaur/sugar-cordova.git', version: '3.5.0' }
2. Add the following to cordova-cli/node_modules/cordova-lib/src/plugman/platforms.js :
'sugar': require('./platforms/sugar')
3. Add the sugar_parser.js to cordova-cli/node_modules/cordova-lib/src/cordova/metadata from :
4. Add sugar.js to cordova-cli/node_modules/cordova-lib/src/plugman/platforms
5. Unzip and add the sugar directory to home/.cordova/lib
Run and Check
- Go to cordova-cli/bin and run the command,
./cordova create new_project
- cd to the new_project directory created inside the bin folder
- There run the command,
.././cordova platform add sugar
- There run the command,
- Then to build, run
.././cordova build sugar
The .xo generated would be present in cordova-cli/bin/new_project/platforms/sugar/cordova/HelloCordova.xo
For Microsoft Windows
Setting Cordova CLI and adding Sugar
The setting up of cordova is same (get the nodejs msi to install both node and npm)
1. Add the following in cordova-cli\node_modules\cordova-lib\src\cordova\platforms.js [Note the s in platforms, it differentiates from platform] :
'sugar':{ parser: './metadata/sugar_parser', url : 'https://github.com/puneetgkaur/sugar-cordova.git', version: '3.5.0' }
2. Add the following to cordova-cli\node_modules\cordova-lib\src\plugman\platforms.js :
'sugar': require('./platforms/sugar')
3. Add the sugar_parser.js to cordova-cli\node_modules\cordova-lib\src\cordova\metadata
4. Add sugar.js to cordova-cli\node_modules\cordova-lib\src\plugman\platforms
5. Add the sugar directory to C:\Users\<your user name>\.cordova\lib
Run and Check
- Go to cordova-cli\bin and type : cordova create <prj_directory> <prj_id> <prj_name>
- cd to the project directory created inside the bin folder
- There run the command :
..\cordova platform add sugar
- Then to build, run :
..\cordova build sugar
NOTE : the Windows users must install 7zip and set the environment variable ZIPCOMMAND with the command : set ZIPCOMMAND="c:\Program Files\7-Zip\7z.exe" a -r -tzip -aoa before issuing the cordova build command