confetti 0.3.2 → 0.3.3
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 +1 -1
- data/lib/confetti.rb +1 -0
- data/lib/confetti/config.rb +9 -2
- data/lib/confetti/error.rb +3 -0
- data/lib/confetti/version.rb +1 -1
- data/spec/config_spec.rb +3 -3
- metadata +4 -3
data/Gemfile.lock
CHANGED
data/lib/confetti.rb
CHANGED
data/lib/confetti/config.rb
CHANGED
@@ -4,6 +4,10 @@ module Confetti
|
|
4
4
|
include PhoneGap
|
5
5
|
self.extend TemplateHelper
|
6
6
|
|
7
|
+
class XMLError < Confetti::Error ; end
|
8
|
+
|
9
|
+
class FileError < Confetti::Error ; end
|
10
|
+
|
7
11
|
attr_accessor :package, :version_string, :version_code, :description,
|
8
12
|
:height, :width
|
9
13
|
attr_reader :author, :viewmodes, :name, :license, :content,
|
@@ -40,9 +44,12 @@ module Confetti
|
|
40
44
|
|
41
45
|
def populate_from_xml(xml_file)
|
42
46
|
begin
|
43
|
-
|
47
|
+
file = File.read(xml_file)
|
48
|
+
config_doc = REXML::Document.new(file).root
|
44
49
|
rescue REXML::ParseException
|
45
|
-
raise
|
50
|
+
raise XMLError, "malformed config.xml"
|
51
|
+
rescue Errno::ENOENT
|
52
|
+
raise FileError, "file #{ xml_file } doesn't exist"
|
46
53
|
end
|
47
54
|
|
48
55
|
fail "no doc parsed" unless config_doc
|
data/lib/confetti/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -162,16 +162,16 @@ describe Confetti::Config do
|
|
162
162
|
}.should raise_error
|
163
163
|
end
|
164
164
|
|
165
|
-
it "should raise an error if
|
165
|
+
it "should raise an error if the file doesn't exist" do
|
166
166
|
lambda {
|
167
167
|
@config.populate_from_xml("foo.goo")
|
168
|
-
}.should raise_error
|
168
|
+
}.should raise_error Confetti::Config::FileError
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should raise an error with malformed xml" do
|
172
172
|
lambda {
|
173
173
|
@config.populate_from_xml("#{ fixture_dir }/bad_config.xml")
|
174
|
-
}.should raise_error
|
174
|
+
}.should raise_error Confetti::Config::XMLError
|
175
175
|
end
|
176
176
|
|
177
177
|
describe "when setting attributes from config.xml" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 3
|
9
|
+
version: 0.3.3
|
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: 2011-08-
|
19
|
+
date: 2011-08-22 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/confetti/cli.rb
|
115
115
|
- lib/confetti/config.rb
|
116
116
|
- lib/confetti/config/feature.rb
|
117
|
+
- lib/confetti/error.rb
|
117
118
|
- lib/confetti/helpers.rb
|
118
119
|
- lib/confetti/phonegap.rb
|
119
120
|
- lib/confetti/template.rb
|