beerxml 0.0.1
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/.gitignore +7 -0
- data/Gemfile +4 -0
- data/README.md +7 -0
- data/Rakefile +19 -0
- data/beerxml.gemspec +29 -0
- data/examples/beerxml.com/README.md +4 -0
- data/examples/beerxml.com/equipment.xml +56 -0
- data/examples/beerxml.com/grain.xml +99 -0
- data/examples/beerxml.com/hops.xml +105 -0
- data/examples/beerxml.com/mash.xml +307 -0
- data/examples/beerxml.com/misc.xml +74 -0
- data/examples/beerxml.com/recipes.xml +1412 -0
- data/examples/beerxml.com/style.xml +189 -0
- data/examples/beerxml.com/water.xml +75 -0
- data/examples/beerxml.com/yeast.xml +124 -0
- data/lib/beerxml.rb +11 -0
- data/lib/beerxml/hop.rb +22 -0
- data/lib/beerxml/model.rb +59 -0
- data/lib/beerxml/recipe.rb +10 -0
- data/lib/beerxml/version.rb +3 -0
- data/spec/parsing_spec.rb +32 -0
- data/spec/spec_helper.rb +9 -0
- metadata +208 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe "beerxml.com examples" do
|
4
|
+
def read_xml(example)
|
5
|
+
Nokogiri::XML(File.read("examples/beerxml.com/#{example}.xml"))
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should parse the first recipe and its hops" do
|
9
|
+
recipe = Beerxml::Recipe.new.from_xml(read_xml("recipes").root.children[1])
|
10
|
+
|
11
|
+
recipe.name.should == "Burton Ale"
|
12
|
+
recipe.should be_valid
|
13
|
+
|
14
|
+
recipe.hops.length.should == 4
|
15
|
+
hop = recipe.hops.first
|
16
|
+
hop.should be_a(Beerxml::Hop)
|
17
|
+
hop.name.should == "Goldings, East Kent"
|
18
|
+
hop.time.should == 60
|
19
|
+
hop.type.should == "Aroma"
|
20
|
+
hop.should be_valid
|
21
|
+
hop.alpha.should == 5.5
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should survive the round trip" do
|
25
|
+
hop = Beerxml::Hop.new.from_xml(read_xml("hops").root.children[1])
|
26
|
+
hop.should be_valid
|
27
|
+
xml = hop.to_xml
|
28
|
+
hop2 = Beerxml::Hop.new.from_xml(Nokogiri::XML(xml).root)
|
29
|
+
hop2.should be_valid
|
30
|
+
hop2.attributes.should == hop.attributes
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beerxml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Brian Palmer
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-06 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: nokogiri
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 4
|
33
|
+
version: "1.4"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: dm-core
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 15
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 0
|
48
|
+
version: "1.0"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: dm-validations
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 15
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 0
|
63
|
+
version: "1.0"
|
64
|
+
type: :runtime
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: dm-types
|
68
|
+
prerelease: false
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 15
|
75
|
+
segments:
|
76
|
+
- 1
|
77
|
+
- 0
|
78
|
+
version: "1.0"
|
79
|
+
type: :runtime
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rspec
|
83
|
+
prerelease: false
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 2
|
92
|
+
- 0
|
93
|
+
version: "2.0"
|
94
|
+
type: :development
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: ruby-debug
|
98
|
+
prerelease: false
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
type: :development
|
109
|
+
version_requirements: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rcov
|
112
|
+
prerelease: false
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
type: :development
|
123
|
+
version_requirements: *id007
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: yard
|
126
|
+
prerelease: false
|
127
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
136
|
+
type: :development
|
137
|
+
version_requirements: *id008
|
138
|
+
description: |-
|
139
|
+
Library for parsing and generating beerxml (http://www.beerxml.com/).
|
140
|
+
More than that, this library also contains various methods for doing calculations on beer ingredients and recipes, among other helpers.
|
141
|
+
email:
|
142
|
+
- brian@codekitchen.net
|
143
|
+
executables: []
|
144
|
+
|
145
|
+
extensions: []
|
146
|
+
|
147
|
+
extra_rdoc_files: []
|
148
|
+
|
149
|
+
files:
|
150
|
+
- .gitignore
|
151
|
+
- Gemfile
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- beerxml.gemspec
|
155
|
+
- examples/beerxml.com/README.md
|
156
|
+
- examples/beerxml.com/equipment.xml
|
157
|
+
- examples/beerxml.com/grain.xml
|
158
|
+
- examples/beerxml.com/hops.xml
|
159
|
+
- examples/beerxml.com/mash.xml
|
160
|
+
- examples/beerxml.com/misc.xml
|
161
|
+
- examples/beerxml.com/recipes.xml
|
162
|
+
- examples/beerxml.com/style.xml
|
163
|
+
- examples/beerxml.com/water.xml
|
164
|
+
- examples/beerxml.com/yeast.xml
|
165
|
+
- lib/beerxml.rb
|
166
|
+
- lib/beerxml/hop.rb
|
167
|
+
- lib/beerxml/model.rb
|
168
|
+
- lib/beerxml/recipe.rb
|
169
|
+
- lib/beerxml/version.rb
|
170
|
+
- spec/parsing_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
172
|
+
has_rdoc: true
|
173
|
+
homepage: https://github.com/codekitchen/beerxml
|
174
|
+
licenses: []
|
175
|
+
|
176
|
+
post_install_message:
|
177
|
+
rdoc_options: []
|
178
|
+
|
179
|
+
require_paths:
|
180
|
+
- lib
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
hash: 3
|
187
|
+
segments:
|
188
|
+
- 0
|
189
|
+
version: "0"
|
190
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
|
+
none: false
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
hash: 3
|
196
|
+
segments:
|
197
|
+
- 0
|
198
|
+
version: "0"
|
199
|
+
requirements: []
|
200
|
+
|
201
|
+
rubyforge_project:
|
202
|
+
rubygems_version: 1.6.1
|
203
|
+
signing_key:
|
204
|
+
specification_version: 3
|
205
|
+
summary: Library for parsing and generating beerxml (http://www.beerxml.com/)
|
206
|
+
test_files:
|
207
|
+
- spec/parsing_spec.rb
|
208
|
+
- spec/spec_helper.rb
|