Module: Iphone

Included in:
PhoneGap
Defined in:
lib/devices/iphone.rb

Instance Method Summary collapse

Instance Method Details

#build_iphone(path_to_build, debug = true) ⇒ Object

builds the iphone using xcode, FIXME should use open toolchain



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/devices/iphone.rb', line 17

def build_iphone(path_to_build, debug=true)
  if iphone_supported?
    puts "Building for iPhone..."
    www_local = File.join(path_to_build,'www')
    www_build = File.join(platform_path,'iphone/www')
    FileUtils.mkdir_p(path_to_build)
    puts "Copying #{www_local} to #{www_build}..."
    File.copy(www_local, www_build)
    puts `cd #{www_build}; /usr/bin/xcodebuild -alltargets -configuration Debug -sdk #{debug ? config['Debug'] : config['Release']}`
    `iphonesim launch #{ www_build } 3.0` if debug
  else
    puts 'Skipping iPhone build: iphone sdk not installed.'
  end 
end

#configObject

options for the build



8
9
10
# File 'lib/devices/iphone.rb', line 8

def config
  {'Release'=>'iphoneos3.0','Debug'=>'iphonesimulator3.0'}
end

#iphone_supported?Boolean

TODO need to verify version

Returns:

  • (Boolean)


3
4
5
# File 'lib/devices/iphone.rb', line 3

def iphone_supported?
  return File.exists?("/usr/bin/xcodebuild")
end

#isObject



12
13
14
# File 'lib/devices/iphone.rb', line 12

def is
  File.join(platform_path,'iphone/www')
end