Class: Confetti::Template::WindowsPhone7Manifest
- Inherits:
-
Base
- Object
- Mustache
- Base
- Confetti::Template::WindowsPhone7Manifest
show all
- Includes:
- VersionHelper
- Defined in:
- lib/confetti/templates/windows_phone7_manifest.rb
Constant Summary
collapse
- GAP_PERMISSIONS_MAP =
{
'camera' => %w{ID_CAP_ISV_CAMERA
ID_HW_FRONTCAMERA},
'contacts' => %w{ID_CAP_CONTACTS},
'device' => %w{ID_CAP_IDENTITY_DEVICE},
'geolocation' => %w{ID_CAP_LOCATION},
'network' => %w{ID_CAP_NETWORKING},
'media' => %w{ID_CAP_MICROPHONE},
}
Instance Method Summary
collapse
#normalize_version
Methods inherited from Base
#initialize
Instance Method Details
#author ⇒ Object
20
21
22
|
# File 'lib/confetti/templates/windows_phone7_manifest.rb', line 20
def author
@config.author.name
end
|
#capabilities ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/confetti/templates/windows_phone7_manifest.rb', line 46
def capabilities
default_permissions = %w{camera contacts device geolocation
network media}
permissions = []
capabilities = []
phonegap_api = /http\:\/\/api.phonegap.com\/1[.]0\/(\w+)/
filtered_features = @config.feature_set.clone
filtered_features.each { |f|
next if f.name.nil?
matches = f.name.match(phonegap_api)
next if matches.nil? or matches.length < 1
next unless GAP_PERMISSIONS_MAP.has_key?(matches[1])
permissions << matches[1]
}
if @config.feature_set.empty? and
@config.preference(:permissions) != :none
permissions = default_permissions
end
permissions.each { |p|
capabilities.concat(GAP_PERMISSIONS_MAP[p])
}
capabilities.sort!
capabilities.map { |f| { :name => f } }
end
|
#description ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/confetti/templates/windows_phone7_manifest.rb', line 33
def description
if @config.description && @config.description.length >= 250
"#{ @config.description[0..245] }..."
else
@config.description
end
end
|
#guid ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/confetti/templates/windows_phone7_manifest.rb', line 24
def guid
package = @config.package
package ||= 'com.example.app'
guid = Digest::MD5.hexdigest package
res = "{#{ guid[0..7] }-#{ guid[8..11] }-"
res << "#{ guid[12..15] }-#{ guid[16..19] }-"
res << "#{ guid[20,guid.length-1]}}"
end
|
#output_filename ⇒ Object
75
76
77
|
# File 'lib/confetti/templates/windows_phone7_manifest.rb', line 75
def output_filename
"WMAppManifest.xml"
end
|
#title ⇒ Object
16
17
18
|
# File 'lib/confetti/templates/windows_phone7_manifest.rb', line 16
def title
@config.name.name
end
|
#version ⇒ Object
41
42
43
44
|
# File 'lib/confetti/templates/windows_phone7_manifest.rb', line 41
def version
version = normalize_version @config.version_string
version << ".0"
end
|