confetti 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confetti (0.4.1)
4
+ confetti (0.4.2)
5
5
  mustache (~> 0.11.2)
6
6
  thor (~> 0.14.3)
7
7
 
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Andrew Lunny
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -69,7 +69,9 @@ module Confetti
69
69
  raise FileError, "file #{ xml_file } doesn't exist"
70
70
  end
71
71
 
72
- fail "no doc parsed" unless config_doc
72
+ if config_doc.nil?
73
+ raise XMLError, "no doc parsed"
74
+ end
73
75
 
74
76
  # save reference to xml doc
75
77
  @xml_doc = config_doc
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/lib/typedset.rb CHANGED
@@ -1,22 +1,19 @@
1
1
  require "set"
2
2
 
3
- # based on RestricedSet from Ruby's stdlib, cf
4
- # http://github.com/ruby/ruby/blob/72ef219804e5524848170a197887a95718334e2a/lib/set.rb#L627-717
5
- # not sure why it's been commented out
6
- # I should follow these things
7
-
8
3
  class TypedSet < Set
9
- attr_reader :klass
10
- alias set_class klass
4
+ attr_reader :set_class
11
5
 
12
6
  def initialize (klass, *args)
13
- raise ArgumentError, "require a Class object" unless klass.class == Class
14
- @klass = klass
7
+ raise ArgumentError, "require a class object" unless klass.class == Class
8
+ @set_class = klass
15
9
  super args
16
10
  end
17
11
 
18
12
  def add o
19
- raise ArgumentError, "members must be of class #{@klass}" unless o.class == @klass
13
+ unless o.class == @set_class
14
+ raise ArgumentError, "members must be of class #{ @set_class }"
15
+ end
16
+
20
17
  super o
21
18
  end
22
19
  alias << add
data/spec/config_spec.rb CHANGED
@@ -174,6 +174,13 @@ describe Confetti::Config do
174
174
  }.should raise_error Confetti::Config::XMLError
175
175
  end
176
176
 
177
+ it "should raise an error if no root node is found" do
178
+ File.stub(:read).and_return(nil)
179
+ lambda {
180
+ @config.populate_from_xml("#{ fixture_dir }/empty_non_existent.xml")
181
+ }.should raise_error Confetti::Config::XMLError
182
+ end
183
+
177
184
  describe "when setting attributes from config.xml" do
178
185
  before do
179
186
  @config.populate_from_xml(fixture_dir + "/config.xml")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 1
9
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.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: 2011-09-21 00:00:00 -07:00
19
+ date: 2011-10-13 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -98,6 +98,7 @@ files:
98
98
  - .gitignore
99
99
  - Gemfile
100
100
  - Gemfile.lock
101
+ - LICENSE
101
102
  - README.md
102
103
  - Rakefile
103
104
  - bin/confetti