Git Product home page Git Product logo

drupalgap-install-crossplatform's Introduction

DrupalGap-Install-CrossPlatform

alt text

Setting Up DrupalGap on Drupal 7 Across Multiple Platforms

Select your operating system:

Windows 7

Windows 8

Windows 10

Mac OSX

Ubuntu

Index:

  1. Install node.js
  2. Install Cordova
  3. Setup PhoneGap Platforms
  4. Install PhoneGap Plugins
  5. Install DrupalGap SDK over PhoneGap

Note: You will need a Drupal 7 site preinstalled

Windows_7

Windows_8

Windows_10

Mac_OSX

Install XCode

  1. Navigate to the Apple App Store and install XCode.
  2. Once installed, run XCode and install all updates.

Install Homebrew

  1. Open Terminal
  2. Type this in Terminal:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Follow the prompts to complete the installation

Install node.js & npm

  1. Install node.js & npm:
$ brew install node
  1. Check versions to ensure correct installation:
$ node -v
$ npm -v
  1. Update node.js and npm:
$ brew update && brew upgrade node

Install Cordova

  1. Install Cordova:
$ npm install -g cordova

Setup PhoneGap Platforms

  1. Change directory to desktop:
$ cd ~/Desktop
  1. Create application files:
$ cordova create ExampleApp com.example "ExampleApp"
  1. Change to app directory:
$ cd ExampleApp
  1. Set Paths for the .bash_profile, mine looks like this:
$ export ANDROID_HOME=/home/kyle/android-sdk
$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
$ export PATH=${PATH}:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:/usr/share/npm
  1. Reload .bash_profile:
$ source ~/.bash_profile
  1. Add Android platform:
$ cordova platform add android
  1. Build Android platform:
$ cordova build
  1. Add iOS platform:
$ cordova platform add ios
  1. Build iOS platform:
$ cordova prepare
  1. Test the simulators:
$ cordova run

Install PhoneGap plugins

  1. Install all PhoneGap plugins:
$ cordova plugin add cordova-plugin-console cordova-plugin-device cordova-plugin-dialogs cordova-plugin-file cordova-plugin-inappbrowser cordova-plugin-network-information cordova-plugin-camera cordova-plugin-geolocation
  1. Update your config.xml:
$ cordova plugin save

Download the DrupalGap Module and dependencies into Drupal 7:

  1. Download DrupalGap dependencies:
$ drush dl services libraries views_datasource
  1. Enable DrupalGap dependencies:
$ drush en -y services libraries veiws_datasource
  1. Download DrupalGap Module:
$ drush dl drupalgap
  1. Enable DrupalGap Module:
$ drush en -y drupalgap
  1. Flush Drupal cache:
$ drush cc all
  1. Flush Drupal cache again because why not:
$ drush cc all
  1. Test your installation by going to admin -> config -> services -> drupalgap and clicking Test Connection. It should say The system connect test was successful, DrupalGap is configured properly!

Install DrupalGap SDK overtop PhoneGap:

  1. Click the "download" link on your Drupal site under "Configuration -> Web services -> DrupalGap"
  2. Extract the contents of this download into your app's www directory on the desktop (overwrite any files):
~/Desktop/ExampleApp/www
  1. Open your app's settings.js file, and switch the mode to phonegap:
drupalgap.settings.mode = 'phonegap';
  1. Then include the cordova.js file in the body of your index.html file:
<!-- Load PhoneGap (Cordova) -->
<script type="text/javascript" src="cordova.js"></script>

Run the App

  1. Change to app's root directory:
$ cd ~/Desktop/ExampleApp
  1. Build and Run the app:
$ cordova build
$ cordova prepare
$ cordova run

Remove Extra Files

  1. Change to app's root directory:
$ cd ~/Desktop/ExampleApp/www
  1. Delete some extra files:
$ rm -rf css/ img/ js/

Ubuntu

Install node.js & npm

  1. Install node.js:
$ sudo apt-get update
$ sudo apt-get install nodejs
  1. Install npm:
$ sudo apt-get install npm
  1. Update node.js name for PhoneGap:
$ sudo ln -s /usr/bin/nodejs /usr/bin/node

Install Git

  1. Install Git:
$ sudo apt-get install git

Install Ant

  1. Install Ant:
$ sudo apt-get install ant

Install PhoneGap

  1. Install PhoneGap:
$ sudo npm install -g phonegap
  1. Install dependencies:
$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
  1. Verify Correct Installation:
$ phonegap -v

Add Android Platform

  1. Download the SDK from here and extract it to /usr/local/android-sdk
$ sudo tar -zxvf ~/Downloads/android-sdk_r24.4.1-linux.tgz -C /usr/local/

Note: This command will change based on the SDK version.

  1. Set Paths:
$ vim ~/.bashrc

Add:

export PATH=$PATH:/usr/local/android-sdk-linux/
export PATH=$PATH:/usr/local/android-sdk-linux/tools
export PATH=$PATH:/usr/local/android-sdk-linux/platform-tools
export PATH=$PATH:/usr/local/android-sdk-linux/build-tools
  1. Save and quit:
$ vi ~/.bashrc
  1. Set permissions:
$ sudo chmod a+x /usr/local/android-sdk-linux/tools/android
  1. Reload .bashrc
$ source ~/.bashrc
  1. Verify Correct Installation:
$ android

Install A Faster Emulator (Optional)

  1. Install VirtualBox
$ sudo apt-get install virtualbox
  1. Download the emulator from here
  2. Set Permissions:
$ chmod u+x genymotion-2.1.0_x64.bin
$ ./genymotion-2.1.0_x64.bin
  1. Run the emulator:
$ cd /home/dasunhegoda/Downloads/genymotion/
$ ./genymotion

Create An App

  1. Create application files:
$ phonegap create testapp
  1. Change Directory:
$ cd /home/kyle/testapp
  1. Add Android Platform:
$ phonegap platform add android
  1. Verify the platform was added:
$ phonegap platform -ls
  1. Run the application:
$ phonegap run android

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.