spielplan_saar 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.simplecov ADDED
@@ -0,0 +1 @@
1
+ SimpleCov.start
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - rbx-19mode
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in spielplan_saar.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Robert Gogolok
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,2 @@
1
+ "!https://secure.travis-ci.org/gogolok/spielplan_saar.png!":http://travis-ci.org/gogolok/spielplan_saar
2
+ "!https://codeclimate.com/badge.png!":https://codeclimate.com/github/gogolok/spielplan_saar
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,5 @@
1
+ require "spielplan_saar/table_entry"
2
+ require "spielplan_saar/table_parser"
3
+ require "spielplan_saar/result_page_parser"
4
+
5
+ require "spielplan_saar/version"
@@ -0,0 +1,24 @@
1
+ require 'ostruct'
2
+
3
+ module SpielplanSaar
4
+
5
+ class ResultPageParser
6
+ attr_reader :html_content
7
+
8
+ def initialize(html_content)
9
+ @html_content = html_content
10
+ end
11
+
12
+ def self.parse(html_content)
13
+ self.new(html_content).parse
14
+ end
15
+
16
+ def parse
17
+ OpenStruct.new(:table => TableParser.new(html_content).parse)
18
+ end
19
+
20
+ private
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,24 @@
1
+ module SpielplanSaar
2
+ TableEntry = Struct.new(:position, :team, :games, :points, :goals, :difference)
3
+
4
+ class TableEntry
5
+
6
+ def self.parse(row_node)
7
+ position = inner_text_at_position(row_node, 1)
8
+ team = inner_text_at_position(row_node, 2)
9
+ games = inner_text_at_position(row_node, 3)
10
+ points = inner_text_at_position(row_node, 4)
11
+ goals = inner_text_at_position(row_node, 5)
12
+ difference = inner_text_at_position(row_node, 6)
13
+
14
+ self.new(position, team, games, points, goals, difference)
15
+ end
16
+
17
+ private
18
+
19
+ def self.inner_text_at_position(row_node, position)
20
+ row_node.xpath(".//td[#{position}]").inner_text.strip
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,35 @@
1
+ require 'nokogiri'
2
+
3
+ module SpielplanSaar
4
+ class TableParser
5
+ attr_reader :html_content
6
+
7
+ def initialize(html_content)
8
+ @html_content = html_content
9
+ end
10
+
11
+ def parse
12
+ table_row_nodes.collect do |row_node|
13
+ TableEntry.parse(row_node)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def doc
20
+ @doc ||= Nokogiri::HTML(html_content)
21
+ end
22
+
23
+ def table_node
24
+ @table_node ||= doc.xpath('//*[@id="logo_rechts_oben"]/form/table/tr/td/table/tr/td/table')[-3]
25
+ end
26
+
27
+ def table_row_nodes
28
+ @table_row_nodes ||=
29
+ begin
30
+ table_node.xpath('.//tr')[1..-1] # skip first entry
31
+ end
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ module SpielplanSaar
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe "dummy" do
4
+ it "should should run successfully" do
5
+ end
6
+ end
@@ -0,0 +1,399 @@
1
+ <script language='JavaScript'>
2
+ <!--
3
+
4
+
5
+ function kalender(datum, ebenen, feldname)
6
+ {
7
+ var ziel = 'kalender_anzeigen.php3?datum=';
8
+
9
+ for(i=1; i<= ebenen; i++)
10
+ ziel = '../' + ziel;
11
+
12
+ ziel = ziel + datum;
13
+ ziel = ziel + '&feld_name=';
14
+ ziel = ziel + feldname;
15
+
16
+ F1 = window.open(ziel,'Kalender','width=600,height=400,resizable=no,scrollbars=yes,screenX=0,screenY=0, status=yes');
17
+ window.F1.focus();
18
+ }
19
+ //-->
20
+ </script>
21
+
22
+
23
+
24
+ <html>
25
+ <head>
26
+
27
+ <script language="JavaScript">
28
+ <!--
29
+ function MM_jumpMenu(targ,selObj,restore){ //v3.0
30
+ eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
31
+ if (restore) selObj.selectedIndex=0;
32
+ }
33
+
34
+ function MM_findObj(n, d) { //v3.0
35
+ var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
36
+ d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
37
+ if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
38
+ for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
39
+ }
40
+
41
+ function MM_jumpMenuGo(selName,targ,restore){ //v3.0
42
+ var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
43
+ }
44
+ //-->
45
+ </script>
46
+
47
+
48
+
49
+ <title>Handballverband Saar</title>
50
+
51
+ <meta name="author" content="internetFX">
52
+ <!--
53
+
54
+ Webdesign von
55
+ internetFX
56
+
57
+ Besuchen Sie unsere Internet-Seiten unter
58
+ http://www.internetFX.de
59
+
60
+ oder senden Sie uns eine E-Mail unter
61
+ info@internetFX.de
62
+
63
+
64
+ //-->
65
+
66
+ <link rel=stylesheet type='text/css' href='../css_style.css'>
67
+
68
+
69
+
70
+ </head>
71
+
72
+
73
+
74
+
75
+ <body bgcolor='#FFFFFF' text='#000000' link='#0007C4' vlink='#0007C4' alink='#0007A2' marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' background='../../bilder/hg_leer.gif'>
76
+ <form method="post" action="index.php" name="formular">
77
+
78
+ <input type="hidden" name="auswahl_saison" value="$auswahl_saison">
79
+
80
+ <table width="100%" height="100%" border="0" bordercolor="#00047C" cellspacing="0" cellpadding="0" align="center">
81
+ <tr>
82
+ <td>
83
+
84
+ <table width="770" height="400" border="1" bordercolor="#00047C" cellspacing="0" cellpadding="0" align="center">
85
+ <tr>
86
+ <td height="30" bgcolor="#FFFFFF">&nbsp;&nbsp;<b>Ergebnisse</b>&nbsp;&nbsp;
87
+ <a href="../spielplan/index.php?klassen_vorhanden=934&auswahl_saison=35" target="_self">Spielpl&auml;ne</a>&nbsp;&nbsp;
88
+
89
+ <select name="auswahl_saison" onchange="document.getElementById('formular').submit()">
90
+
91
+
92
+ <option value='22'>Saison 2004/2005</option>
93
+ <option value='24'>Saison 2005/2006</option>
94
+ <option value='28'>Saison 2006/2007</option>
95
+ <option value='29'>Saison 2007/2008</option>
96
+ <option value='31'>Saison 2008/2009</option>
97
+ <option value='32'>Saison 2009/2010</option>
98
+ <option value='33'>Saison 2010/2011</option>
99
+ <option value='34'>Saison 2011/2012</option>
100
+ <option value='35' selected>Saison 2012/2013</option>
101
+ </select>
102
+
103
+ </td>
104
+ </tr>
105
+ <tr bgcolor="#FFFFFF">
106
+ <td valign="top" id="logo_rechts_oben">
107
+ </form>
108
+
109
+
110
+ <form method='post' action='tabelle_anzeigen.php3?klassen_vorhanden=934&auswahl_saison=35' name='formular'>
111
+
112
+ <input type='hidden' name='klassen_vorhanden' value='934'>
113
+ <input type='hidden' name='klassen_aufstiegsplaetze' value=''>
114
+ <input type='hidden' name='klassen_abstiegsplaetze' value=''><br><br>
115
+ <table width='100%' height='100%' border='0' bordercolor='#00047C' cellspacing='0' cellpadding='6' align='center'>
116
+ <tr>
117
+ <td height='40' valign='bottom'><b>Spielergebnisse der Saison Saison 2012/2013</b></td>
118
+ </tr>
119
+ <tr>
120
+ <td valign='top'><table width='40%' border='0' cellspacing='0' cellpadding='4' align='' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
121
+ <tr>
122
+ <td colspan='2'>
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+ <select name="select" onChange="MM_jumpMenu('self',this,0);MM_jumpMenuGo('select','self',0)">
131
+
132
+
133
+ <option value='index.php?klassen_vorhanden=936&auswahl_saison=35'>Saarlandliga M?nner</option>
134
+ <option value='index.php?klassen_vorhanden=954&auswahl_saison=35'>Saarlandliga Frauen</option>
135
+ <option value='index.php?klassen_vorhanden=935&auswahl_saison=35'>Verbandsliga Saar M?nner</option>
136
+ <option value='index.php?klassen_vorhanden=951&auswahl_saison=35'>Saarlandliga m?nnliche Jugend A</option>
137
+ <option value='index.php?klassen_vorhanden=919&auswahl_saison=35'>Saarlandliga weibliche Jugend A</option>
138
+ <option value='index.php?klassen_vorhanden=950&auswahl_saison=35'>Saarlandliga m?nnliche Jugend B</option>
139
+ <option value='index.php?klassen_vorhanden=921&auswahl_saison=35'>Saarlandliga weibliche Jugend B</option>
140
+ <option value='index.php?klassen_vorhanden=949&auswahl_saison=35'>Saarlandliga m?nnliche Jugend C</option>
141
+ <option value='index.php?klassen_vorhanden=920&auswahl_saison=35'>Saarlandliga weibliche Jugend C</option>
142
+ <option value='index.php?klassen_vorhanden=952&auswahl_saison=35'>Saarlandliga m?nnliche Jugend D</option>
143
+ <option value='index.php?klassen_vorhanden=934&auswahl_saison=35' selected>Bezirksliga Ost M?nner</option>
144
+ <option value='index.php?klassen_vorhanden=940&auswahl_saison=35'>Bezirksliga West M?nner</option>
145
+ <option value='index.php?klassen_vorhanden=953&auswahl_saison=35'>Bezirksliga Ost Frauen</option>
146
+ <option value='index.php?klassen_vorhanden=942&auswahl_saison=35'>Bezirksliga West Frauen</option>
147
+ <option value='index.php?klassen_vorhanden=955&auswahl_saison=35'>A - Liga Ost Frauen</option>
148
+ <option value='index.php?klassen_vorhanden=943&auswahl_saison=35'>A - Liga West Frauen Staffel Nord</option>
149
+ <option value='index.php?klassen_vorhanden=944&auswahl_saison=35'>A - Liga West Frauen Staffel S?d</option>
150
+ <option value='index.php?klassen_vorhanden=933&auswahl_saison=35'>A - Liga Ost M?nner</option>
151
+ <option value='index.php?klassen_vorhanden=938&auswahl_saison=35'>A - Liga West M?nner</option>
152
+ <option value='index.php?klassen_vorhanden=932&auswahl_saison=35'>B - Liga Ost M?nner Staffel I</option>
153
+ <option value='index.php?klassen_vorhanden=931&auswahl_saison=35'>B - Liga Ost M?nner Staffel II</option>
154
+ <option value='index.php?klassen_vorhanden=939&auswahl_saison=35'>B - Liga West M?nner Staffel Nord</option>
155
+ <option value='index.php?klassen_vorhanden=941&auswahl_saison=35'>B - Liga West M?nner Staffel S?d</option>
156
+ <option value='index.php?klassen_vorhanden=945&auswahl_saison=35'>M?nnliche Jugend A</option>
157
+ <option value='index.php?klassen_vorhanden=927&auswahl_saison=35'>Weibliche Jugend A</option>
158
+ <option value='index.php?klassen_vorhanden=948&auswahl_saison=35'>M?nnliche Jugend B Ost</option>
159
+ <option value='index.php?klassen_vorhanden=923&auswahl_saison=35'>M?nnliche Jugend B West</option>
160
+ <option value='index.php?klassen_vorhanden=926&auswahl_saison=35'>Weibliche Jugend B Ost</option>
161
+ <option value='index.php?klassen_vorhanden=928&auswahl_saison=35'>Weibliche Jugend B West</option>
162
+ <option value='index.php?klassen_vorhanden=947&auswahl_saison=35'>M?nnliche Jugend C Ost</option>
163
+ <option value='index.php?klassen_vorhanden=946&auswahl_saison=35'>M?nnliche Jugend C Mitte</option>
164
+ <option value='index.php?klassen_vorhanden=922&auswahl_saison=35'>M?nnliche Jugend C West</option>
165
+ <option value='index.php?klassen_vorhanden=924&auswahl_saison=35'>Weibliche Jugend C Ost</option>
166
+ <option value='index.php?klassen_vorhanden=925&auswahl_saison=35'>Weibliche Jugend C West</option>
167
+ <option value='index.php?klassen_vorhanden=912&auswahl_saison=35'>M?nnliche Jugend D Ost</option>
168
+ <option value='index.php?klassen_vorhanden=911&auswahl_saison=35'>M?nnliche Jugend D Mitte</option>
169
+ <option value='index.php?klassen_vorhanden=937&auswahl_saison=35'>M?nnliche Jugend D West</option>
170
+ <option value='index.php?klassen_vorhanden=917&auswahl_saison=35'>Weibliche Jugend D Ost</option>
171
+ <option value='index.php?klassen_vorhanden=929&auswahl_saison=35'>Weibliche Jugend D West</option>
172
+ <option value='index.php?klassen_vorhanden=913&auswahl_saison=35'>M?nnliche Jugend E Ost Staffel Nord</option>
173
+ <option value='index.php?klassen_vorhanden=914&auswahl_saison=35'>M?nnliche Jugend E Ost Staffel S?d</option>
174
+ <option value='index.php?klassen_vorhanden=910&auswahl_saison=35'>M?nnliche Jugend E West Staffel Nord</option>
175
+ <option value='index.php?klassen_vorhanden=909&auswahl_saison=35'>M?nnliche Jugend E West Staffel S?d</option>
176
+ <option value='index.php?klassen_vorhanden=916&auswahl_saison=35'>Weibliche Jugend E Ost</option>
177
+ <option value='index.php?klassen_vorhanden=930&auswahl_saison=35'>Weibliche Jugend E West</option>
178
+ <option value='index.php?klassen_vorhanden=915&auswahl_saison=35'>gemischte Jugend F Ost</option>
179
+ <option value='index.php?klassen_vorhanden=908&auswahl_saison=35'>gemischte Jugend F West</option>
180
+ </select>
181
+ </font></td>
182
+ </tr>
183
+
184
+ </table><br><table width='100%' border='0' cellspacing='0' cellpadding='2' align='center' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
185
+ <tr><td width='81%' colspan='2'>Datum: 20.10.2012<br><br><table width='80%' border='1' cellspacing='0' cellpadding='4' align='' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
186
+ <tr bgcolor=''>
187
+ <td align='left' width='30%'><font size='2'>Datum - Uhrzeit</font></td>
188
+ <td align='left' width='60%'><font size='2'>Spielpaarung</font></td>
189
+ <td align='left' width='10%'><font size='2'>Ergebnis</font></td>
190
+ </tr>
191
+ <tr>
192
+ <td align='left'><font size='1'>13.10.2012 17:30 Uhr</font></td>
193
+ <td align='left'><font size='1'>SGH Sankt Ingbert II&nbsp;-&nbsp;HSV Wemmetsweiler I</font></td>
194
+ <td align='center'><font size='1'>27 : 23</font></td>
195
+ </tr>
196
+ <tr>
197
+ <td align='left'><font size='1'>13.10.2012 20:00 Uhr</font></td>
198
+ <td align='left'><font size='1'>HSG Bexbach/H?chen I&nbsp;-&nbsp;HWE Erbach/Waldmohr I</font></td>
199
+ <td align='center'><font size='1'>31 : 32</font></td>
200
+ </tr>
201
+ <tr>
202
+ <td align='left'><font size='1'>14.10.2012 18:30 Uhr</font></td>
203
+ <td align='left'><font size='1'>HSV Wemmetsweiler II&nbsp;-&nbsp;SV 64 Zweibr?cken III</font></td>
204
+ <td align='center'><font size='1'>25 : 30</font></td>
205
+ </tr>
206
+ <tr>
207
+ <td align='left'><font size='1'>14.10.2012 19:00 Uhr</font></td>
208
+ <td align='left'><font size='1'>HSG DJK Nordsaar II&nbsp;-&nbsp;HSG Spiesen/Elversberg I</font></td>
209
+ <td align='center'><font size='1'>22 : 14</font></td>
210
+ </tr></table><br><table width='80%' border='1' cellspacing='0' cellpadding='4' align='' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
211
+ <tr bgcolor=''>
212
+ <td align='left' width='30%'><font size='2'>Datum - Uhrzeit</font></td>
213
+ <td align='left' width='60%'><font size='2'>Spielpaarung</font></td>
214
+ <td align='left' width='10%'><font size='2'>Ergebnis</font></td>
215
+ </tr>
216
+ <tr>
217
+ <td align='left'><font size='1'>19.10.2012 18:10 Uhr</font></td>
218
+ <td align='left'><font size='1'>RW Schaumberg/Sotzweiler I&nbsp;-&nbsp;SG Ommersheim/A?weiler I</font></td>
219
+ <td align='center'><font size='1'>- : -</font></td>
220
+ </tr></table><br><table width='80%' border='1' cellspacing='0' cellpadding='4' align='' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
221
+ <tr bgcolor=''>
222
+ <td align='left' width='30%'><font size='2'>Datum - Uhrzeit</font></td>
223
+ <td align='left' width='60%'><font size='2'>Spielpaarung</font></td>
224
+ <td align='left' width='10%'><font size='2'>Ergebnis</font></td>
225
+ </tr>
226
+ <tr>
227
+ <td align='left'><font size='1'>28.10.2012 16:00 Uhr</font></td>
228
+ <td align='left'><font size='1'>TV Merchweiler II&nbsp;-&nbsp;MSG HF Illtal III</font></td>
229
+ <td align='center'><font size='1'>- : -</font></td>
230
+ </tr>
231
+ <tr>
232
+ <td align='left'><font size='1'>28.10.2012 19:00 Uhr</font></td>
233
+ <td align='left'><font size='1'>HSG Bexbach/H?chen I&nbsp;-&nbsp;HSV Wemmetsweiler II</font></td>
234
+ <td align='center'><font size='1'>- : -</font></td>
235
+ </tr></table>
236
+ </td>
237
+ </tr>
238
+ <tr>
239
+ <td colspan='2'><p>&nbsp;<table width='80%' border='0' cellspacing='0' cellpadding='0' align='' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
240
+ <tr>
241
+ <td align='center'><a href='counter.php?banner_id=3&anzeige_flag=1' target='_blank'><img src='../../bilder_werbebanner/3.jpg' border='0'></a>&nbsp;</td>
242
+ </tr>
243
+ </table><br><br>
244
+ </td>
245
+ </tr>
246
+ <tr>
247
+ <td width='81%'><table width='100%' border='1' cellspacing='0' cellpadding='4' align='left' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
248
+ <tr bgcolor='#D6DBDE'>
249
+ <td align='center' width='5%'><font size='2'>Pos</font></td>
250
+ <td align='left' width='35%'><font size='2'>Mannschaft</font></td>
251
+ <td align='center' width='5%'><font size='2'>Spiele</font></td>
252
+ <td align='center' width='10%'><font size='2'>Punkte</font></td>
253
+ <td align='center' width='10%'><font size='2'>Tore</font></td>
254
+ <td align='center' width='10%'><font size='2'>Differenz</font></td>
255
+ </tr>
256
+ <tr bgcolor=''>
257
+ <td align='center'><font size='2'>1</font></td>
258
+ <td align='left'><font size='2'>SGH Sankt Ingbert II</font></td>
259
+ <td align='center'><font size='2'>5</font></td>
260
+ <td align='center'><font size='2'>8 : 2</font></td>
261
+ <td align='center'><font size='2'>166 : 118</font></td>
262
+ <td align='center'><font size='2'>48</font></td>
263
+ </tr>
264
+ <tr bgcolor=''>
265
+ <td align='center'><font size='2'>2</font></td>
266
+ <td align='left'><font size='2'>HWE Erbach/Waldmohr I</font></td>
267
+ <td align='center'><font size='2'>5</font></td>
268
+ <td align='center'><font size='2'>8 : 2</font></td>
269
+ <td align='center'><font size='2'>160 : 142</font></td>
270
+ <td align='center'><font size='2'>18</font></td>
271
+ </tr>
272
+ <tr bgcolor=''>
273
+ <td align='center'><font size='2'>3</font></td>
274
+ <td align='left'><font size='2'>HSG Spiesen/Elversberg I</font></td>
275
+ <td align='center'><font size='2'>5</font></td>
276
+ <td align='center'><font size='2'>7 : 3</font></td>
277
+ <td align='center'><font size='2'>126 : 107</font></td>
278
+ <td align='center'><font size='2'>19</font></td>
279
+ </tr>
280
+ <tr bgcolor=''>
281
+ <td align='center'><font size='2'>4</font></td>
282
+ <td align='left'><font size='2'>HSV Wemmetsweiler I</font></td>
283
+ <td align='center'><font size='2'>6</font></td>
284
+ <td align='center'><font size='2'>7 : 5</font></td>
285
+ <td align='center'><font size='2'>175 : 166</font></td>
286
+ <td align='center'><font size='2'>9</font></td>
287
+ </tr>
288
+ <tr bgcolor=''>
289
+ <td align='center'><font size='2'>5</font></td>
290
+ <td align='left'><font size='2'>HSG DJK Nordsaar II</font></td>
291
+ <td align='center'><font size='2'>6</font></td>
292
+ <td align='center'><font size='2'>7 : 5</font></td>
293
+ <td align='center'><font size='2'>155 : 152</font></td>
294
+ <td align='center'><font size='2'>3</font></td>
295
+ </tr>
296
+ <tr bgcolor=''>
297
+ <td align='center'><font size='2'>6</font></td>
298
+ <td align='left'><font size='2'>SG Ommersheim/A?weiler I</font></td>
299
+ <td align='center'><font size='2'>5</font></td>
300
+ <td align='center'><font size='2'>6 : 4</font></td>
301
+ <td align='center'><font size='2'>118 : 112</font></td>
302
+ <td align='center'><font size='2'>6</font></td>
303
+ </tr>
304
+ <tr bgcolor=''>
305
+ <td align='center'><font size='2'>7</font></td>
306
+ <td align='left'><font size='2'>RW Schaumberg/Sotzweiler I</font></td>
307
+ <td align='center'><font size='2'>5</font></td>
308
+ <td align='center'><font size='2'>6 : 4</font></td>
309
+ <td align='center'><font size='2'>128 : 131</font></td>
310
+ <td align='center'><font size='2'>-3</font></td>
311
+ </tr>
312
+ <tr bgcolor=''>
313
+ <td align='center'><font size='2'>8</font></td>
314
+ <td align='left'><font size='2'>TV Merchweiler II</font></td>
315
+ <td align='center'><font size='2'>5</font></td>
316
+ <td align='center'><font size='2'>6 : 4</font></td>
317
+ <td align='center'><font size='2'>128 : 137</font></td>
318
+ <td align='center'><font size='2'>-9</font></td>
319
+ </tr>
320
+ <tr bgcolor=''>
321
+ <td align='center'><font size='2'>9</font></td>
322
+ <td align='left'><font size='2'>HSG Bexbach/H?chen I</font></td>
323
+ <td align='center'><font size='2'>4</font></td>
324
+ <td align='center'><font size='2'>5 : 3</font></td>
325
+ <td align='center'><font size='2'>124 : 99</font></td>
326
+ <td align='center'><font size='2'>25</font></td>
327
+ </tr>
328
+ <tr bgcolor=''>
329
+ <td align='center'><font size='2'>10</font></td>
330
+ <td align='left'><font size='2'>SV 64 Zweibr?cken III</font></td>
331
+ <td align='center'><font size='2'>6</font></td>
332
+ <td align='center'><font size='2'>2 : 10</font></td>
333
+ <td align='center'><font size='2'>148 : 176</font></td>
334
+ <td align='center'><font size='2'>-28</font></td>
335
+ </tr>
336
+ <tr bgcolor=''>
337
+ <td align='center'><font size='2'>11</font></td>
338
+ <td align='left'><font size='2'>HSV Wemmetsweiler II</font></td>
339
+ <td align='center'><font size='2'>5</font></td>
340
+ <td align='center'><font size='2'>0 : 10</font></td>
341
+ <td align='center'><font size='2'>95 : 131</font></td>
342
+ <td align='center'><font size='2'>-36</font></td>
343
+ </tr>
344
+ <tr bgcolor=''>
345
+ <td align='center'><font size='2'>12</font></td>
346
+ <td align='left'><font size='2'>MSG HF Illtal III</font></td>
347
+ <td align='center'><font size='2'>5</font></td>
348
+ <td align='center'><font size='2'>0 : 10</font></td>
349
+ <td align='center'><font size='2'>130 : 182</font></td>
350
+ <td align='center'><font size='2'>-52</font></td>
351
+ </tr>
352
+ </td></tr>
353
+ </table>
354
+ </td>
355
+ <td valign='top' width='19%'><table width='80' border='0' cellspacing='0' cellpadding='2' align='center' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
356
+ <tr>
357
+ <td align='left' width='80' colspan='2'><b>Legende</b></td>
358
+ </tr>
359
+ <tr>
360
+ <td height='1' colspan='2' bgcolor='#000000'></td>
361
+ </tr>
362
+ <tr>
363
+ <td height='10'></td>
364
+ </tr>
365
+ <tr>
366
+ <td align='left' bgcolor='#98fb98' width='25'></td>
367
+ <td align='left' width='55'><font size='1'>Aufstiegsplatz</font></td>
368
+ </tr>
369
+ <tr>
370
+ <td align='left' bgcolor='#ffe4e1' width='25'>&nbsp;</td>
371
+ <td align='left' width='55'><font size='1'>Abstiegsplatz</font></td>
372
+ </tr>
373
+ <tr>
374
+ <td height='10'></td>
375
+ </tr>
376
+ <tr>
377
+ <td><a href='tabelle_drucken.php?klassen_id=934' target='_blank'><img width='25' src='../../bilder/print.gif' border='0' alt='Tabelle ausdrucken'></a></td>
378
+ <td><a href='tabelle_drucken.php?klassen_id=934' target='_blank'>Ausdrucken</a></td>
379
+ </tr>
380
+ </table>
381
+
382
+ </td>
383
+ </tr>
384
+ <tr>
385
+ <td colspan='2'><p>&nbsp;<table width='80%' border='0' cellspacing='0' cellpadding='0' align='' bordercolorlight='#F7F3F7' bordercolordark='#F7F3F7'>
386
+ <tr>
387
+ </tr>
388
+ </table>
389
+ </td></tr>
390
+ </table>
391
+ </form>
392
+ </table>
393
+
394
+
395
+ </td></tr></table>
396
+ <table width="770" align="center"><tr><td>&nbsp;</td><td align="right"><a href="http://www.internetfx.de" target="_blank"><font size="1" color="#AAAAAA">powered by InternetFX</font></a></td></tr></table>
397
+ </td></tr></table>
398
+ </body>
399
+ </html>
@@ -0,0 +1,29 @@
1
+ require "spec_helper"
2
+ require_relative "../lib/spielplan_saar/table_entry"
3
+ require_relative "../lib/spielplan_saar/result_page_parser"
4
+ require_relative "../lib/spielplan_saar/table_parser"
5
+
6
+ describe SpielplanSaar::ResultPageParser do
7
+
8
+ describe ".parse" do
9
+
10
+ let(:html_content) do
11
+ File.open(File.join(FIXTURE_PATH, 'result_page_parser_test_page_1.html'))
12
+ end
13
+
14
+ let(:result_object) { SpielplanSaar::ResultPageParser.parse(html_content) }
15
+
16
+ it "should parse html content" do
17
+ result_object.should be
18
+ end
19
+
20
+ describe "result table" do
21
+ it "should return a table" do
22
+ result_object.table.should be
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,4 @@
1
+ require 'nokogiri'
2
+ require 'simplecov'
3
+
4
+ FIXTURE_PATH = File.dirname(__FILE__) + '/fixtures'
@@ -0,0 +1,28 @@
1
+ require "spec_helper"
2
+ require_relative "../lib/spielplan_saar/table_entry"
3
+
4
+ describe SpielplanSaar::TableEntry do
5
+ describe ".parse" do
6
+ let (:entry1) do
7
+ html_content = <<-EOF
8
+ <tr bgcolor="">
9
+ <td align="center"><font size="2">12</font></td>
10
+ <td align="left"><font size="2">TV Heiligenwald I</font></td>
11
+ <td align="center"><font size="2">4</font></td>
12
+ <td align="center"><font size="2">0 : 8</font></td>
13
+ <td align="center"><font size="2">107 : 148</font></td>
14
+ <td align="center"><font size="2">-41</font></td>
15
+ </tr>
16
+ EOF
17
+ row_node = Nokogiri::HTML(html_content)
18
+ SpielplanSaar::TableEntry.parse(row_node)
19
+ end
20
+
21
+ it { entry1.position.should eq('12') }
22
+ it { entry1.team.should eq('TV Heiligenwald I') }
23
+ it { entry1.games.should eq('4') }
24
+ it { entry1.points.should eq('0 : 8') }
25
+ it { entry1.goals.should eq('107 : 148') }
26
+ it { entry1.difference.should eq('-41') }
27
+ end
28
+ end
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+ require_relative "../lib/spielplan_saar/table_parser"
3
+
4
+ describe SpielplanSaar::TableParser do
5
+
6
+ describe "#initialize" do
7
+
8
+ let(:html_content) do
9
+ File.open(File.join(FIXTURE_PATH, 'result_page_parser_test_page_1.html'))
10
+ end
11
+
12
+ let(:result_object) { SpielplanSaar::TableParser.new(html_content).parse }
13
+
14
+ it "should parse html content" do
15
+ result_object.should be
16
+ end
17
+
18
+ describe "result table" do
19
+
20
+ it "should have many entries" do
21
+ result_object.size.should be > 0
22
+ end
23
+
24
+ describe "test page 1" do
25
+
26
+ it "should have size 12" do
27
+ result_object.size.should be 12
28
+ end
29
+
30
+ describe "third entry" do
31
+ let(:third_entry) { result_object[2] }
32
+
33
+ it { third_entry.position.should eq('3') }
34
+ it { third_entry.team.should eq('HSG Spiesen/Elversberg I') }
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'spielplan_saar/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "spielplan_saar"
8
+ gem.version = SpielplanSaar::VERSION
9
+ gem.authors = ["Robert Gogolok"]
10
+ gem.email = ["gogolok@gmail.com"]
11
+ gem.description = %q{Handball Spielplan Saar Parser}
12
+ gem.summary = %q{Handball Spielplan Saar Parser}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_development_dependency(%q<rspec>,[">= 2.11.0"])
21
+ gem.add_development_dependency(%q<simplecov>,[">= 0.6.4"])
22
+ gem.add_development_dependency(%q<rake>, [">= 0.9.2.2"])
23
+
24
+ gem.add_dependency(%q<nokogiri>, [">= 1.5.5"])
25
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spielplan_saar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Robert Gogolok
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.11.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.11.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: simplecov
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.6.4
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.6.4
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.9.2.2
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.2.2
62
+ - !ruby/object:Gem::Dependency
63
+ name: nokogiri
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.5.5
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.5
78
+ description: Handball Spielplan Saar Parser
79
+ email:
80
+ - gogolok@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - .simplecov
87
+ - .travis.yml
88
+ - Gemfile
89
+ - LICENSE.txt
90
+ - README.textile
91
+ - Rakefile
92
+ - lib/spielplan_saar.rb
93
+ - lib/spielplan_saar/result_page_parser.rb
94
+ - lib/spielplan_saar/table_entry.rb
95
+ - lib/spielplan_saar/table_parser.rb
96
+ - lib/spielplan_saar/version.rb
97
+ - spec/dummy_spec.rb
98
+ - spec/fixtures/result_page_parser_test_page_1.html
99
+ - spec/result_page_parser_spec.rb
100
+ - spec/spec_helper.rb
101
+ - spec/table_entry_spec.rb
102
+ - spec/table_parser_spec.rb
103
+ - spielplan_saar.gemspec
104
+ homepage: ''
105
+ licenses: []
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ segments:
117
+ - 0
118
+ hash: -3494461263371807005
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ segments:
126
+ - 0
127
+ hash: -3494461263371807005
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 1.8.24
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: Handball Spielplan Saar Parser
134
+ test_files:
135
+ - spec/dummy_spec.rb
136
+ - spec/fixtures/result_page_parser_test_page_1.html
137
+ - spec/result_page_parser_spec.rb
138
+ - spec/spec_helper.rb
139
+ - spec/table_entry_spec.rb
140
+ - spec/table_parser_spec.rb