confetti 0.5.5 → 0.6.0
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/config.rb +7 -15
- data/lib/confetti/version.rb +1 -1
- data/spec/config_spec.rb +17 -13
- data/spec/fixtures/config.xml +2 -4
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/confetti/config.rb
CHANGED
@@ -14,7 +14,7 @@ module Confetti
|
|
14
14
|
:height, :width, :plist_icon_set
|
15
15
|
attr_reader :author, :viewmodes, :name, :license, :content,
|
16
16
|
:icon_set, :feature_set, :preference_set, :xml_doc,
|
17
|
-
:splash_set, :plist_icon_set, :
|
17
|
+
:splash_set, :plist_icon_set, :access_set
|
18
18
|
|
19
19
|
generate_and_write :android_manifest, :android_strings, :webos_appinfo,
|
20
20
|
:ios_info, :symbian_wrt_info, :blackberry_widgets_config,
|
@@ -40,7 +40,7 @@ module Confetti
|
|
40
40
|
Image = Class.new Struct.new(:src, :height, :width, :extras)
|
41
41
|
Feature = Class.new Struct.new(:name, :required)
|
42
42
|
Preference = Class.new Struct.new(:name, :value, :readonly)
|
43
|
-
|
43
|
+
Access = Class.new Struct.new(:origin, :subdomains)
|
44
44
|
|
45
45
|
def initialize(*args)
|
46
46
|
@author = Author.new
|
@@ -52,7 +52,7 @@ module Confetti
|
|
52
52
|
@feature_set = TypedSet.new Feature
|
53
53
|
@splash_set = TypedSet.new Image
|
54
54
|
@preference_set = TypedSet.new Preference
|
55
|
-
@
|
55
|
+
@access_set = TypedSet.new Access
|
56
56
|
@viewmodes = []
|
57
57
|
|
58
58
|
if args.length > 0 && is_file?(args.first)
|
@@ -106,6 +106,10 @@ module Confetti
|
|
106
106
|
@preference_set << Preference.new(attr["name"], attr["value"], attr["readonly"])
|
107
107
|
when "license"
|
108
108
|
@license = License.new(ele.text.nil? ? "" : ele.text.strip, attr["href"])
|
109
|
+
when "access"
|
110
|
+
sub = attr["subdomains"]
|
111
|
+
sub = sub.nil? ? true : (sub != 'false')
|
112
|
+
@access_set << Access.new(attr["origin"], sub)
|
109
113
|
end
|
110
114
|
|
111
115
|
# PhoneGap extensions (gap:)
|
@@ -115,10 +119,6 @@ module Confetti
|
|
115
119
|
next if attr["src"].nil? or attr["src"].empty?
|
116
120
|
extras = grab_extras attr
|
117
121
|
@splash_set << Image.new(attr["src"], attr["height"], attr["width"], extras)
|
118
|
-
when "plugin"
|
119
|
-
plugin = Plugin.new(attr["name"], attr["value"])
|
120
|
-
plugin.platforms = plugin_platforms(ele)
|
121
|
-
@plugin_set << plugin
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -165,14 +165,6 @@ module Confetti
|
|
165
165
|
pref && pref.value && pref.value.to_sym
|
166
166
|
end
|
167
167
|
|
168
|
-
# retrieve the specified platforms as a list of lowercase symbols
|
169
|
-
# extracted from children of ele
|
170
|
-
def plugin_platforms ele
|
171
|
-
ele.children.
|
172
|
-
select { |e| e.respond_to?(:name) and e.name == "platform" }.
|
173
|
-
map { |e| e.attributes["name"].downcase.to_sym }
|
174
|
-
end
|
175
|
-
|
176
168
|
# mostly an internal method to help with weird cases
|
177
169
|
# in particular #phonegap_version
|
178
170
|
def preference_obj name
|
data/lib/confetti/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -346,28 +346,32 @@ describe Confetti::Config do
|
|
346
346
|
end
|
347
347
|
end
|
348
348
|
|
349
|
-
describe "
|
350
|
-
it "should append
|
351
|
-
@config.
|
349
|
+
describe "access" do
|
350
|
+
it "should append tags to the access set" do
|
351
|
+
@config.access_set.size.should be 2
|
352
352
|
end
|
353
353
|
|
354
|
-
describe "created object" do
|
354
|
+
describe "created access object" do
|
355
355
|
before do
|
356
|
-
@
|
356
|
+
@bar = @config.access_set.detect do |a|
|
357
|
+
a.origin == "http://bar.phonegap.com"
|
358
|
+
end
|
359
|
+
@foo = @config.access_set.detect do |a|
|
360
|
+
a.origin == "http://foo.phonegap.com"
|
361
|
+
end
|
357
362
|
end
|
358
363
|
|
359
|
-
it "should
|
360
|
-
@
|
364
|
+
it "should read the origins correctly" do
|
365
|
+
@foo.should be_true
|
366
|
+
@bar.should be_true # truthy (should exist)
|
361
367
|
end
|
362
368
|
|
363
|
-
it "should
|
364
|
-
|
365
|
-
@plugin.value.should == package
|
369
|
+
it "should default subdomains to true" do
|
370
|
+
@foo.subdomains.should be_true
|
366
371
|
end
|
367
372
|
|
368
|
-
it "should
|
369
|
-
@
|
370
|
-
@plugin.platforms.first.should be :android
|
373
|
+
it "should allow subdomains to be set to false" do
|
374
|
+
@bar.subdomains.should be_false
|
371
375
|
end
|
372
376
|
end
|
373
377
|
end
|
data/spec/fixtures/config.xml
CHANGED
@@ -48,8 +48,6 @@ THE SOFTWARE.</license>
|
|
48
48
|
<feature name="http://api.phonegap.com/1.0/camera" required="true"/>
|
49
49
|
<feature name="http://api.phonegap.com/1.0/notification" required="true"/>
|
50
50
|
|
51
|
-
<
|
52
|
-
|
53
|
-
<platform name="android" />
|
54
|
-
</gap:plugin>
|
51
|
+
<access origin="http://foo.phonegap.com" />
|
52
|
+
<access origin="http://bar.phonegap.com" subdomains="false" />
|
55
53
|
</widget>
|
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
|
+
- 6
|
8
|
+
- 0
|
9
|
+
version: 0.6.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-19 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|