Difference between revisions of "Sugar Cordova"

From Sugar Labs
Jump to navigation Jump to search
(Created page with "== INSTRUCTIONS TO SET UP SUGAR CORDOVA == BELOW PROCEDURE IS FOR LINUX (MUST RUN FOR MAC TOO) : SETTING UP CORDOVA DEVELOPMENT ENVIRONMENT : Pre-Requirements : must have ...")
 
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== INSTRUCTIONS TO SET UP SUGAR CORDOVA ==
+
<noinclude>
 +
[[Category:sugar cordova|.]]
 +
<!-- You can add categories to tie features back to real deployments/schools requesting them, for example
 +
[[Category:Features requested by School Xyz|<Feature Name>]] (the |Feature Name option sorts the entry on the category page under the first letter of <Feature Name>). -->
 +
</noinclude>
  
BELOW PROCEDURE IS FOR LINUX (MUST RUN FOR MAC TOO) :
+
== Instructions to set up Sugar Cordova ==
  
SETTING UP CORDOVA DEVELOPMENT ENVIRONMENT :
+
=== The procedure below is for GNU/Linux (must run for Mac OS too) ===
  
Pre-Requirements : must have node and npm installed
+
==== Setting up Cordova development environment====
  
1. Git clone : https://github.com/apache/cordova-cli , https://github.com/apache/cordova-lib and https://github.com/apache/cordova-plugman in a directory
+
Pre-Requirements: must have node and npm installed
  
2. Go inside cordova-lib, you'll find another cordova-lib inside it, issue the command npm install, npm link inside it.
+
# 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)
  
3. Now cd to cordova-cli, and issue npm install in it then issue npm link cordova-lib
+
==== Addition for setting up the Sugar platform ====
 
 
4. 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 ADDING 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] :
 
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] :
 
+
<nowiki>'sugar':{
'sugar':{
+
parser: './metadata/sugar_parser',
parser: './metadata/sugar_parser',
+
url : 'https://github.com/puneetgkaur/sugar-cordova.git',
url : 'https://github.com/puneetgkaur/sugar-cordova.git',
+
version: '3.5.0'
version: '3.5.0'
+
}</nowiki>
}
+
2. Add the following to cordova-cli/node_modules/cordova-lib/src/plugman/platforms.js :<br>
 
+
<nowiki>'sugar': require('./platforms/sugar')</nowiki>
 
+
3. Add the sugar_parser.js to cordova-cli/node_modules/cordova-lib/src/cordova/metadata from :
2.Add the following to cordova-cli/node_modules/cordova-lib/src/plugman/platforms.js :
+
: https://github.com/puneetgkaur/cordova-lib/blob/master/src/cordova/metadata/sugar_parser.js
 
 
'sugar': require('./platforms/sugar')
 
 
 
3. Add the sugar_parser.js to cordova-cli/node_modules/cordova-lib/src/cordova/metadata from :  
 
https://github.com/puneetgkaur/cordova-lib/blob/master/src/cordova/metadata/sugar_parser.js
 
 
 
 
4. Add sugar.js to cordova-cli/node_modules/cordova-lib/src/plugman/platforms
 
4. Add sugar.js to cordova-cli/node_modules/cordova-lib/src/plugman/platforms
https://github.com/puneetgkaur/cordova-lib/blob/master/src/plugman/platforms/sugar.js
+
: https://github.com/puneetgkaur/cordova-lib/blob/master/src/plugman/platforms/sugar.js
 
+
5. Unzip and add the sugar directory to home/.cordova/lib
5.Unzip and add the sugar directory to home/.cordova/lib
+
: https://drive.google.com/file/d/0BxC58bMp7xjuNnpWTkRNRFNnY28/edit?usp=sharing
https://drive.google.com/file/d/0BxC58bMp7xjuNnpWTkRNRFNnY28/edit?usp=sharing
 
 
 
Now to run and check :
 
 
 
1.Go to cordova-cli/bin and run the command : ./cordova create new_project
 
 
 
2. cd to the new_project directory created inside the bin folder
 
  There run the command :
 
 
 
.././cordova platform add sugar
 
  
4. Then to build run :
+
==== Run and Check ====
  
.././cordova build sugar
+
# Go to cordova-cli/bin and run the command,<br>{{Code|./cordova create new_project}}
 +
# cd to the new_project directory created inside the bin folder
 +
#:  There run the command,<br> {{Code|.././cordova platform add sugar}}
 +
# Then to build, run<br> {{Code|.././cordova build sugar}}
 
   
 
   
 
The .xo generated would be present in cordova-cli/bin/new_project/platforms/sugar/cordova/HelloCordova.xo
 
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 ====
  
FOR WINDOWS :
 
 
The setting up of cordova is same (get the nodejs msi to install both node and npm)
 
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] : <br>
1. Add the following in cordova-cli\node_modules\cordova-lib\src\cordova\platforms.js [Note the s in platforms, it differentiates from platform] :
+
<nowiki>
 
 
 
'sugar':{
 
'sugar':{
 
parser: './metadata/sugar_parser',
 
parser: './metadata/sugar_parser',
 
url : 'https://github.com/puneetgkaur/sugar-cordova.git',
 
url : 'https://github.com/puneetgkaur/sugar-cordova.git',
 
version: '3.5.0'
 
version: '3.5.0'
}
+
}</nowiki>
 
+
2. Add the following to cordova-cli\node_modules\cordova-lib\src\plugman\platforms.js :
2.Add the following to cordova-cli\node_modules\cordova-lib\src\plugman\platforms.js :
+
<nowiki>
 
+
'sugar': require('./platforms/sugar')</nowiki>
'sugar': require('./platforms/sugar')
 
 
 
 
 
 
3. Add the sugar_parser.js to cordova-cli\node_modules\cordova-lib\src\cordova\metadata
 
3. Add the sugar_parser.js to cordova-cli\node_modules\cordova-lib\src\cordova\metadata
https://github.com/puneetgkaur/cordova-lib/blob/master/src/cordova/metadata/sugar_parser.js
+
: https://github.com/puneetgkaur/cordova-lib/blob/master/src/cordova/metadata/sugar_parser.js
 
 
 
4. Add sugar.js to cordova-cli\node_modules\cordova-lib\src\plugman\platforms
 
4. Add sugar.js to cordova-cli\node_modules\cordova-lib\src\plugman\platforms
https://github.com/puneetgkaur/cordova-lib/blob/master/src/plugman/platforms/sugar.js
+
: https://github.com/puneetgkaur/cordova-lib/blob/master/src/plugman/platforms/sugar.js
 
+
5. Add the sugar directory to C:\Users\<your user name>\.cordova\lib
5.Add the sugar directory to C:\Users\<your user name>\.cordova\lib
+
: https://drive.google.com/file/d/0BxC58bMp7xjuNnpWTkRNRFNnY28/edit?usp=sharing
https://drive.google.com/file/d/0BxC58bMp7xjuNnpWTkRNRFNnY28/edit?usp=sharing
 
 
 
Now to run and check :
 
 
 
1.Go to cordova-cli\bin and type : cordova create <prj_directory> <prj_id> <prj_name>
 
 
 
2. cd to the project directory created inside the bin folder
 
 
 
3.There run the command :
 
..\cordova platform add sugar
 
  
4. Then to build run :
+
==== Run and Check ====
..\cordova build sugar
 
  
 +
# Go to cordova-cli\bin and type<br>{{Code|cordova create <prj_directory> <prj_id> <prj_name>}}
 +
# cd to the project directory created inside the bin folder
 +
# There run the command <br>{{Code|..\cordova platform add sugar}}
 +
# Then to build, run <br>{{Code|..\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
+
{{Note/note|Note:|Windows users must install 7zip and set the environment variable ZIPCOMMAND with the command<br>{{Code|<nowiki>set ZIPCOMMAND="c:\Program Files\7-Zip\7z.exe" a -r -tzip -aoa</nowiki>}} before issuing the cordova build command.}}

Latest revision as of 22:27, 25 July 2014


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

  1. Git clone : https://github.com/apache/cordova-cli , https://github.com/apache/cordova-lib and https://github.com/apache/cordova-plugman in a directory
  2. Go inside cordova-lib, you'll find another cordova-lib inside it, issue the command npm install, npm link inside it.
  3. Now cd to cordova-cli, and issue npm install in it then issue npm link cordova-lib
  4. 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 :

https://github.com/puneetgkaur/cordova-lib/blob/master/src/cordova/metadata/sugar_parser.js

4. Add sugar.js to cordova-cli/node_modules/cordova-lib/src/plugman/platforms

https://github.com/puneetgkaur/cordova-lib/blob/master/src/plugman/platforms/sugar.js

5. Unzip and add the sugar directory to home/.cordova/lib

https://drive.google.com/file/d/0BxC58bMp7xjuNnpWTkRNRFNnY28/edit?usp=sharing

Run and Check

  1. Go to cordova-cli/bin and run the command,
    ./cordova create new_project
  2. cd to the new_project directory created inside the bin folder
    There run the command,
    .././cordova platform add sugar
  3. 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

https://github.com/puneetgkaur/cordova-lib/blob/master/src/cordova/metadata/sugar_parser.js

4. Add sugar.js to cordova-cli\node_modules\cordova-lib\src\plugman\platforms

https://github.com/puneetgkaur/cordova-lib/blob/master/src/plugman/platforms/sugar.js

5. Add the sugar directory to C:\Users\<your user name>\.cordova\lib

https://drive.google.com/file/d/0BxC58bMp7xjuNnpWTkRNRFNnY28/edit?usp=sharing

Run and Check

  1. Go to cordova-cli\bin and type
    cordova create <prj_directory> <prj_id> <prj_name>
  2. cd to the project directory created inside the bin folder
  3. There run the command
    ..\cordova platform add sugar
  4. Then to build, run
    ..\cordova build sugar
35px-Activity-write.png
Note:
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.