Class: Alloy::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/alloy/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Public: Creates a new config instance.

Examples

config = Alloy::Config.new('alloy.json')

path - The String represents path to alloy.json



14
15
16
17
# File 'lib/alloy/config.rb', line 14

def initialize(path)
  load_alloy_json(path)
  load_tiapp_xml
end

Instance Method Details

#android_avd_idObject

Public: Returns AVD ID string.

Examples

android_avd_id
# => '1'

Returns the AVD ID String.



99
100
101
# File 'lib/alloy/config.rb', line 99

def android_avd_id
  @json['android']['avd_id']
end

#android_sdk_pathObject

Public: Returns path string to Android SDK installation.

Examples

android_sdk_path
# => ''

Returns the path String.



87
88
89
# File 'lib/alloy/config.rb', line 87

def android_sdk_path
  File.expand_path(@json['android']['sdk_path'])
end

#app_idObject

Public: Returns Application ID

Examples

app_id
# => 'com.example.helloworld'

Returns the Application ID String.



27
28
29
# File 'lib/alloy/config.rb', line 27

def app_id
  @app_id
end

#app_nameObject

Public: Returns Application Name

Examples

app_name
# => 'HelloWorld'

Returns the Application Name String.



39
40
41
# File 'lib/alloy/config.rb', line 39

def app_name
  @app_name
end

#iphone_sdk_versionObject

Public: Returns iPhone SDK version string.

Examples

iphone_sdk_version
# => '5.0'

Returns the version String.



75
76
77
# File 'lib/alloy/config.rb', line 75

def iphone_sdk_version
  @json['iphone']['sdk_version']
end

#project_rootObject

Public: Returns project root directory path string.

Examples

project_root
# => '/path/to/titanium-project-root'

Returns the AVD ID String.



171
172
173
# File 'lib/alloy/config.rb', line 171

def project_root
  @json['project_root']
end

#titanium_android_builderObject

Public: Returns Titanium Android builder.py path string.

Examples

titanium_android_builder
# => '/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA/android/builder.py'

Returns the AVD ID String.



159
160
161
# File 'lib/alloy/config.rb', line 159

def titanium_android_builder
  titanium_android_path + '/builder.py'
end

#titanium_android_pathObject

Public: Returns Titanium Android assets directory path string.

Examples

titanium_android_path
# => '/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA/android'

Returns the AVD ID String.



135
136
137
# File 'lib/alloy/config.rb', line 135

def titanium_android_path
  titanium_assets_path + '/android'
end

#titanium_assets_pathObject

Public: Returns Titanium assets directory path string.

Examples

titanium_assets_path
# => '/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA'

Returns the AVD ID String.



111
112
113
# File 'lib/alloy/config.rb', line 111

def titanium_assets_path
  titanium_sdk_path + '/mobilesdk/osx/' + titanium_sdk_version
end

#titanium_iphone_builderObject

Public: Returns Titanium iPhone builder.py path string.

Examples

titanium_iphone_builder
# => '/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA/iphone/builder.py'

Returns the AVD ID String.



147
148
149
# File 'lib/alloy/config.rb', line 147

def titanium_iphone_builder
  titanium_iphone_path + '/builder.py'
end

#titanium_iphone_pathObject

Public: Returns Titanium iPhone assets directory path string.

Examples

titanium_iphone_path
# => '/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA/iphone'

Returns the AVD ID String.



123
124
125
# File 'lib/alloy/config.rb', line 123

def titanium_iphone_path
  titanium_assets_path + '/iphone'
end

#titanium_sdk_pathObject

Public: Returns path to Titanium Mobile SDK installation.

Examples

titanium_sdk_path
# => '/Library/Application Support/Titanium'

Returns the path String.



51
52
53
# File 'lib/alloy/config.rb', line 51

def titanium_sdk_path
  File.expand_path(@json['titanium']['sdk_path'])
end

#titanium_sdk_versionObject

Public: Returns Titanium Mobile SDK version string.

Examples

titanium_sdk_version
# => '1.8.2'

Returns the version String.



63
64
65
# File 'lib/alloy/config.rb', line 63

def titanium_sdk_version
  @titanium_sdk_version
end