confetti 0.4.5 → 0.4.6

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.4.5)
4
+ confetti (0.4.6)
5
5
  mustache (~> 0.11.2)
6
6
  thor (~> 0.14.3)
7
7
 
@@ -159,8 +159,7 @@ module Confetti
159
159
  # helper to retrieve a preference's value
160
160
  # returns nil if the preference doesn't exist
161
161
  def preference name
162
- name = name.to_s
163
- pref = @preference_set.detect { |pref| pref.name == name }
162
+ pref = preference_obj(name)
164
163
 
165
164
  pref && pref.value && pref.value.to_sym
166
165
  end
@@ -172,5 +171,12 @@ module Confetti
172
171
  select { |e| e.respond_to?(:name) and e.name == "platform" }.
173
172
  map { |e| e.attributes["name"].downcase.to_sym }
174
173
  end
174
+
175
+ # mostly an internal method to help with weird cases
176
+ # in particular #phonegap_version
177
+ def preference_obj name
178
+ name = name.to_s
179
+ @preference_set.detect { |pref| pref.name == name }
180
+ end
175
181
  end
176
182
  end
@@ -1,7 +1,5 @@
1
1
  module Confetti
2
2
  module PhoneGap
3
- attr_accessor :phonegap_version
4
-
5
3
  PHONEGAP_APIS = %w{camera notification geolocation media contacts file network}
6
4
 
7
5
  def add_stock_phonegap_apis
@@ -11,5 +9,20 @@ module Confetti
11
9
  end
12
10
  end
13
11
 
12
+ def phonegap_version
13
+ self.preference("phonegap-version").to_s
14
+ end
15
+
16
+ def phonegap_version= v
17
+ pref = self.preference_obj("phonegap-version")
18
+
19
+ if pref.nil?
20
+ pref = Confetti::Config::Preference.new("phonegap-version", v)
21
+ self.preference_set << pref
22
+ else
23
+ pref.value = v
24
+ end
25
+
26
+ end
14
27
  end
15
28
  end
@@ -7,8 +7,9 @@
7
7
  <author href="{{ author_href }}" email="{{ author_email }}">{{ author_name }}</author>
8
8
  <description>{{ widget_description }}</description>
9
9
  <license href="{{ license_href }}">{{ license_text }}</license>
10
+
10
11
  <feature id="blackberry.system" required="true" version="1.0.0.0" />
11
- <feature id="phonegap" required="true" version="{{ phonegap_version }}" />
12
+ <feature id="com.phonegap" required="true" version="1.0.0" />
12
13
  <feature id="blackberry.find" required="true" version="1.0.0.0" />
13
14
  <feature id="blackberry.identity" required="true" version="1.0.0.0" />
14
15
  <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
@@ -22,14 +23,31 @@
22
23
  <feature id="blackberry.invoke.MapsArguments" required="true" version="1.0.0.0" />
23
24
  <feature id="blackberry.system.event" />
24
25
  <feature id="blackberry.identity.phone" />
26
+
27
+ <feature id="blackberry.media.camera" />
28
+ <feature id="blackberry.ui.dialog" />
29
+
25
30
  <access subdomains="true" uri="file:///store/home"/>
26
31
  <access subdomains="true" uri="file:///SDCard"/>
27
32
  <access subdomains="true" uri="*" />
33
+
28
34
  <icon rim:hover="false" src="resources/icon.png"/>
29
35
  <icon rim:hover="true" src="resources/icon_hover.png"/>
36
+
30
37
  <content src="index.html"/>
31
- <rim:loadingScreen backgroundColor="#000000" foregroundImage="resources/loading_foreground.png" onFirstLaunch="true">
32
- <rim:transitionEffect type="fadeOut"/>
38
+
39
+ <rim:loadingScreen backgroundColor="#000000"
40
+ foregroundImage="resources/loading_foreground.png" onFirstLaunch="true">
41
+ <rim:transitionEffect type="fadeOut"/>
33
42
  </rim:loadingScreen>
43
+
34
44
  <rim:orientation mode="{{app_orientation}}" />
45
+
46
+ <rim:permissions>
47
+ <rim:permit>use_camera</rim:permit>
48
+ <rim:permit>read_device_identifying_information</rim:permit>
49
+ <rim:permit>access_shared</rim:permit>
50
+ <rim:permit>read_geolocation</rim:permit>
51
+ </rim:permissions>
52
+
35
53
  </widget>
@@ -1,12 +1,31 @@
1
1
  module Confetti
2
2
  module Template
3
3
  class BlackberryWidgetsConfig < Base
4
+ @@legacy_template = File.read(
5
+ File.join(
6
+ File.dirname(__FILE__),
7
+ "blackberry_widgets_config_legacy.mustache"
8
+ ))
9
+
4
10
  ORIENTATIONS_MAP = {
5
11
  :default => "auto",
6
12
  :landscape => "landscape",
7
13
  :portrait => "portrait"
8
14
  }
9
15
 
16
+ def initialize *args
17
+ super *args
18
+
19
+ return self unless @config
20
+
21
+ # old = 0.x, 1.0, 1.1, or 1.2
22
+ old = /^(0)|(1[.][0-2])/
23
+
24
+ if @config.phonegap_version and @config.phonegap_version.match(old)
25
+ self.template = @@legacy_template
26
+ end
27
+ end
28
+
10
29
  def widget_id
11
30
  if @config.package.nil? or @config.package.empty?
12
31
  "com.default.noname"
@@ -52,7 +71,15 @@ module Confetti
52
71
  end
53
72
 
54
73
  def phonegap_version
55
- @config.phonegap_version
74
+ # should be 1.0.0, unless below 1
75
+ # @config.phonegap_version
76
+ pg = @config.phonegap_version
77
+
78
+ if pg.nil? or pg.empty? or pg.match(/^1/)
79
+ "1.0.0"
80
+ else
81
+ pg
82
+ end
56
83
  end
57
84
 
58
85
  def output_filename
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Widget Configuration Reference: http://docs.blackberry.com/en/developers/deliverables/15274/ -->
3
+ <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets"
4
+ version="{{ version }}"
5
+ id="{{ widget_id }}">
6
+ <name>{{ widget_name }}</name>
7
+ <author href="{{ author_href }}" email="{{ author_email }}">{{ author_name }}</author>
8
+ <description>{{ widget_description }}</description>
9
+ <license href="{{ license_href }}">{{ license_text }}</license>
10
+ <feature id="blackberry.system" required="true" version="1.0.0.0" />
11
+ <feature id="phonegap" required="true" version="{{ phonegap_version }}" />
12
+ <feature id="blackberry.find" required="true" version="1.0.0.0" />
13
+ <feature id="blackberry.identity" required="true" version="1.0.0.0" />
14
+ <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
15
+ <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />
16
+ <feature id="blackberry.io.file" required="true" version="1.0.0.0" />
17
+ <feature id="blackberry.utils" required="true" version="1.0.0.0" />
18
+ <feature id="blackberry.io.dir" required="true" version="1.0.0.0" />
19
+ <feature id="blackberry.app" required="true" version="1.0.0.0" />
20
+ <feature id="blackberry.app.event" required="true" version="1.0.0.0" />
21
+ <feature id="blackberry.invoke" required="true" version="1.0.0.0" />
22
+ <feature id="blackberry.invoke.MapsArguments" required="true" version="1.0.0.0" />
23
+ <feature id="blackberry.system.event" />
24
+ <feature id="blackberry.identity.phone" />
25
+ <access subdomains="true" uri="file:///store/home"/>
26
+ <access subdomains="true" uri="file:///SDCard"/>
27
+ <access subdomains="true" uri="*" />
28
+ <icon rim:hover="false" src="resources/icon.png"/>
29
+ <icon rim:hover="true" src="resources/icon_hover.png"/>
30
+ <content src="index.html"/>
31
+ <rim:loadingScreen backgroundColor="#000000" foregroundImage="resources/loading_foreground.png" onFirstLaunch="true">
32
+ <rim:transitionEffect type="fadeOut"/>
33
+ </rim:loadingScreen>
34
+ <rim:orientation mode="{{app_orientation}}" />
35
+ </widget>
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
3
3
  end
@@ -27,8 +27,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
27
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
28
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
29
  THE SOFTWARE.</license>
30
+
30
31
  <feature id="blackberry.system" required="true" version="1.0.0.0" />
31
- <feature id="phonegap" required="true" version="0.9.5.1" />
32
+ <feature id="com.phonegap" required="true" version="1.0.0" />
32
33
  <feature id="blackberry.find" required="true" version="1.0.0.0" />
33
34
  <feature id="blackberry.identity" required="true" version="1.0.0.0" />
34
35
  <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
@@ -42,14 +43,31 @@ THE SOFTWARE.</license>
42
43
  <feature id="blackberry.invoke.MapsArguments" required="true" version="1.0.0.0" />
43
44
  <feature id="blackberry.system.event" />
44
45
  <feature id="blackberry.identity.phone" />
46
+
47
+ <feature id="blackberry.media.camera" />
48
+ <feature id="blackberry.ui.dialog" />
49
+
45
50
  <access subdomains="true" uri="file:///store/home"/>
46
51
  <access subdomains="true" uri="file:///SDCard"/>
47
52
  <access subdomains="true" uri="*" />
53
+
48
54
  <icon rim:hover="false" src="resources/icon.png"/>
49
55
  <icon rim:hover="true" src="resources/icon_hover.png"/>
56
+
50
57
  <content src="index.html"/>
51
- <rim:loadingScreen backgroundColor="#000000" foregroundImage="resources/loading_foreground.png" onFirstLaunch="true">
52
- <rim:transitionEffect type="fadeOut"/>
58
+
59
+ <rim:loadingScreen backgroundColor="#000000"
60
+ foregroundImage="resources/loading_foreground.png" onFirstLaunch="true">
61
+ <rim:transitionEffect type="fadeOut"/>
53
62
  </rim:loadingScreen>
63
+
54
64
  <rim:orientation mode="auto" />
65
+
66
+ <rim:permissions>
67
+ <rim:permit>use_camera</rim:permit>
68
+ <rim:permit>read_device_identifying_information</rim:permit>
69
+ <rim:permit>access_shared</rim:permit>
70
+ <rim:permit>read_geolocation</rim:permit>
71
+ </rim:permissions>
72
+
55
73
  </widget>
@@ -0,0 +1,55 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Widget Configuration Reference: http://docs.blackberry.com/en/developers/deliverables/15274/ -->
3
+ <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets"
4
+ version="1.0.0"
5
+ id="com.alunny.confetti">
6
+ <name>Confetti Sample App</name>
7
+ <author href="http://alunny.github.com" email="alunny@gmail.com">Andrew Lunny</author>
8
+ <description>This is a sample config.xml for integration testing with Confetti</description>
9
+ <license href="http://www.opensource.org/licenses/mit-license.php">The MIT License
10
+
11
+ Copyright (c) 2011 Andrew Lunny
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the &quot;Software&quot;), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in
21
+ all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
+ THE SOFTWARE.</license>
30
+ <feature id="blackberry.system" required="true" version="1.0.0.0" />
31
+ <feature id="phonegap" required="true" version="1.0.0" />
32
+ <feature id="blackberry.find" required="true" version="1.0.0.0" />
33
+ <feature id="blackberry.identity" required="true" version="1.0.0.0" />
34
+ <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
35
+ <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />
36
+ <feature id="blackberry.io.file" required="true" version="1.0.0.0" />
37
+ <feature id="blackberry.utils" required="true" version="1.0.0.0" />
38
+ <feature id="blackberry.io.dir" required="true" version="1.0.0.0" />
39
+ <feature id="blackberry.app" required="true" version="1.0.0.0" />
40
+ <feature id="blackberry.app.event" required="true" version="1.0.0.0" />
41
+ <feature id="blackberry.invoke" required="true" version="1.0.0.0" />
42
+ <feature id="blackberry.invoke.MapsArguments" required="true" version="1.0.0.0" />
43
+ <feature id="blackberry.system.event" />
44
+ <feature id="blackberry.identity.phone" />
45
+ <access subdomains="true" uri="file:///store/home"/>
46
+ <access subdomains="true" uri="file:///SDCard"/>
47
+ <access subdomains="true" uri="*" />
48
+ <icon rim:hover="false" src="resources/icon.png"/>
49
+ <icon rim:hover="true" src="resources/icon_hover.png"/>
50
+ <content src="index.html"/>
51
+ <rim:loadingScreen backgroundColor="#000000" foregroundImage="resources/loading_foreground.png" onFirstLaunch="true">
52
+ <rim:transitionEffect type="fadeOut"/>
53
+ </rim:loadingScreen>
54
+ <rim:orientation mode="auto" />
55
+ </widget>
@@ -42,6 +42,7 @@ THE SOFTWARE.</license>
42
42
  <gap:splash src="mainsplash.png" height="480" width="360" />
43
43
 
44
44
  <preference name="universal" value="true"/>
45
+ <preference name="phonegap-version" value="1.3.0"/>
45
46
 
46
47
  <feature name="http://api.phonegap.com/1.0/geolocation" required="true"/>
47
48
  <feature name="http://api.phonegap.com/1.0/camera" required="true"/>
@@ -0,0 +1,55 @@
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.alunny.confetti"
5
+ version = "1.0.0">
6
+
7
+ <name>Confetti Sample App</name>
8
+
9
+ <description>
10
+ This is a sample config.xml for integration testing with Confetti
11
+ </description>
12
+
13
+ <license href="http://www.opensource.org/licenses/mit-license.php">The MIT License
14
+
15
+ Copyright (c) 2011 Andrew Lunny
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the &quot;Software&quot;), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in
25
+ all copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
+ THE SOFTWARE.</license>
34
+
35
+ <author href="http://alunny.github.com"
36
+ email="alunny@gmail.com">
37
+ Andrew Lunny
38
+ </author>
39
+
40
+ <icon src="icon.png" height="150" width="200" />
41
+
42
+ <gap:splash src="mainsplash.png" height="480" width="360" />
43
+
44
+ <preference name="universal" value="true"/>
45
+ <preference name="phonegap-version" value="1.1.0"/>
46
+
47
+ <feature name="http://api.phonegap.com/1.0/geolocation" required="true"/>
48
+ <feature name="http://api.phonegap.com/1.0/camera" required="true"/>
49
+ <feature name="http://api.phonegap.com/1.0/notification" required="true"/>
50
+
51
+ <gap:plugin name="ChildBrowser"
52
+ value="com.phonegap.plugins.childBrowser.ChildBrowser">
53
+ <platform name="android" />
54
+ </gap:plugin>
55
+ </widget>
@@ -52,12 +52,28 @@ describe 'Writing Output' do
52
52
  end
53
53
 
54
54
  context "Blackberry Widgets" do
55
- it "should read config.xml and spit out config.xml" do
56
- @output_file = "#{ fixture_dir }/blackberry/blackberry_widget_config_output.xml"
57
- @config.phonegap_version = "0.9.5.1"
58
- @config.write_blackberry_widgets_config @output_file
55
+ describe "legacy Phonegap" do
56
+ before do
57
+ @config = Confetti::Config.new "#{ fixture_dir }/config_legacy.xml"
58
+ end
59
59
 
60
- files_should_match @output_file, "#{ fixture_dir }/blackberry/blackberry_widget_config_expected.xml"
60
+ it "should read config.xml and spit out config.xml" do
61
+ @output_file = "#{ fixture_dir }/blackberry/blackberry_widget_config_output.xml"
62
+ @config.write_blackberry_widgets_config @output_file
63
+
64
+ files_should_match @output_file,
65
+ "#{ fixture_dir }/blackberry/blackberry_widget_config_legacy_expected.xml"
66
+ end
67
+ end
68
+
69
+ describe "current (>= 1.3.0) Phonegap" do
70
+ it "should read config.xml and spit out config.xml" do
71
+ @output_file = "#{ fixture_dir }/blackberry/blackberry_widget_config_output.xml"
72
+ @config.write_blackberry_widgets_config @output_file
73
+
74
+ files_should_match @output_file,
75
+ "#{ fixture_dir }/blackberry/blackberry_widget_config_expected.xml"
76
+ end
61
77
  end
62
78
  end
63
79
 
@@ -157,4 +157,25 @@ describe Confetti::Template::BlackberryWidgetsConfig do
157
157
  @template.version.should == "1.0.0"
158
158
  end
159
159
  end
160
+
161
+ describe "#phonegap_version" do
162
+ before do
163
+ @config = Confetti::Config.new
164
+ @template = @template_class.new(@config)
165
+ end
166
+
167
+ it "should be '1.0.0' if none is defined" do
168
+ @template.phonegap_version.should == "1.0.0"
169
+ end
170
+
171
+ it "should be config.phonegap_version if that's below 1.0" do
172
+ @config.phonegap_version = "0.9.5.1"
173
+ @template.phonegap_version.should == "0.9.5.1"
174
+ end
175
+
176
+ it "should be '1.0.0' if it's above 1.0" do
177
+ @config.phonegap_version = "1.2.0"
178
+ @template.phonegap_version.should == "1.0.0"
179
+ end
180
+ end
160
181
  end
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: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 5
10
- version: 0.4.5
9
+ - 6
10
+ version: 0.4.6
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: 2011-12-16 00:00:00 -08:00
20
+ date: 2011-12-18 00:00:00 -08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -139,6 +139,7 @@ files:
139
139
  - lib/confetti/templates/base.rb
140
140
  - lib/confetti/templates/blackberry_widgets_config.mustache
141
141
  - lib/confetti/templates/blackberry_widgets_config.rb
142
+ - lib/confetti/templates/blackberry_widgets_config_legacy.mustache
142
143
  - lib/confetti/templates/ios_info.mustache
143
144
  - lib/confetti/templates/ios_info.rb
144
145
  - lib/confetti/templates/java_checks.rb
@@ -165,12 +166,14 @@ files:
165
166
  - spec/fixtures/android/android_strings_spec.xml
166
167
  - spec/fixtures/bad_config.xml
167
168
  - spec/fixtures/blackberry/blackberry_widget_config_expected.xml
169
+ - spec/fixtures/blackberry/blackberry_widget_config_legacy_expected.xml
168
170
  - spec/fixtures/blackberry/blackberry_widget_config_no_version_or_id.xml
169
171
  - spec/fixtures/blackberry/blackberry_widget_config_spec.xml
170
172
  - spec/fixtures/blackberry/blackberry_widget_config_spec_with_expected_orientation.xml
171
173
  - spec/fixtures/config-icons-custom-attribs.xml
172
174
  - spec/fixtures/config-icons.xml
173
175
  - spec/fixtures/config.xml
176
+ - spec/fixtures/config_legacy.xml
174
177
  - spec/fixtures/config_with_orientation.xml
175
178
  - spec/fixtures/config_with_version_code.xml
176
179
  - spec/fixtures/configs/blank-splash.xml
@@ -257,12 +260,14 @@ test_files:
257
260
  - spec/fixtures/android/android_strings_spec.xml
258
261
  - spec/fixtures/bad_config.xml
259
262
  - spec/fixtures/blackberry/blackberry_widget_config_expected.xml
263
+ - spec/fixtures/blackberry/blackberry_widget_config_legacy_expected.xml
260
264
  - spec/fixtures/blackberry/blackberry_widget_config_no_version_or_id.xml
261
265
  - spec/fixtures/blackberry/blackberry_widget_config_spec.xml
262
266
  - spec/fixtures/blackberry/blackberry_widget_config_spec_with_expected_orientation.xml
263
267
  - spec/fixtures/config-icons-custom-attribs.xml
264
268
  - spec/fixtures/config-icons.xml
265
269
  - spec/fixtures/config.xml
270
+ - spec/fixtures/config_legacy.xml
266
271
  - spec/fixtures/config_with_orientation.xml
267
272
  - spec/fixtures/config_with_version_code.xml
268
273
  - spec/fixtures/configs/blank-splash.xml