confetti 0.7.4 → 0.7.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confetti (0.7.4)
4
+ confetti (0.7.5)
5
5
  mustache (~> 0.11.2)
6
6
 
7
7
  GEM
@@ -39,7 +39,7 @@ module Confetti
39
39
  Content = Class.new Struct.new(:src, :type, :encoding)
40
40
  Feature = Class.new Struct.new(:name, :required)
41
41
  Preference = Class.new Struct.new(:name, :value, :readonly)
42
- Access = Class.new Struct.new(:origin, :subdomains)
42
+ Access = Class.new Struct.new(:origin, :subdomains, :browserOnly)
43
43
 
44
44
  def initialize(*args)
45
45
  @author = Author.new
@@ -105,9 +105,9 @@ module Confetti
105
105
  when "license"
106
106
  @license = License.new(ele.text.nil? ? "" : ele.text.strip, attr["href"])
107
107
  when "access"
108
- sub = attr["subdomains"]
109
- sub = sub.nil? ? true : (sub != 'false')
110
- @access_set << Access.new(attr["origin"], sub)
108
+ sub = boolean_value(attr["subdomains"], true)
109
+ browserOnly = boolean_value(attr["browserOnly"])
110
+ @access_set << Access.new(attr["origin"], sub, browserOnly)
111
111
  end
112
112
 
113
113
  # PhoneGap extensions (gap:)
@@ -217,5 +217,14 @@ module Confetti
217
217
 
218
218
  imgs
219
219
  end
220
+
221
+ # convert string (attribute) to boolean
222
+ def boolean_value value, default=false
223
+ if default
224
+ value != "false"
225
+ else
226
+ value == "true"
227
+ end
228
+ end
220
229
  end
221
230
  end
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.7.4"
2
+ VERSION = "0.7.5"
3
3
  end
data/spec/config_spec.rb CHANGED
@@ -271,7 +271,6 @@ describe Confetti::Config do
271
271
  end
272
272
 
273
273
  it "should populate splash screen non-standards attributes to extras field" do
274
- p @config.splash_set
275
274
  @config.splash_set.size.should be 1
276
275
  @config.splash_set.first.extras.should_not == nil
277
276
  @config.splash_set.first.extras.length.should be 1
@@ -381,6 +380,14 @@ describe Confetti::Config do
381
380
  it "should allow subdomains to be set to false" do
382
381
  @bar.subdomains.should be_false
383
382
  end
383
+
384
+ it "should default browserOnly to false" do
385
+ @bar.browserOnly.should be_false
386
+ end
387
+
388
+ it "should allow browserOnly to be set to true" do
389
+ @foo.browserOnly.should be_true
390
+ end
384
391
  end
385
392
  end
386
393
  end
@@ -617,4 +624,42 @@ describe Confetti::Config do
617
624
  @config.default_splash.should != nil
618
625
  end
619
626
  end
627
+
628
+ describe "boolean_value" do
629
+ describe "without a default parameter" do
630
+ it "should default to false" do
631
+ @config.boolean_value(nil).should be_false
632
+ end
633
+
634
+ it "should return false for the string false" do
635
+ @config.boolean_value("false").should be_false
636
+ end
637
+
638
+ it "should return false for other strings" do
639
+ @config.boolean_value("falsey").should be_false
640
+ end
641
+
642
+ it "should return true for the string true" do
643
+ @config.boolean_value("true").should be_true
644
+ end
645
+ end
646
+
647
+ describe "with true set as the default" do
648
+ it "should default to true" do
649
+ @config.boolean_value(nil, true).should be_true
650
+ end
651
+
652
+ it "should return true for the string true" do
653
+ @config.boolean_value("true", true).should be_true
654
+ end
655
+
656
+ it "should return false for other strings" do
657
+ @config.boolean_value("falsey", true).should be_true
658
+ end
659
+
660
+ it "should return false for the string false" do
661
+ @config.boolean_value("false", true).should be_false
662
+ end
663
+ end
664
+ end
620
665
  end
@@ -48,6 +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
- <access origin="http://foo.phonegap.com" />
51
+ <access origin="http://foo.phonegap.com" browserOnly="true" />
52
52
  <access origin="http://bar.phonegap.com" subdomains="false" />
53
53
  </widget>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 4
9
- version: 0.7.4
8
+ - 5
9
+ version: 0.7.5
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-04-10 00:00:00 -07:00
19
+ date: 2012-04-12 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency