Sunday, June 28, 2015

Setting up the development Environment for Moodle Mobile v 2.0


In this blog post I will mainly discuss on how I set up the development environment for Moodle Mobile v 2.0 in my computer. Actually this took approximately week and half . I am a windows user and when I tried setting up it in my windows 7 , it did not work. I tried , tried thinking that I would fly someday but could not actually take off until I shifted my track to Ubuntu. So I have made up computer to dual boot both the Ubuntu and Windows. In this post I will be explaining how to set up your development environment in Ubuntu 14.04 .

When setting up the environment, first we need to set up the Moodle web site instance in our machine. The newest version, 2.9 of moodle should be installed in your machine.

By going through this you will able to install the latest version (2.9) of Moodle in to your Ubuntu environment.

After installing and making Moodle Up and running, then you have to install  "the Moodle Mobile additional features plugin for Moodle 2.9 ". By going through this link , you will be able to successfully install it.

Then fork the repository from https://github.com/moodlehq/moodlemobile2 and clone the forked repository to the computer.

So now we are left with setting up the Moodle Mobile. By following the below described steps, you will be able to successfully set up Moodle Mobile in your Ubuntu environment.

Steps 

  • Installing nodejs to the computer
Open the terminal and type sudo apt-get install nodejs command and then type sudo apt-get install npm to install npm. Then type sudo apt-get install nodejs-legacy as well. After the installation type node --version and it will out put the installed nodejs version as follows.







  • Install ionic and cordova to the computer

Go to the terminal and use this command sudo npm install -g ionic to install ionic and sudo npm install -g cordova to install cordova. This will install ionic and cordova in your computer.

  • Adding platforms
CD in to the moodlemobile2 directory and type ionic platform add ios android. This will add the platforms to the moodlemobile and will create two folders named android and IOS and a json file named platforms.json in the /moodlemobile2/platforms.


  • Adding all the plugins listed in the package.json file
CD in to the moodlemobile2 directory and type ionic plugin add org.apache.cordova.globalization org.apache.cordova.file org.apache.cordova.inappbrowser org.apache.cordova.file-transfer org.apache.cordova.network-information org.apache.cordova.camera org.apache.cordova.media-capture


  • Installing the dependencies
CD in to the moodlemobile2 directory and type npm install. This will install the dependencies which are listed in the package.json


  • Installing 3rd party libraries .
CD in to the moodlemobile2 directory and type sudo npm install -g bower to install bower and then type bower install to add all the 3rd party libraries which are listed in the bower.json


  • Creating JS file bundles
CD in to the moodlemobile2 directory and type sudo npm install -g gulp to install gulp and then type gulp to create JS file bundles.


  • Running moodle mobile v 2.0
In order to work with moodle mobile v 2.0 we need to install google chromium browser. We can install it through terminal by typing sudo apt-get install chromium-browser . This will install chromium browser. We need to run this chromium browser with the flags , in order to access remote sites. This can be done by typing the following command. chromium-browser --allow-file-access-from-files --disable-web-security

Then type ionic serve to start the ionic server in localhost:8100 . Moodle mobile will be run on this.



So now we have finished setting up the development Environment for Moodle Mobile v 2.0. Now the coding begins. In the next post I will be discussing about the first component I started developing. Till then see you guys and Happy Coding. :D

3 comments:

  1. Hi!
    I'm trying to do a custom MoodleMobile2 app, but I'm stuck with dependencies installations... Precisely with gulp-sass.... it tries to download a binary with inaccessible url... This is the error:
    ---
    > node-sass@2.1.1 install /home/macarena/devel/app_assurant2/node_modules/gulp-sass/node_modules/node-sass
    > node scripts/install.js

    Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/linux-x64-node-4.1/binding.node
    ---
    I've followed the steps on Moodle Documentation (https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2) and yours, both unsuccessful...
    Any clue about what's going on??

    ReplyDelete
  2. it is very excellent blog and useful article thank you for sharing with us , keep posting learn more
    Azure Online Training Hyderabad

    ReplyDelete