confetti 0.9.13 → 0.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/confetti.rb +1 -0
- data/lib/confetti/config.rb +22 -5
- data/lib/confetti/config/url_scheme.rb +16 -0
- data/lib/confetti/templates/ios_info.mustache +16 -1
- data/lib/confetti/templates/ios_info.rb +14 -0
- data/lib/confetti/version.rb +1 -1
- data/spec/config/config_url_scheme_spec.rb +22 -0
- data/spec/fixtures/android/AndroidManifest_bare.xml +1 -0
- data/spec/fixtures/android/AndroidManifest_expected.xml +1 -0
- data/spec/fixtures/android/android_manifest_spec.xml +1 -0
- data/spec/fixtures/android/android_manifest_spec_with_expected_orientation.xml +1 -0
- data/spec/fixtures/config_with_schemes.xml +28 -0
- data/spec/fixtures/ios/ios_info_expected.plist +2 -0
- data/spec/fixtures/ios/ios_info_spec.plist +2 -0
- data/spec/fixtures/ios/ios_info_spec_expected_orientation.plist +2 -0
- data/spec/fixtures/ios/ios_info_spec_expected_schemes.plist +58 -0
- data/spec/templates/ios_info_spec.rb +11 -0
- metadata +11 -4
data/Gemfile.lock
CHANGED
data/lib/confetti.rb
CHANGED
data/lib/confetti/config.rb
CHANGED
@@ -5,10 +5,11 @@ module Confetti
|
|
5
5
|
self.extend TemplateHelper
|
6
6
|
|
7
7
|
attr_accessor :package, :version_string, :version_code, :description,
|
8
|
-
:height, :width, :plist_icon_set
|
8
|
+
:height, :width, :plist_icon_set, :url_scheme_set
|
9
9
|
attr_reader :author, :viewmodes, :name, :license, :content,
|
10
10
|
:icon_set, :feature_set, :preference_set, :xml_doc,
|
11
|
-
:splash_set, :plist_icon_set, :access_set, :plugin_set
|
11
|
+
:splash_set, :plist_icon_set, :access_set, :plugin_set,
|
12
|
+
:url_scheme_set
|
12
13
|
|
13
14
|
generate_and_write :android_manifest, :android_strings,
|
14
15
|
:webos_appinfo, :ios_info, :symbian_wrt_info,
|
@@ -38,6 +39,7 @@ module Confetti
|
|
38
39
|
@splash_set = TypedSet.new Image
|
39
40
|
@preference_set = TypedSet.new Preference
|
40
41
|
@access_set = TypedSet.new Access
|
42
|
+
@url_scheme_set = TypedSet.new UrlScheme
|
41
43
|
|
42
44
|
# defined in PhoneGap module
|
43
45
|
@plugin_set = TypedSet.new Plugin
|
@@ -140,7 +142,12 @@ module Confetti
|
|
140
142
|
next if attr["src"].nil? or attr["src"].empty?
|
141
143
|
@splash_set << Image.new(attr["src"], attr["height"], attr["width"],
|
142
144
|
attr)
|
143
|
-
|
145
|
+
when "url-scheme"
|
146
|
+
schms = ele.elements.to_a('scheme').map { |a| a.text }
|
147
|
+
schms.reject! { |a| a.nil? || a.empty? }
|
148
|
+
next if schms.empty?
|
149
|
+
@url_scheme_set << UrlScheme.new(schms, attr["name"], attr["role"])
|
150
|
+
|
144
151
|
when "plugin"
|
145
152
|
next if attr["name"].nil? or attr["name"].empty?
|
146
153
|
plugin = Plugin.new(attr["name"], attr["version"])
|
@@ -208,8 +215,8 @@ module Confetti
|
|
208
215
|
opts['width'] ||= nil
|
209
216
|
opts['height'] ||= nil
|
210
217
|
opts['role'] ||= nil
|
211
|
-
opts['density']
|
212
|
-
opts['state']
|
218
|
+
opts['density'] ||= nil
|
219
|
+
opts['state'] ||= nil
|
213
220
|
opts['platform'] ||= nil
|
214
221
|
|
215
222
|
# filters to look through sets for
|
@@ -341,6 +348,15 @@ module Confetti
|
|
341
348
|
spl.add_attributes attrs
|
342
349
|
splashes << spl
|
343
350
|
end
|
351
|
+
|
352
|
+
url_schemes = []
|
353
|
+
@url_scheme_set.each do | scheme |
|
354
|
+
schm = REXML::Element.new( "gap:url-scheme" )
|
355
|
+
schm.add_attributes({"name" => scheme.name }) unless scheme.name.nil?
|
356
|
+
schm.add_attributes({"role" => scheme.role }) unless scheme.role.nil?
|
357
|
+
scheme.schemes.each{|s| schm.add_element("scheme").add_text(s) }
|
358
|
+
url_schemes << schm
|
359
|
+
end
|
344
360
|
|
345
361
|
preferences = []
|
346
362
|
@preference_set.each do | preference |
|
@@ -373,6 +389,7 @@ module Confetti
|
|
373
389
|
splashes.each { | splash | widget.elements.add splash }
|
374
390
|
preferences.each { | pref | widget.elements.add pref }
|
375
391
|
features.each { | feat | widget.elements.add feat }
|
392
|
+
url_schemes.each { | schm | widget.elements.add schm }
|
376
393
|
|
377
394
|
doc << REXML::XMLDecl.new
|
378
395
|
doc.elements.add widget
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Confetti
|
2
|
+
class Config
|
3
|
+
class UrlScheme
|
4
|
+
attr_accessor :name, :role, :schemes
|
5
|
+
|
6
|
+
def initialize *args
|
7
|
+
scheme_arg = args.shift
|
8
|
+
@schemes = scheme_arg.nil? ? [] : scheme_arg
|
9
|
+
@name = args.shift
|
10
|
+
@role = args.shift
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -62,5 +62,20 @@
|
|
62
62
|
<key>UIStatusBarStyle</key>
|
63
63
|
<string>{{ to_s }}</string>
|
64
64
|
{{/ statusbar_style }}
|
65
|
-
</
|
65
|
+
<key>CFBundleURLTypes</key>
|
66
|
+
<array>{{# url_schemes }}
|
67
|
+
<dict>
|
68
|
+
<key>CFBundleTypeRole</key>
|
69
|
+
<string>{{ role }}</string>
|
70
|
+
<key>CFBundleURLName</key>
|
71
|
+
<string>{{ name }}</string>
|
72
|
+
<key>CFBundleURLSchemes</key>
|
73
|
+
<array>
|
74
|
+
{{# schemes }}
|
75
|
+
<string>{{ to_s }}</string>
|
76
|
+
{{/ schemes }}
|
77
|
+
</array>
|
78
|
+
</dict>
|
79
|
+
{{/ url_schemes }}</array>
|
80
|
+
</dict>
|
66
81
|
</plist>
|
@@ -67,6 +67,20 @@ module Confetti
|
|
67
67
|
@config.preference(:fullscreen) == :true
|
68
68
|
end
|
69
69
|
|
70
|
+
def url_schemes
|
71
|
+
result = []
|
72
|
+
|
73
|
+
@config.url_scheme_set.each { |url_scheme|
|
74
|
+
result << {
|
75
|
+
:name => url_scheme.name || @config.package,
|
76
|
+
:role => %w{Editor Viewer Shell None}.find{|u| u == url_scheme.role} || "None",
|
77
|
+
:schemes => url_scheme.schemes
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
result
|
82
|
+
end
|
83
|
+
|
70
84
|
def prerendered_icon?
|
71
85
|
@config.preference("prerendered-icon") == :true
|
72
86
|
end
|
data/lib/confetti/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Confetti::Config::UrlScheme do
|
4
|
+
before do
|
5
|
+
@url_scheme = Confetti::Config::UrlScheme.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have a readable and writable name field" do
|
9
|
+
lambda { @url_scheme.name = "a" }.should_not raise_error
|
10
|
+
@url_scheme.name.should == "a"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have a readable and writable role field" do
|
14
|
+
lambda { @url_scheme.role = "a" }.should_not raise_error
|
15
|
+
@url_scheme.role.should == "a"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have a readable and writable schemes field" do
|
19
|
+
lambda { @url_scheme.schemes = ["a"] }.should_not raise_error
|
20
|
+
@url_scheme.schemes.should == ["a"]
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<widget xmlns = "http://www.w3.org/ns/widgets"
|
3
|
+
xmlns:gap = "http://phonegap.com/ns/1.0"
|
4
|
+
id = "com.nitobi.johngarrett"
|
5
|
+
version = "1.0"
|
6
|
+
versionCode = "5">
|
7
|
+
|
8
|
+
<name>John Garrett Drinking Game</name>
|
9
|
+
|
10
|
+
<description>
|
11
|
+
If you're watching a Canucks game, you need play this.
|
12
|
+
</description>
|
13
|
+
|
14
|
+
<author href="http://www.nitobi.com" email="support@nitobi.com">
|
15
|
+
Tim Kim, Ryan Betts, Fil Maj
|
16
|
+
</author>
|
17
|
+
|
18
|
+
<icon src="img/beer_72.png" width="72" height="72" />
|
19
|
+
<icon src="img/beer_48.png" width="48" height="48" />
|
20
|
+
<icon src="img/beer_36.png" width="36" height="36" />
|
21
|
+
|
22
|
+
<preference name="orientation" value="landscape" />
|
23
|
+
|
24
|
+
<gap:url-scheme name="com.phonegap.test" role="Shell">
|
25
|
+
<scheme>pgb</scheme>
|
26
|
+
</gap:url-scheme>
|
27
|
+
|
28
|
+
</widget>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleIconFiles</key>
|
6
|
+
<array>
|
7
|
+
<string>img/beer_72.png</string>
|
8
|
+
<string>img/beer_48.png</string>
|
9
|
+
<string>img/beer_36.png</string>
|
10
|
+
</array>
|
11
|
+
<key>UISupportedInterfaceOrientations~ipad</key>
|
12
|
+
<array>
|
13
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
14
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
15
|
+
</array>
|
16
|
+
<key>UISupportedInterfaceOrientations</key>
|
17
|
+
<array>
|
18
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
19
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
20
|
+
</array>
|
21
|
+
<key>CFBundleDevelopmentRegion</key>
|
22
|
+
<string>English</string>
|
23
|
+
<key>CFBundleDisplayName</key>
|
24
|
+
<string>John Garrett Drinking Game</string>
|
25
|
+
<key>CFBundleExecutable</key>
|
26
|
+
<string>${EXECUTABLE_NAME}</string>
|
27
|
+
<key>CFBundleIconFile</key>
|
28
|
+
<string>icon.png</string>
|
29
|
+
<key>CFBundleIdentifier</key>
|
30
|
+
<string>com.nitobi.johngarrett</string>
|
31
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
32
|
+
<string>6.0</string>
|
33
|
+
<key>CFBundleName</key>
|
34
|
+
<string>John Garrett Drinking Game</string>
|
35
|
+
<key>CFBundlePackageType</key>
|
36
|
+
<string>APPL</string>
|
37
|
+
<key>CFBundleSignature</key>
|
38
|
+
<string>????</string>
|
39
|
+
<key>CFBundleVersion</key>
|
40
|
+
<string>1.0</string>
|
41
|
+
<key>LSRequiresIPhoneOS</key>
|
42
|
+
<true/>
|
43
|
+
<key>NSMainNibFile</key>
|
44
|
+
<string></string>
|
45
|
+
<key>CFBundleURLTypes</key>
|
46
|
+
<array><dict>
|
47
|
+
<key>CFBundleTypeRole</key>
|
48
|
+
<string>Shell</string>
|
49
|
+
<key>CFBundleURLName</key>
|
50
|
+
<string>com.phonegap.test</string>
|
51
|
+
<key>CFBundleURLSchemes</key>
|
52
|
+
<array>
|
53
|
+
<string>pgb</string>
|
54
|
+
</array>
|
55
|
+
</dict>
|
56
|
+
</array>
|
57
|
+
</dict>
|
58
|
+
</plist>
|
@@ -115,6 +115,17 @@ describe Confetti::Template::IosInfo do
|
|
115
115
|
@template.render.should == File.read("#{ fixture_dir }/ios/ios_info_spec_expected_orientation.plist")
|
116
116
|
end
|
117
117
|
end
|
118
|
+
|
119
|
+
describe "ios url schemes" do
|
120
|
+
before do
|
121
|
+
@config = Confetti::Config.new("#{fixture_dir}/config_with_schemes.xml")
|
122
|
+
@template = @template_class.new(@config)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should populate the info.plist with the schemes" do
|
126
|
+
@template.render.should == File.read("#{ fixture_dir }/ios/ios_info_spec_expected_schemes.plist")
|
127
|
+
end
|
128
|
+
end
|
118
129
|
|
119
130
|
describe "should specify if the application is universal" do
|
120
131
|
before do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confetti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 39
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 14
|
10
|
+
version: 0.9.14
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Lunny
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2013-
|
20
|
+
date: 2013-05-28 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: mustache
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/confetti/config/classes.rb
|
74
74
|
- lib/confetti/config/feature.rb
|
75
75
|
- lib/confetti/config/image.rb
|
76
|
+
- lib/confetti/config/url_scheme.rb
|
76
77
|
- lib/confetti/error.rb
|
77
78
|
- lib/confetti/helpers.rb
|
78
79
|
- lib/confetti/phonegap.rb
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- spec/config/config_license_spec.rb
|
111
112
|
- spec/config/config_name_spec.rb
|
112
113
|
- spec/config/config_preference_spec.rb
|
114
|
+
- spec/config/config_url_scheme_spec.rb
|
113
115
|
- spec/config_spec.rb
|
114
116
|
- spec/fixtures/android/AndroidManifest_bare.xml
|
115
117
|
- spec/fixtures/android/AndroidManifest_expected.xml
|
@@ -138,6 +140,7 @@ files:
|
|
138
140
|
- spec/fixtures/config_with_access.xml
|
139
141
|
- spec/fixtures/config_with_android_versions.xml
|
140
142
|
- spec/fixtures/config_with_orientation.xml
|
143
|
+
- spec/fixtures/config_with_schemes.xml
|
141
144
|
- spec/fixtures/config_with_version_code.xml
|
142
145
|
- spec/fixtures/configs/blank-splash.xml
|
143
146
|
- spec/fixtures/configs/config_bare.xml
|
@@ -147,6 +150,7 @@ files:
|
|
147
150
|
- spec/fixtures/ios/ios_info_expected.plist
|
148
151
|
- spec/fixtures/ios/ios_info_spec.plist
|
149
152
|
- spec/fixtures/ios/ios_info_spec_expected_orientation.plist
|
153
|
+
- spec/fixtures/ios/ios_info_spec_expected_schemes.plist
|
150
154
|
- spec/fixtures/symbian/symbian_wrt_info_expected.plist
|
151
155
|
- spec/fixtures/symbian/symbian_wrt_info_spec.plist
|
152
156
|
- spec/fixtures/webos/appinfo_expected.json
|
@@ -212,6 +216,7 @@ test_files:
|
|
212
216
|
- spec/config/config_license_spec.rb
|
213
217
|
- spec/config/config_name_spec.rb
|
214
218
|
- spec/config/config_preference_spec.rb
|
219
|
+
- spec/config/config_url_scheme_spec.rb
|
215
220
|
- spec/config_spec.rb
|
216
221
|
- spec/fixtures/android/AndroidManifest_bare.xml
|
217
222
|
- spec/fixtures/android/AndroidManifest_expected.xml
|
@@ -240,6 +245,7 @@ test_files:
|
|
240
245
|
- spec/fixtures/config_with_access.xml
|
241
246
|
- spec/fixtures/config_with_android_versions.xml
|
242
247
|
- spec/fixtures/config_with_orientation.xml
|
248
|
+
- spec/fixtures/config_with_schemes.xml
|
243
249
|
- spec/fixtures/config_with_version_code.xml
|
244
250
|
- spec/fixtures/configs/blank-splash.xml
|
245
251
|
- spec/fixtures/configs/config_bare.xml
|
@@ -249,6 +255,7 @@ test_files:
|
|
249
255
|
- spec/fixtures/ios/ios_info_expected.plist
|
250
256
|
- spec/fixtures/ios/ios_info_spec.plist
|
251
257
|
- spec/fixtures/ios/ios_info_spec_expected_orientation.plist
|
258
|
+
- spec/fixtures/ios/ios_info_spec_expected_schemes.plist
|
252
259
|
- spec/fixtures/symbian/symbian_wrt_info_expected.plist
|
253
260
|
- spec/fixtures/symbian/symbian_wrt_info_spec.plist
|
254
261
|
- spec/fixtures/webos/appinfo_expected.json
|