Class: PhoneGap
- Inherits:
-
Object
- Object
- PhoneGap
- Includes:
- Android, Blackberry, Iphone
- Defined in:
- lib/phonegap.rb
Overview
Provides utilities for generating a PhoneGap application and unifies the build process for each of the supported mobile platforms.
Instance Method Summary collapse
-
#build(path) ⇒ Object
builds a phonegap web application to all supported platforms.
-
#generate(path) ⇒ Object
creates an app skeleton.
-
#platform_path ⇒ Object
path to the actual PhoneGap platforms source.
-
#report ⇒ Object
outputs a tidy report of which PhoneGap supported SDK’s are installed.
-
#trim(str) ⇒ Object
helper for removing code indentation whitespace.
-
#version ⇒ Object
outputs the current version of PhoneGap.
Methods included from Blackberry
#blackberry_supported?, #build_blackberry
Methods included from Android
#android_supported?, #build_android
Methods included from Iphone
#build_iphone, #config, #iphone_supported?, #is
Instance Method Details
#build(path) ⇒ Object
builds a phonegap web application to all supported platforms
53 54 55 56 57 |
# File 'lib/phonegap.rb', line 53 def build(path) build_iphone(path) build_android(path) build_blackberry(path) end |
#generate(path) ⇒ Object
creates an app skeleton
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/phonegap.rb', line 22 def generate(path) generate_path = File.join(Dir.pwd,path) template_path = File.join(File.dirname(__FILE__),'generate') FileUtils.cp_r(template_path, generate_path) e=<<-E Generated a fresh PhoneGap application! #{ path }/ | |- config/ | |- bootstrap.js | |- iphone-dev-cert.txt | |- android-dev-cert.txt | '- blackberry-dev-cert.txt | '- www/ |- assets/ | |- css/ | |- js/ | '- images/ | '- index.html For more information, tutorials, documentation and quickstarts visit http://phonegap.com E trim(e) end |
#platform_path ⇒ Object
path to the actual PhoneGap platforms source
17 18 19 |
# File 'lib/phonegap.rb', line 17 def platform_path File.join(File.dirname(__FILE__),'platforms/') end |
#report ⇒ Object
outputs a tidy report of which PhoneGap supported SDK’s are installed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/phonegap.rb', line 60 def report report =<<-E PhoneGap 0.7.0 ------------------- Supported Platforms ------------------- iPhone ............ #{ iphone_supported? ? 'yes' : 'no!' } .... #{ iphone_supported? ? '3.0' : 'Download and install from http://developer.apple.com' } Android .......... #{ android_supported? ? 'yes' : 'no!' } .... #{ android_supported? ? '???' : 'Download and install from http://code.google.com/p/android' } BlackBerry ........ #{ blackberry_supported? ? 'yes' : 'no!' } .... #{ blackberry_supported? ? '???' : 'Download and install from http://developer.rim.com' } E trim(report) end |
#trim(str) ⇒ Object
helper for removing code indentation whitespace
77 78 79 |
# File 'lib/phonegap.rb', line 77 def trim(str) str.gsub(' ','') end |
#version ⇒ Object
outputs the current version of PhoneGap
12 13 14 |
# File 'lib/phonegap.rb', line 12 def version '0.7.4' # FIXME needs to know which version is being submoduled in end |