confetti 0.8.3 → 0.9.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/lib/confetti/config.rb +128 -54
- data/lib/confetti/config/classes.rb +75 -8
- data/lib/confetti/config/image.rb +13 -0
- data/lib/confetti/version.rb +1 -1
- data/spec/config/config_access_spec.rb +17 -0
- data/spec/config/config_author_spec.rb +15 -1
- data/spec/config/config_content_spec.rb +9 -0
- data/spec/config/config_feature_spec.rb +9 -0
- data/spec/config/config_image_spec.rb +15 -0
- data/spec/config/config_license_spec.rb +17 -2
- data/spec/config/config_name_spec.rb +12 -1
- data/spec/config/config_preference_spec.rb +11 -0
- data/spec/config_spec.rb +35 -1
- data/spec/fixtures/config-to_xml.xml +36 -0
- metadata +8 -4
data/lib/confetti/config.rb
CHANGED
@@ -27,7 +27,7 @@ module Confetti
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def initialize(*args)
|
30
|
+
def initialize( *args )
|
31
31
|
@author = Author.new
|
32
32
|
@name = Name.new
|
33
33
|
@license = License.new
|
@@ -43,27 +43,43 @@ module Confetti
|
|
43
43
|
@plugin_set = TypedSet.new Plugin
|
44
44
|
@viewmodes = []
|
45
45
|
|
46
|
-
if args.
|
47
|
-
|
46
|
+
return if args.empty?
|
47
|
+
|
48
|
+
input = args.first
|
49
|
+
|
50
|
+
if is_file?( input ) || File.extname( input ) == ".xml"
|
51
|
+
populate_from_xml input
|
52
|
+
elsif input.kind_of?( String )
|
53
|
+
populate_from_string input
|
48
54
|
end
|
49
55
|
end
|
50
56
|
|
51
57
|
def populate_from_xml(xml_file)
|
52
58
|
begin
|
53
59
|
file = File.read(xml_file)
|
54
|
-
config_doc = REXML::Document.new(file).root
|
55
|
-
rescue REXML::ParseException
|
56
|
-
raise XMLError, "malformed config.xml"
|
57
60
|
rescue Errno::ENOENT
|
58
61
|
raise FileError, "file #{ xml_file } doesn't exist"
|
59
62
|
end
|
63
|
+
|
64
|
+
populate file
|
65
|
+
end
|
66
|
+
|
67
|
+
def populate_from_string( xml_str )
|
68
|
+
populate xml_str
|
69
|
+
end
|
70
|
+
|
71
|
+
def populate( config_doc )
|
72
|
+
begin
|
73
|
+
config_doc = REXML::Document.new( config_doc ).root
|
74
|
+
rescue REXML::ParseException
|
75
|
+
raise XMLError, "malformed config.xml"
|
76
|
+
end
|
60
77
|
|
61
78
|
if config_doc.nil?
|
62
79
|
raise XMLError, "no doc parsed"
|
63
80
|
end
|
64
81
|
|
65
|
-
# save reference to
|
66
|
-
@xml_doc = config_doc
|
82
|
+
@xml_doc = config_doc # save reference to doc
|
67
83
|
|
68
84
|
@package = config_doc.attributes["id"]
|
69
85
|
@version_string = config_doc.attributes["version"]
|
@@ -78,58 +94,37 @@ module Confetti
|
|
78
94
|
when "http://www.w3.org/ns/widgets"
|
79
95
|
case ele.name
|
80
96
|
when "name"
|
81
|
-
@name = Name.new(
|
82
|
-
|
83
|
-
attr["shortname"]
|
84
|
-
)
|
97
|
+
@name = Name.new(ele.text.nil? ? "" : ele.text.strip,
|
98
|
+
attr["shortname"])
|
85
99
|
|
86
100
|
when "author"
|
87
|
-
@author = Author.new(
|
88
|
-
|
89
|
-
attr["href"],
|
90
|
-
attr["email"]
|
91
|
-
)
|
101
|
+
@author = Author.new(ele.text.nil? ? "" : ele.text.strip,
|
102
|
+
attr["href"], attr["email"])
|
92
103
|
|
93
104
|
when "description"
|
94
105
|
@description = ele.text.nil? ? "" : ele.text.strip
|
95
106
|
|
96
107
|
when "icon"
|
97
|
-
@icon_set << Image.new(
|
98
|
-
|
99
|
-
attr["height"],
|
100
|
-
attr["width"],
|
101
|
-
attr
|
102
|
-
)
|
108
|
+
@icon_set << Image.new(attr["src"], attr["height"], attr["width"],
|
109
|
+
attr)
|
103
110
|
# used for the info.plist file
|
104
111
|
@plist_icon_set << attr["src"]
|
105
112
|
|
106
113
|
when "feature"
|
107
|
-
@feature_set << Feature.new(
|
108
|
-
attr["name"],
|
109
|
-
attr["required"]
|
110
|
-
)
|
114
|
+
@feature_set << Feature.new(attr["name"], attr["required"])
|
111
115
|
|
112
116
|
when "preference"
|
113
|
-
@preference_set << Preference.new(
|
114
|
-
|
115
|
-
attr["value"],
|
116
|
-
attr["readonly"]
|
117
|
-
)
|
117
|
+
@preference_set << Preference.new(attr["name"], attr["value"],
|
118
|
+
attr["readonly"])
|
118
119
|
|
119
120
|
when "license"
|
120
|
-
@license = License.new(
|
121
|
-
|
122
|
-
attr["href"]
|
123
|
-
)
|
121
|
+
@license = License.new(ele.text.nil? ? "" : ele.text.strip,
|
122
|
+
attr["href"])
|
124
123
|
|
125
124
|
when "access"
|
126
125
|
sub = boolean_value(attr["subdomains"], true)
|
127
126
|
browserOnly = boolean_value(attr["browserOnly"])
|
128
|
-
@access_set << Access.new(
|
129
|
-
attr["origin"],
|
130
|
-
sub,
|
131
|
-
browserOnly
|
132
|
-
)
|
127
|
+
@access_set << Access.new(attr["origin"], sub, browserOnly)
|
133
128
|
end
|
134
129
|
|
135
130
|
# PhoneGap extensions (gap:)
|
@@ -137,22 +132,15 @@ module Confetti
|
|
137
132
|
case ele.name
|
138
133
|
when "splash"
|
139
134
|
next if attr["src"].nil? or attr["src"].empty?
|
140
|
-
@splash_set << Image.new(
|
141
|
-
|
142
|
-
attr["height"],
|
143
|
-
attr["width"],
|
144
|
-
attr
|
145
|
-
)
|
135
|
+
@splash_set << Image.new(attr["src"], attr["height"], attr["width"],
|
136
|
+
attr)
|
146
137
|
|
147
138
|
when "plugin"
|
148
139
|
next if attr["name"].nil? or attr["name"].empty?
|
149
140
|
plugin = Plugin.new(attr["name"], attr["version"])
|
150
141
|
ele.each_element('param') do |param|
|
151
142
|
p_attr = param.attributes
|
152
|
-
plugin.param_set << Param.new(
|
153
|
-
p_attr["name"],
|
154
|
-
p_attr["value"]
|
155
|
-
)
|
143
|
+
plugin.param_set << Param.new(p_attr["name"], p_attr["value"])
|
156
144
|
end
|
157
145
|
@plugin_set << plugin
|
158
146
|
end
|
@@ -277,17 +265,103 @@ module Confetti
|
|
277
265
|
def filtered_to_s( xpaths = [] )
|
278
266
|
xpaths = [ xpaths ] unless xpaths.kind_of?(Array)
|
279
267
|
|
280
|
-
|
268
|
+
xml = @xml_doc.dup unless @xml_doc.nil?
|
269
|
+
xml ||= to_xml
|
281
270
|
|
282
271
|
xpaths.each do |path|
|
283
|
-
|
272
|
+
xml.root.elements.delete_all path
|
284
273
|
end
|
285
274
|
|
286
|
-
|
275
|
+
xml.root.to_s
|
287
276
|
end
|
288
277
|
|
289
278
|
def to_s
|
290
279
|
@xml_doc.root.to_s
|
291
280
|
end
|
281
|
+
|
282
|
+
def to_xml
|
283
|
+
doc = REXML::Document.new
|
284
|
+
|
285
|
+
widget = REXML::Element.new( "widget" )
|
286
|
+
widget.add_attributes({
|
287
|
+
"xmlns" => "http://www.w3.org/ns/widgets",
|
288
|
+
"xmlns:gap" => "http://phonegap.com/ns/1.0",
|
289
|
+
"id" => @package,
|
290
|
+
"version" => @version_string
|
291
|
+
})
|
292
|
+
|
293
|
+
if !@version_code.nil?
|
294
|
+
widget.add_attribute({ "versionCode" => @version_code })
|
295
|
+
end
|
296
|
+
|
297
|
+
name = REXML::Element.new( "name" )
|
298
|
+
name.text = @name.name
|
299
|
+
name.add_attribute({ "shortname" => @name.shortname })
|
300
|
+
|
301
|
+
author = REXML::Element.new( "author" )
|
302
|
+
author.text = @author.name
|
303
|
+
author.add_attributes({
|
304
|
+
"href" => @author.href,
|
305
|
+
"email" => @author.email
|
306
|
+
})
|
307
|
+
|
308
|
+
description = REXML::Element.new( "description" )
|
309
|
+
description.text = @description
|
310
|
+
|
311
|
+
license = REXML::Element.new( "license" )
|
312
|
+
license.text = @license.text
|
313
|
+
license.add_attribute({ "href" => @license.href })
|
314
|
+
|
315
|
+
icons = []
|
316
|
+
@icon_set.each do | icon |
|
317
|
+
ico = REXML::Element.new( "icon" )
|
318
|
+
attrs = icon.defined_attrs
|
319
|
+
ico.add_attributes attrs
|
320
|
+
icons << ico
|
321
|
+
end
|
322
|
+
|
323
|
+
splashes = []
|
324
|
+
@splash_set.each do | splash |
|
325
|
+
spl = REXML::Element.new( "gap:splash" )
|
326
|
+
attrs = splash.defined_attrs
|
327
|
+
spl.add_attributes attrs
|
328
|
+
splashes << spl
|
329
|
+
end
|
330
|
+
|
331
|
+
preferences = []
|
332
|
+
@preference_set.each do | preference |
|
333
|
+
pref = REXML::Element.new( "preference" )
|
334
|
+
pref.add_attributes({
|
335
|
+
"name" => preference.name,
|
336
|
+
"value" => preference.value,
|
337
|
+
"readonly" => preference.readonly
|
338
|
+
})
|
339
|
+
preferences << pref
|
340
|
+
end
|
341
|
+
|
342
|
+
features = []
|
343
|
+
@feature_set.each do | feature |
|
344
|
+
feat = REXML::Element.new( "feature" )
|
345
|
+
feat.add_attributes({
|
346
|
+
"name" => feature.name,
|
347
|
+
"required" => feature.required,
|
348
|
+
})
|
349
|
+
features << feat
|
350
|
+
end
|
351
|
+
|
352
|
+
widget.elements.add name
|
353
|
+
widget.elements.add author
|
354
|
+
widget.elements.add description
|
355
|
+
widget.elements.add license
|
356
|
+
|
357
|
+
icons.each { | icon | widget.elements.add icon }
|
358
|
+
splashes.each { | splash | widget.elements.add splash }
|
359
|
+
preferences.each { | pref | widget.elements.add pref }
|
360
|
+
features.each { | feat | widget.elements.add feat }
|
361
|
+
|
362
|
+
doc << REXML::XMLDecl.new
|
363
|
+
doc.elements.add widget
|
364
|
+
doc
|
365
|
+
end
|
292
366
|
end
|
293
367
|
end
|
@@ -5,13 +5,80 @@ module Confetti
|
|
5
5
|
class FiletypeError < Confetti::Error ; end
|
6
6
|
|
7
7
|
# classes that represent child elements
|
8
|
-
Author
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
class Author < Struct.new(:name, :href, :email)
|
9
|
+
def defined_attrs
|
10
|
+
{
|
11
|
+
"name" => self[ :name ],
|
12
|
+
"href" => self[ :href ],
|
13
|
+
"email" => self[ :email ]
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Name < Struct.new(:name, :shortname)
|
19
|
+
def defined_attrs
|
20
|
+
{
|
21
|
+
"name" => self[ :name ],
|
22
|
+
"shortname" => self[ :shortname ]
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class License < Struct.new(:text, :href)
|
28
|
+
def defined_attrs
|
29
|
+
{
|
30
|
+
"text" => self[ :text ],
|
31
|
+
"href" => self[ :href ]
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Content < Struct.new(:src, :type, :encoding)
|
37
|
+
def defined_attrs
|
38
|
+
{
|
39
|
+
"src" => self[ :src ],
|
40
|
+
"type" => self[ :type ],
|
41
|
+
"encoding" => self[ :encoding ]
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Feature < Struct.new(:name, :required)
|
47
|
+
def defined_attrs
|
48
|
+
{
|
49
|
+
"name" => self[ :name ],
|
50
|
+
"required" => self[ :required ]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class Preference < Struct.new(:name, :value, :readonly)
|
56
|
+
def defined_attrs
|
57
|
+
{
|
58
|
+
"name" => self[ :name ],
|
59
|
+
"value" => self[ :value ],
|
60
|
+
"readonly" => self[ :readonly ]
|
61
|
+
}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class Access < Struct.new(:origin, :subdomains, :browserOnly)
|
66
|
+
def defined_attrs
|
67
|
+
{
|
68
|
+
"origin" => self[ :origin ],
|
69
|
+
"subdomains" => self[ :subdomains ],
|
70
|
+
"browserOnly" => self[ :browserOnly ]
|
71
|
+
}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Param < Struct.new(:name, :value)
|
76
|
+
def defined_attrs
|
77
|
+
{
|
78
|
+
"name" => self[ :name ],
|
79
|
+
"value" => self[ :value ]
|
80
|
+
}
|
81
|
+
end
|
82
|
+
end
|
16
83
|
end
|
17
84
|
end
|
@@ -19,6 +19,19 @@ module Confetti
|
|
19
19
|
@density = @extras['density']
|
20
20
|
@state = @extras['state']
|
21
21
|
end
|
22
|
+
|
23
|
+
def defined_attrs
|
24
|
+
{
|
25
|
+
"src" => @src,
|
26
|
+
"height" => @height,
|
27
|
+
"width" => @width,
|
28
|
+
"gap:role" => @role,
|
29
|
+
"gap:platform" => @platform,
|
30
|
+
"gap:main" => @main,
|
31
|
+
"gap:density" => @density,
|
32
|
+
"gap:state" => @state
|
33
|
+
}
|
34
|
+
end
|
22
35
|
end
|
23
36
|
end
|
24
37
|
end
|
data/lib/confetti/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Confetti::Config::Access do
|
4
|
+
before do
|
5
|
+
@access = Confetti::Config::Access.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should define a defined_attrs method" do
|
9
|
+
access = Confetti::Config::Access.new( "google.ca", true, false )
|
10
|
+
|
11
|
+
access.defined_attrs.should == {
|
12
|
+
"origin" => "google.ca",
|
13
|
+
"subdomains" => true,
|
14
|
+
"browserOnly" => false
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
@@ -11,7 +11,10 @@ describe Confetti::Config::Author do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should have a readable and writable href field" do
|
14
|
-
lambda {
|
14
|
+
lambda {
|
15
|
+
@author.href = "http://alunny.github.com"
|
16
|
+
}.should_not raise_error
|
17
|
+
|
15
18
|
@author.href.should == "http://alunny.github.com"
|
16
19
|
end
|
17
20
|
|
@@ -19,4 +22,15 @@ describe Confetti::Config::Author do
|
|
19
22
|
lambda { @author.email = "alunny@gmail.com" }.should_not raise_error
|
20
23
|
@author.email.should == "alunny@gmail.com"
|
21
24
|
end
|
25
|
+
|
26
|
+
it "should define a defined_attrs method" do
|
27
|
+
author = Confetti::Config::Author.new(
|
28
|
+
"hardeep", "127.0.0.1", "shardeep@adobe.com")
|
29
|
+
|
30
|
+
author.defined_attrs.should == {
|
31
|
+
"name" => "hardeep",
|
32
|
+
"href" => "127.0.0.1",
|
33
|
+
"email" => "shardeep@adobe.com"
|
34
|
+
}
|
35
|
+
end
|
22
36
|
end
|
@@ -19,4 +19,13 @@ describe Confetti::Config::Content do
|
|
19
19
|
lambda { @content.encoding = "GB2313" }.should_not raise_error
|
20
20
|
@content.encoding.should == "GB2313"
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should define a defined_attrs method" do
|
24
|
+
content = Confetti::Config::Content.new(
|
25
|
+
"some/path", "text/html", "utf-8")
|
26
|
+
|
27
|
+
content.defined_attrs.should == {
|
28
|
+
"src" => "some/path", "type" => "text/html", "encoding" => "utf-8"
|
29
|
+
}
|
30
|
+
end
|
22
31
|
end
|
@@ -30,4 +30,13 @@ describe Confetti::Config::Feature do
|
|
30
30
|
}.should raise_error
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
it "should define a defined_attrs method" do
|
35
|
+
feature = Confetti::Config::Feature.new( "Geolocation", true )
|
36
|
+
|
37
|
+
feature.defined_attrs.should == {
|
38
|
+
"name" => "Geolocation",
|
39
|
+
"required" => true
|
40
|
+
}
|
41
|
+
end
|
33
42
|
end
|
@@ -19,4 +19,19 @@ describe Confetti::Config::Image do
|
|
19
19
|
lambda { @image.height = 50 }.should_not raise_error
|
20
20
|
@image.height.should == 50
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should define a attribute dump method" do
|
24
|
+
img = Confetti::Config::Image.new
|
25
|
+
attrs = img.defined_attrs
|
26
|
+
attrs.should == {
|
27
|
+
"gap:main"=>nil,
|
28
|
+
"gap:platform"=>nil,
|
29
|
+
"gap:state"=>nil,
|
30
|
+
"src"=>nil,
|
31
|
+
"gap:density"=>nil,
|
32
|
+
"height"=>nil,
|
33
|
+
"gap:role"=>nil,
|
34
|
+
"width"=>nil
|
35
|
+
}
|
36
|
+
end
|
22
37
|
end
|
@@ -6,12 +6,27 @@ describe Confetti::Config::License do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should have a readable and writable text field" do
|
9
|
-
lambda {
|
9
|
+
lambda {
|
10
|
+
@license.text = "You can do WTF you want"
|
11
|
+
}.should_not raise_error
|
12
|
+
|
10
13
|
@license.text.should == "You can do WTF you want"
|
11
14
|
end
|
12
15
|
|
13
16
|
it "should have a readable and writable href field" do
|
14
|
-
lambda {
|
17
|
+
lambda {
|
18
|
+
@license.href = "http://apache.org/license"
|
19
|
+
}.should_not raise_error
|
20
|
+
|
15
21
|
@license.href.should == "http://apache.org/license"
|
16
22
|
end
|
23
|
+
|
24
|
+
it "should define a defined_attrs method" do
|
25
|
+
license = Confetti::Config::License.new(
|
26
|
+
"Some License", "Some Url")
|
27
|
+
|
28
|
+
license.defined_attrs.should == {
|
29
|
+
"text" => "Some License", "href" => "Some Url"
|
30
|
+
}
|
31
|
+
end
|
17
32
|
end
|
@@ -6,7 +6,10 @@ describe Confetti::Config::Name do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should have a readable and writable name field" do
|
9
|
-
lambda {
|
9
|
+
lambda {
|
10
|
+
@name.name = "Microsoft Windows 7 Ultimate Edition"
|
11
|
+
}.should_not raise_error
|
12
|
+
|
10
13
|
@name.name.should == "Microsoft Windows 7 Ultimate Edition"
|
11
14
|
end
|
12
15
|
|
@@ -14,4 +17,12 @@ describe Confetti::Config::Name do
|
|
14
17
|
lambda { @name.shortname = "Windows7" }.should_not raise_error
|
15
18
|
@name.shortname.should == "Windows7"
|
16
19
|
end
|
20
|
+
|
21
|
+
it "should define a defined_attrs method" do
|
22
|
+
name = Confetti::Config::Name.new( "Long Title", "Short Title" )
|
23
|
+
|
24
|
+
name.defined_attrs.should == {
|
25
|
+
"name" => "Long Title", "shortname" => "Short Title"
|
26
|
+
}
|
27
|
+
end
|
17
28
|
end
|
@@ -19,4 +19,15 @@ describe Confetti::Config::Preference do
|
|
19
19
|
lambda { @pref.readonly = true }.should_not raise_error
|
20
20
|
@pref.readonly.should be_true
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should define a defined_attrs method" do
|
24
|
+
pref = Confetti::Config::Preference.new(
|
25
|
+
"Some Preference", "Some Setting", false )
|
26
|
+
|
27
|
+
pref.defined_attrs.should == {
|
28
|
+
"name" => "Some Preference",
|
29
|
+
"value" => "Some Setting",
|
30
|
+
"readonly" => false
|
31
|
+
}
|
32
|
+
end
|
22
33
|
end
|
data/spec/config_spec.rb
CHANGED
@@ -151,7 +151,8 @@ describe Confetti::Config do
|
|
151
151
|
end
|
152
152
|
|
153
153
|
it "should call #is_file? with an argument passed" do
|
154
|
-
@blank_config.
|
154
|
+
@blank_config.stub( :populate_from_xml )
|
155
|
+
@blank_config.should_receive( :is_file? )
|
155
156
|
@blank_config.send :initialize, "config.xml"
|
156
157
|
end
|
157
158
|
|
@@ -160,6 +161,18 @@ describe Confetti::Config do
|
|
160
161
|
@blank_config.should_receive(:populate_from_xml).with("config.xml")
|
161
162
|
@blank_config.send :initialize, "config.xml"
|
162
163
|
end
|
164
|
+
|
165
|
+
it "should call #populate_from_string when a string is passed" do
|
166
|
+
@blank_config.should_receive(
|
167
|
+
:populate_from_string).with("</widget>")
|
168
|
+
@blank_config.send :initialize, "</widget>"
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should throw an exception when a bad config path is passed" do
|
172
|
+
lambda{
|
173
|
+
@blank_config.send :initialize, "config.xml"
|
174
|
+
}.should raise_error Confetti::Config::FileError
|
175
|
+
end
|
163
176
|
end
|
164
177
|
|
165
178
|
describe "#populate_from_xml" do
|
@@ -747,7 +760,28 @@ describe Confetti::Config do
|
|
747
760
|
|
748
761
|
it "should serialize when no filters provided" do
|
749
762
|
@config.to_s.should match /icon/
|
763
|
+
# this should remove all instances of icons from the string
|
750
764
|
@config.filtered_to_s("//icon").should_not match /icon/
|
751
765
|
end
|
766
|
+
|
767
|
+
describe "#to_xml" do
|
768
|
+
|
769
|
+
it "should define a to_xml method" do
|
770
|
+
@config.should respond_to :to_xml
|
771
|
+
end
|
772
|
+
|
773
|
+
it "should render the config as valid xml" do
|
774
|
+
# if given a config object running a to_xml and feeding
|
775
|
+
# it back into a config object should produce the same contents
|
776
|
+
out = ""
|
777
|
+
@config.to_xml.write( out, 2 )
|
778
|
+
config = Confetti::Config.new out
|
779
|
+
config.author.name.should == "Andrew Lunny"
|
780
|
+
config.feature_set.length.should == 3
|
781
|
+
config.preference_set.length.should == 2
|
782
|
+
config.icon_set.length.should == 1
|
783
|
+
config.splash_set.length.should == 1
|
784
|
+
end
|
785
|
+
end
|
752
786
|
end
|
753
787
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<widget xmlns:gap='http://phonegap.com/ns/1.0' id='com.alunny.confetti' version='1.0.0' xmlns='http://www.w3.org/ns/widgets'>
|
3
|
+
<name>
|
4
|
+
Confetti Sample App
|
5
|
+
</name>
|
6
|
+
<author href='http://alunny.github.com' email='alunny@gmail.com'>
|
7
|
+
Andrew Lunny
|
8
|
+
</author>
|
9
|
+
<description>
|
10
|
+
This is a sample config.xml for integration testing with Confetti
|
11
|
+
</description>
|
12
|
+
<license>
|
13
|
+
The MIT License Copyright (c) 2011 Andrew Lunny Permission is hereby
|
14
|
+
granted, free of charge, to any person obtaining a copy of this software and
|
15
|
+
associated documentation files (the "Software"), to deal in the
|
16
|
+
Software without restriction, including without limitation the rights to
|
17
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
19
|
+
furnished to do so, subject to the following conditions: The above copyright
|
20
|
+
notice and this permission notice shall be included in all copies or
|
21
|
+
substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS
|
22
|
+
IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
23
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
24
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
25
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
26
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
27
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
</license>
|
29
|
+
<icon src='icon.png' height='150' width='200'/>
|
30
|
+
<gap:splash src='mainsplash.png' height='480' width='360'/>
|
31
|
+
<preference name='phonegap-version' value='1.3.0'/>
|
32
|
+
<preference name='universal' value='true'/>
|
33
|
+
<feature name='http://api.phonegap.com/1.0/camera' required='true'/>
|
34
|
+
<feature name='http://api.phonegap.com/1.0/notification' required='true'/>
|
35
|
+
<feature name='http://api.phonegap.com/1.0/geolocation' required='true'/>
|
36
|
+
</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
|
+
- 9
|
8
|
+
- 0
|
9
|
+
version: 0.9.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-
|
19
|
+
date: 2012-07-18 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/confetti/templates/windows_phone7_manifest.rb
|
99
99
|
- lib/confetti/version.rb
|
100
100
|
- lib/typedset.rb
|
101
|
+
- spec/config/config_access_spec.rb
|
101
102
|
- spec/config/config_author_spec.rb
|
102
103
|
- spec/config/config_content_spec.rb
|
103
104
|
- spec/config/config_feature_spec.rb
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- spec/fixtures/config-icons.xml
|
124
125
|
- spec/fixtures/config-long-desc.xml
|
125
126
|
- spec/fixtures/config-plugins.xml
|
127
|
+
- spec/fixtures/config-to_xml.xml
|
126
128
|
- spec/fixtures/config.xml
|
127
129
|
- spec/fixtures/config_fullscreen.xml
|
128
130
|
- spec/fixtures/config_legacy.xml
|
@@ -192,6 +194,7 @@ signing_key:
|
|
192
194
|
specification_version: 3
|
193
195
|
summary: Generate mobile app config files
|
194
196
|
test_files:
|
197
|
+
- spec/config/config_access_spec.rb
|
195
198
|
- spec/config/config_author_spec.rb
|
196
199
|
- spec/config/config_content_spec.rb
|
197
200
|
- spec/config/config_feature_spec.rb
|
@@ -217,6 +220,7 @@ test_files:
|
|
217
220
|
- spec/fixtures/config-icons.xml
|
218
221
|
- spec/fixtures/config-long-desc.xml
|
219
222
|
- spec/fixtures/config-plugins.xml
|
223
|
+
- spec/fixtures/config-to_xml.xml
|
220
224
|
- spec/fixtures/config.xml
|
221
225
|
- spec/fixtures/config_fullscreen.xml
|
222
226
|
- spec/fixtures/config_legacy.xml
|