confetti 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/confetti/config.rb +2 -0
- data/lib/confetti/config/classes.rb +1 -0
- data/lib/confetti/version.rb +1 -1
- data/spec/config_spec.rb +6 -0
- data/spec/fixtures/bad-encoding.xml +18 -0
- metadata +5 -3
data/Gemfile.lock
CHANGED
data/lib/confetti/config.rb
CHANGED
@@ -73,6 +73,8 @@ module Confetti
|
|
73
73
|
config_doc = REXML::Document.new( config_doc ).root
|
74
74
|
rescue REXML::ParseException
|
75
75
|
raise XMLError, "malformed config.xml"
|
76
|
+
rescue Iconv::InvalidCharacter
|
77
|
+
raise EncodingError, "unable to read config.xml"
|
76
78
|
end
|
77
79
|
|
78
80
|
if config_doc.nil?
|
@@ -3,6 +3,7 @@ module Confetti
|
|
3
3
|
class XMLError < Confetti::Error ; end
|
4
4
|
class FileError < Confetti::Error ; end
|
5
5
|
class FiletypeError < Confetti::Error ; end
|
6
|
+
class EncodingError < Confetti::Error ; end
|
6
7
|
|
7
8
|
# classes that represent child elements
|
8
9
|
class Author < Struct.new(:name, :href, :email)
|
data/lib/confetti/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -202,6 +202,12 @@ describe Confetti::Config do
|
|
202
202
|
}.should raise_error Confetti::Config::XMLError
|
203
203
|
end
|
204
204
|
|
205
|
+
it "should contain Iconv errors (with utf-16)" do
|
206
|
+
lambda {
|
207
|
+
@config.populate_from_xml("#{ fixture_dir }/bad-encoding.xml")
|
208
|
+
}.should raise_error Confetti::Config::EncodingError
|
209
|
+
end
|
210
|
+
|
205
211
|
describe "when setting attributes from config.xml" do
|
206
212
|
before do
|
207
213
|
@config.populate_from_xml(fixture_dir + "/config.xml")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-16" ?>
|
2
|
+
<widget xmlns = "http://www.w3.org/ns/widgets"
|
3
|
+
xmlns:gap = "http://phonegap.com/ns/1.0"
|
4
|
+
id = "com.one.two"
|
5
|
+
version = "0.0.1"
|
6
|
+
versionCode ="1" >
|
7
|
+
|
8
|
+
<name>Bad Encoding Test</name>
|
9
|
+
|
10
|
+
<description>Testing for ICONV fail</description>
|
11
|
+
<icon src="icon.png" />
|
12
|
+
<preference name="permissions" value="none"/>
|
13
|
+
|
14
|
+
<author href="www.exxexe.com" email="user@exxexe.com">
|
15
|
+
Whoever
|
16
|
+
</author>
|
17
|
+
|
18
|
+
</widget>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 2
|
9
|
+
version: 0.9.2
|
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-09-10 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- spec/fixtures/android/android_manifest_spec_with_expected_orientation.xml
|
114
114
|
- spec/fixtures/android/android_strings_expected.xml
|
115
115
|
- spec/fixtures/android/android_strings_spec.xml
|
116
|
+
- spec/fixtures/bad-encoding.xml
|
116
117
|
- spec/fixtures/bad_config.xml
|
117
118
|
- spec/fixtures/blackberry/blackberry_widget_config_expected.xml
|
118
119
|
- spec/fixtures/blackberry/blackberry_widget_config_legacy_expected.xml
|
@@ -209,6 +210,7 @@ test_files:
|
|
209
210
|
- spec/fixtures/android/android_manifest_spec_with_expected_orientation.xml
|
210
211
|
- spec/fixtures/android/android_strings_expected.xml
|
211
212
|
- spec/fixtures/android/android_strings_spec.xml
|
213
|
+
- spec/fixtures/bad-encoding.xml
|
212
214
|
- spec/fixtures/bad_config.xml
|
213
215
|
- spec/fixtures/blackberry/blackberry_widget_config_expected.xml
|
214
216
|
- spec/fixtures/blackberry/blackberry_widget_config_legacy_expected.xml
|