confetti 0.9.15 → 0.9.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confetti (0.9.14)
4
+ confetti (0.9.16)
5
5
  mustache (~> 0.11.2)
6
6
 
7
7
  GEM
@@ -9,7 +9,7 @@ module Confetti
9
9
  attr_reader :author, :viewmodes, :name, :license, :content,
10
10
  :icon_set, :feature_set, :preference_set, :xml_doc,
11
11
  :splash_set, :plist_icon_set, :access_set, :plugin_set,
12
- :url_scheme_set
12
+ :url_scheme_set, :platform_set
13
13
 
14
14
  generate_and_write :android_manifest, :android_strings,
15
15
  :webos_appinfo, :ios_info, :symbian_wrt_info,
@@ -36,6 +36,7 @@ module Confetti
36
36
  @icon_set = TypedSet.new Image
37
37
  @plist_icon_set = []
38
38
  @feature_set = TypedSet.new Feature
39
+ @platform_set = TypedSet.new Platform
39
40
  @splash_set = TypedSet.new Image
40
41
  @preference_set = TypedSet.new Preference
41
42
  @access_set = TypedSet.new Access
@@ -145,6 +146,8 @@ module Confetti
145
146
  # PhoneGap extensions (gap:)
146
147
  when "http://phonegap.com/ns/1.0"
147
148
  case ele.name
149
+ when "platform"
150
+ @platform_set << Platform.new(attr["name"])
148
151
  when "splash"
149
152
  next if attr["src"].nil? or attr["src"].empty?
150
153
  @splash_set << Image.new(attr["src"], attr["height"], attr["width"],
@@ -387,6 +390,15 @@ module Confetti
387
390
  features << feat
388
391
  end
389
392
 
393
+ platforms = []
394
+ @platform_set.each do | platform |
395
+ plat = REXML::Element.new( "gap:platform" )
396
+ plat.add_attributes({
397
+ "name" => platform.name
398
+ })
399
+ platforms << plat
400
+ end
401
+
390
402
  widget.elements.add name
391
403
  widget.elements.add author
392
404
  widget.elements.add description
@@ -397,6 +409,7 @@ module Confetti
397
409
  splashes.each { | splash | widget.elements.add splash }
398
410
  preferences.each { | pref | widget.elements.add pref }
399
411
  features.each { | feat | widget.elements.add feat }
412
+ platforms.each { | plat | widget.elements.add plat }
400
413
  url_schemes.each { | schm | widget.elements.add schm }
401
414
 
402
415
  doc << REXML::XMLDecl.new
@@ -34,6 +34,14 @@ module Confetti
34
34
  end
35
35
  end
36
36
 
37
+ class Platform < Struct.new(:name)
38
+ def defined_attrs
39
+ {
40
+ "name" => self[ :name ]
41
+ }
42
+ end
43
+ end
44
+
37
45
  class Content < Struct.new(:src, :type, :encoding)
38
46
  def defined_attrs
39
47
  {
@@ -16,8 +16,8 @@ module Confetti
16
16
  @role = @extras['role']
17
17
  @platform = @extras['platform']
18
18
  @main = @extras['main']
19
- @density = @extras['density']
20
- @state = @extras['state']
19
+ @density = @extras['density']
20
+ @state = @extras['state']
21
21
  end
22
22
 
23
23
  def defined_attrs
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.9.15"
2
+ VERSION = "0.9.16"
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Confetti::Config::Platform do
4
+ before do
5
+ @platform = Confetti::Config::Platform.new("ios")
6
+ end
7
+
8
+ it "should have a readable and writable name field" do
9
+ lambda { @platform.name = "ios" }.should_not raise_error
10
+ @platform.name.should == "ios"
11
+ end
12
+
13
+ it "should define a defined_attrs method" do
14
+ platform = Confetti::Config::Platform.new("ios")
15
+
16
+ platform.defined_attrs.should == {
17
+ "name" => "ios"
18
+ }
19
+ end
20
+ end
@@ -113,6 +113,20 @@ describe Confetti::Config do
113
113
  }.should raise_error
114
114
  end
115
115
 
116
+ it "has an platform field, that is a TypedSet" do
117
+ @config.platform_set.should be_a TypedSet
118
+ end
119
+
120
+ it "platform_set should be typed to platform objects" do
121
+ @config.platform_set.set_class.should be Confetti::Config::Platform
122
+ end
123
+
124
+ it "should not allow platform_set to be clobbered" do
125
+ lambda {
126
+ @config.platform_set = ['ios', 'android']
127
+ }.should raise_error
128
+ end
129
+
116
130
  it "has an preference_set field, that is a TypedSet" do
117
131
  @config.preference_set.should be_a TypedSet
118
132
  end
@@ -381,6 +395,20 @@ describe Confetti::Config do
381
395
  end
382
396
  end
383
397
 
398
+ describe "platforms" do
399
+ it "should append platforms to the feature set" do
400
+ @config.platform_set.size.should be 3
401
+ end
402
+
403
+ it "should include the right platforms" do
404
+ # first tends to be last listed in xml document
405
+ platforms_names = @config.platform_set.map { |f| f.name }
406
+ platforms_names.should include "ios"
407
+ platforms_names.should include "android"
408
+ platforms_names.should include "webos"
409
+ end
410
+ end
411
+
384
412
  describe "access" do
385
413
  before do
386
414
  @config = Confetti::Config.new
@@ -39,7 +39,7 @@ THE SOFTWARE.</license>
39
39
 
40
40
  <icon src="icon.png" height="150" width="200" />
41
41
 
42
- <gap:splash src="mainsplash.png" height="480" width="360" />
42
+ <gap:splash src="mainsplash.png" height="480" width="360" />
43
43
 
44
44
  <preference name="universal" value="true"/>
45
45
  <preference name="phonegap-version" value="1.3.0"/>
@@ -48,7 +48,11 @@ 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
+ <gap:platform name="ios" />
52
+ <gap:platform name="webos" />
53
+ <gap:platform name="android" />
54
+
51
55
  <content src="not_index.html" />
52
56
 
53
- <access origin="*" />
57
+ <access origin="*" />
54
58
  </widget>
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: 37
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 15
10
- version: 0.9.15
9
+ - 16
10
+ version: 0.9.16
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-06-18 00:00:00 Z
20
+ date: 2013-07-29 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: mustache
@@ -110,6 +110,7 @@ files:
110
110
  - spec/config/config_image_spec.rb
111
111
  - spec/config/config_license_spec.rb
112
112
  - spec/config/config_name_spec.rb
113
+ - spec/config/config_platform_spec.rb
113
114
  - spec/config/config_preference_spec.rb
114
115
  - spec/config/config_url_scheme_spec.rb
115
116
  - spec/config_spec.rb
@@ -216,6 +217,7 @@ test_files:
216
217
  - spec/config/config_image_spec.rb
217
218
  - spec/config/config_license_spec.rb
218
219
  - spec/config/config_name_spec.rb
220
+ - spec/config/config_platform_spec.rb
219
221
  - spec/config/config_preference_spec.rb
220
222
  - spec/config/config_url_scheme_spec.rb
221
223
  - spec/config_spec.rb