cricinfo 0.0.2 → 0.0.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/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.0.3 2010-09-12
2
+
3
+ * bugfix for parsing team names containing spaces
4
+
1
5
  === 0.0.2 2010-07-14
2
6
 
3
7
  * updated match regex
data/bin/cricinfo CHANGED
@@ -19,7 +19,7 @@ begin
19
19
  case command
20
20
  when 'list'
21
21
  c = CricInfo::Scores.new
22
- c.games.each { |game| puts game.summary }
22
+ c.games.each { |game| puts game.summary; puts }
23
23
  else
24
24
  error("unrecognised command #{command}")
25
25
  usage
@@ -7,11 +7,11 @@ module CricInfo
7
7
  SCORES_PATH = "/s/2497/Scores"
8
8
 
9
9
  # match name, team1, team2, inningsdata, start_time
10
- RE_MATCH = /matchId=.*?">(.+?):\s*(\w+)\s+v\s+(\w+)<\/a>.*?<\/tr>(.*?)<\/tr>(.*?Start time (.*?)\s*<\/b>)?/
10
+ RE_MATCH = /matchId=.*?">([^:]+):\s*(.*?)\s+v\s+(.*?)<\/a>.*?<\/tr>(.*?)<\/tr>(.*?Start time (.*?)\s*<\/b>)?/
11
11
 
12
12
  # team1/2, i1runs, i1wickets, i1decl, i2wickets, i2decl, overs
13
13
  # (overs optional)
14
- RE_INNINGS = /<b>\s*(\w+)\s*<\/b>\s*<b>\s*(\d+)(?:\/(\d+))?(d)?(?:\s*&amp;\s*(\d+)\/(\d+)(d)?)?\s*(?:\(([\d\.]+))?/
14
+ RE_INNINGS = /<b>\s*(.*?)\s*<\/b>\s*<b>\s*(\d+)(?:\/(\d+))?(d)?(?:\s*&amp;\s*(\d+)\/(\d+)(d)?)?\s*(?:\(([\d\.]+))?/
15
15
 
16
16
  # start_time (e.g. Start time 09:30 GMT)
17
17
  RE_START = /<b>\s*Start\s+time\s+(.*?)\s*<\/b>/
data/lib/cricinfo.rb CHANGED
@@ -8,7 +8,7 @@ require 'cricinfo/game'
8
8
  require 'cricinfo/scores'
9
9
 
10
10
  module CricInfo
11
- VERSION = '0.0.2'
11
+ VERSION = '0.0.3'
12
12
  end
13
13
 
14
14
  # array monkey patch
@@ -99,6 +99,26 @@ describe CricInfo::Scores do
99
99
  game.inns4.team.should == "BAN"
100
100
  end
101
101
 
102
+ # Scores8.html
103
+ # (team with space in the name)
104
+
105
+ it "should initialize and parse score data 8" do
106
+ CricInfo::Scores.should_receive(:fetch_score_data).and_return(fixture(8))
107
+ c = CricInfo::Scores.new
108
+ c.should_not be_nil
109
+
110
+ c.games.length.should == 3
111
+ game = c.games[1] # LIONS v SOUTH AUST
112
+ game.innings.length.should == 1
113
+
114
+ game.team1.should == "LIONS"
115
+ game.team2.should == "SOUTH AUST"
116
+ game.inns1.team.should == "SOUTH AUST"
117
+ game.inns1.runs.should == 165
118
+ game.inns1.wickets.should == 4
119
+ end
120
+
121
+
102
122
  private
103
123
 
104
124
  def fixture(number)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cricinfo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew S Williams
@@ -15,25 +15,41 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-14 00:00:00 +09:30
18
+ date: 2010-09-12 00:00:00 +09:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: hoe
22
+ name: rubyforge
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 5
29
+ hash: 7
30
30
  segments:
31
31
  - 2
32
- - 3
33
- - 3
34
- version: 2.3.3
32
+ - 0
33
+ - 4
34
+ version: 2.0.4
35
35
  type: :development
36
36
  version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: hoe
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 21
46
+ segments:
47
+ - 2
48
+ - 6
49
+ - 1
50
+ version: 2.6.1
51
+ type: :development
52
+ version_requirements: *id002
37
53
  description: An interface to cricinfo.com game data (current games only).
38
54
  email:
39
55
  - sobakasu@gmail.com