confetti 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/confetti.rb +2 -0
- data/lib/confetti/config.rb +1 -1
- data/lib/confetti/templates/windows_phone7_manifest.mustache +30 -0
- data/lib/confetti/templates/windows_phone7_manifest.rb +62 -0
- data/lib/confetti/version.rb +1 -1
- data/spec/config_spec.rb +2 -0
- data/spec/fixtures/windowsphone7/WMAppManifest.xml +30 -0
- data/spec/templates/windows_phone7_manifest_spec.rb +49 -0
- metadata +10 -4
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/confetti.rb
CHANGED
@@ -2,6 +2,7 @@ CURRENT_DIR = File.dirname(__FILE__)
|
|
2
2
|
|
3
3
|
# stdlib
|
4
4
|
require "rexml/document"
|
5
|
+
require 'digest/md5'
|
5
6
|
|
6
7
|
# external dependencies
|
7
8
|
begin
|
@@ -32,6 +33,7 @@ require 'confetti/templates/ios_info'
|
|
32
33
|
require 'confetti/templates/ios_remote_plist'
|
33
34
|
require 'confetti/templates/symbian_wrt_info'
|
34
35
|
require 'confetti/templates/webos_appinfo'
|
36
|
+
require 'confetti/templates/windows_phone7_manifest'
|
35
37
|
|
36
38
|
require 'confetti/template_helper'
|
37
39
|
|
data/lib/confetti/config.rb
CHANGED
@@ -18,7 +18,7 @@ module Confetti
|
|
18
18
|
|
19
19
|
generate_and_write :android_manifest, :android_strings, :webos_appinfo,
|
20
20
|
:ios_info, :symbian_wrt_info, :blackberry_widgets_config,
|
21
|
-
:ios_remote_plist
|
21
|
+
:ios_remote_plist, :windows_phone7_manifest
|
22
22
|
|
23
23
|
# handle bad generate/write calls
|
24
24
|
def method_missing(method_name, *args)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
|
3
|
+
<App xmlns="" ProductID="{{guid}}" Title="{{ title }}"
|
4
|
+
RuntimeType="Silverlight" Version="{{version}}" Genre="apps.normal"
|
5
|
+
Author="{{ author }}"
|
6
|
+
Description="{{ description }}"
|
7
|
+
Publisher="{{ author }}">
|
8
|
+
|
9
|
+
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
|
10
|
+
<Capabilities>
|
11
|
+
{{#capabilities}}
|
12
|
+
<Capability Name="{{name}}" />
|
13
|
+
{{/capabilities}}
|
14
|
+
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
|
15
|
+
</Capabilities>
|
16
|
+
|
17
|
+
<Tasks>
|
18
|
+
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
|
19
|
+
</Tasks>
|
20
|
+
<Tokens>
|
21
|
+
<PrimaryToken TokenID="Cordova_1._5._0_Starter1Token" TaskName="_default">
|
22
|
+
<TemplateType5>
|
23
|
+
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
|
24
|
+
<Count>0</Count>
|
25
|
+
<Title>Cordova_1._5._0_Starter1</Title>
|
26
|
+
</TemplateType5>
|
27
|
+
</PrimaryToken>
|
28
|
+
</Tokens>
|
29
|
+
</App>
|
30
|
+
</Deployment>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Confetti
|
2
|
+
module Template
|
3
|
+
class WindowsPhone7Manifest < Base
|
4
|
+
include VersionHelper
|
5
|
+
|
6
|
+
GAP_PERMISSIONS_MAP = {
|
7
|
+
'camera' => %w{ID_CAP_ISV_CAMERA
|
8
|
+
D_HW_FRONTCAMERA},
|
9
|
+
'contacts' => %w{ID_CAP_CONTACTS},
|
10
|
+
'device' => %w{ID_CAP_IDENTITY_DEVICE},
|
11
|
+
'geolocation' => %w{ID_CAP_LOCATION},
|
12
|
+
'networking' => %w{ID_CAP_NETWORKING},
|
13
|
+
'media' => %w{ID_CAP_MICROPHONE},
|
14
|
+
}
|
15
|
+
|
16
|
+
def title
|
17
|
+
@config.name.name
|
18
|
+
end
|
19
|
+
|
20
|
+
def author
|
21
|
+
@config.author.name
|
22
|
+
end
|
23
|
+
|
24
|
+
def guid
|
25
|
+
guid = Digest::MD5.hexdigest @config.package
|
26
|
+
res = "{#{ guid[0..7] }-#{ guid[8..11] }-"
|
27
|
+
res << "#{ guid[12..15] }-#{ guid[16..19] }-"
|
28
|
+
res << "#{ guid[20,guid.length-1]}}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def description
|
32
|
+
@config.description
|
33
|
+
end
|
34
|
+
|
35
|
+
def version
|
36
|
+
version = normalize_version @config.version_string
|
37
|
+
version << ".0"
|
38
|
+
end
|
39
|
+
|
40
|
+
def capabilities
|
41
|
+
permissions = []
|
42
|
+
phonegap_api = /http\:\/\/api.phonegap.com\/1[.]0\/(\w+)/
|
43
|
+
|
44
|
+
feature_names = @config.feature_set.map { |f| f.name }
|
45
|
+
feature_names.sort
|
46
|
+
|
47
|
+
feature_names.each do |f|
|
48
|
+
feature_name = f.match(phonegap_api)[1] if f.match(phonegap_api)
|
49
|
+
associated_permissions = GAP_PERMISSIONS_MAP[feature_name]
|
50
|
+
permissions.concat(associated_permissions) if associated_permissions
|
51
|
+
end
|
52
|
+
|
53
|
+
permissions.sort!
|
54
|
+
permissions.map { |f| { :name => f } }
|
55
|
+
end
|
56
|
+
|
57
|
+
def output_filename
|
58
|
+
"WMAppManifest.xml"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/confetti/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -395,6 +395,8 @@ describe Confetti::Config do
|
|
395
395
|
it_should_have_generate_and_write_methods_for :symbian_wrt_info
|
396
396
|
|
397
397
|
it_should_have_generate_and_write_methods_for :blackberry_widgets_config
|
398
|
+
|
399
|
+
it_should_have_generate_and_write_methods_for :windows_phone7_manifest
|
398
400
|
end
|
399
401
|
|
400
402
|
describe "icon helpers" do
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
|
3
|
+
<App xmlns="" ProductID="{6c724dc0-52a1-7928-dc98-6b05e95fb30e}" Title="Confetti Sample App"
|
4
|
+
RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal"
|
5
|
+
Author="Andrew Lunny"
|
6
|
+
Description="This is a sample config.xml for integration testing with Confetti"
|
7
|
+
Publisher="Andrew Lunny">
|
8
|
+
|
9
|
+
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
|
10
|
+
<Capabilities>
|
11
|
+
<Capability Name="D_HW_FRONTCAMERA" />
|
12
|
+
<Capability Name="ID_CAP_ISV_CAMERA" />
|
13
|
+
<Capability Name="ID_CAP_LOCATION" />
|
14
|
+
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
|
15
|
+
</Capabilities>
|
16
|
+
|
17
|
+
<Tasks>
|
18
|
+
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
|
19
|
+
</Tasks>
|
20
|
+
<Tokens>
|
21
|
+
<PrimaryToken TokenID="Cordova_1._5._0_Starter1Token" TaskName="_default">
|
22
|
+
<TemplateType5>
|
23
|
+
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
|
24
|
+
<Count>0</Count>
|
25
|
+
<Title>Cordova_1._5._0_Starter1</Title>
|
26
|
+
</TemplateType5>
|
27
|
+
</PrimaryToken>
|
28
|
+
</Tokens>
|
29
|
+
</App>
|
30
|
+
</Deployment>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Confetti::Template::WindowsPhone7Manifest do
|
4
|
+
include HelpfulPaths
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
@template_class = Confetti::Template::WindowsPhone7Manifest
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have the base class of Confetti::Template" do
|
11
|
+
@template_class.superclass.should == Confetti::Template::Base
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have a valid WMAppManifest mustace template" do
|
15
|
+
@template_class.template_file.should == "#{ templates_dir }/windows_phone7_manifest.mustache"
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "attributes" do
|
19
|
+
subject { @template = @template_class.new }
|
20
|
+
|
21
|
+
it { should respond_to :title }
|
22
|
+
it { should respond_to :author }
|
23
|
+
it { should respond_to :guid }
|
24
|
+
it { should respond_to :description }
|
25
|
+
it { should respond_to :version }
|
26
|
+
it { should respond_to :capabilities }
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should provide a 128 bit guid" do
|
30
|
+
@config = Confetti::Config.new
|
31
|
+
@config.package = "com.example.www"
|
32
|
+
@template = @template_class.new @config
|
33
|
+
@template.guid.should == "{1005a3fc-23ab-99bd-bdd1-9e83f3d7b989}"
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "with a config object" do
|
37
|
+
|
38
|
+
before do
|
39
|
+
@config = Confetti::Config.new "#{fixture_dir}/config.xml"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should render" do
|
43
|
+
@template = @template_class.new @config
|
44
|
+
@template.render.should == File.read(
|
45
|
+
"#{fixture_dir}/windowsphone7/WMAppManifest.xml"
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 7
|
8
|
+
- 0
|
9
|
+
version: 0.7.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrew Lunny
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-03-
|
19
|
+
date: 2012-03-21 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -91,6 +91,8 @@ files:
|
|
91
91
|
- lib/confetti/templates/version_helper.rb
|
92
92
|
- lib/confetti/templates/webos_appinfo.mustache
|
93
93
|
- lib/confetti/templates/webos_appinfo.rb
|
94
|
+
- lib/confetti/templates/windows_phone7_manifest.mustache
|
95
|
+
- lib/confetti/templates/windows_phone7_manifest.rb
|
94
96
|
- lib/confetti/version.rb
|
95
97
|
- lib/typedset.rb
|
96
98
|
- spec/config/config_author_spec.rb
|
@@ -134,6 +136,7 @@ files:
|
|
134
136
|
- spec/fixtures/webos/appinfo_expected.json
|
135
137
|
- spec/fixtures/webos/appinfo_no_tablet.json
|
136
138
|
- spec/fixtures/webos/webos_appinfo_spec.json
|
139
|
+
- spec/fixtures/windowsphone7/WMAppManifest.xml
|
137
140
|
- spec/helpers_spec.rb
|
138
141
|
- spec/integration_spec.rb
|
139
142
|
- spec/phonegap_spec.rb
|
@@ -148,6 +151,7 @@ files:
|
|
148
151
|
- spec/templates/symbian_wrt_info_spec.rb
|
149
152
|
- spec/templates/version_helper_spec.rb
|
150
153
|
- spec/templates/webos_appinfo_spec.rb
|
154
|
+
- spec/templates/windows_phone7_manifest_spec.rb
|
151
155
|
- spec/typedset_spec.rb
|
152
156
|
has_rdoc: true
|
153
157
|
homepage: http://rubygems.org/gems/confetti
|
@@ -221,6 +225,7 @@ test_files:
|
|
221
225
|
- spec/fixtures/webos/appinfo_expected.json
|
222
226
|
- spec/fixtures/webos/appinfo_no_tablet.json
|
223
227
|
- spec/fixtures/webos/webos_appinfo_spec.json
|
228
|
+
- spec/fixtures/windowsphone7/WMAppManifest.xml
|
224
229
|
- spec/helpers_spec.rb
|
225
230
|
- spec/integration_spec.rb
|
226
231
|
- spec/phonegap_spec.rb
|
@@ -235,4 +240,5 @@ test_files:
|
|
235
240
|
- spec/templates/symbian_wrt_info_spec.rb
|
236
241
|
- spec/templates/version_helper_spec.rb
|
237
242
|
- spec/templates/webos_appinfo_spec.rb
|
243
|
+
- spec/templates/windows_phone7_manifest_spec.rb
|
238
244
|
- spec/typedset_spec.rb
|