greenmonster 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/LICENSE.txt +21 -0
- data/README.markdown +11 -28
- data/Rakefile +3 -8
- data/doc/Gemfile.html +6 -24
- data/doc/Greenmonster/Spider.html +47 -258
- data/doc/Greenmonster.html +25 -86
- data/doc/Rakefile.html +10 -25
- data/doc/created.rid +12 -18
- data/doc/index.html +6 -24
- data/doc/js/search_index.js +1 -1
- data/doc/table_of_contents.html +12 -129
- data/greenmonster.gemspec +16 -13
- data/lib/greenmonster/day_spider.rb +61 -0
- data/lib/greenmonster/file_downloader.rb +38 -0
- data/lib/greenmonster/game_spider.rb +100 -0
- data/lib/greenmonster/innings_downloader.rb +41 -0
- data/lib/greenmonster/spider.rb +1 -0
- data/lib/greenmonster/version.rb +2 -2
- data/lib/greenmonster.rb +16 -82
- data/spec/cassettes/aaa/year_2015/month_05/day_09.yml +153 -0
- data/spec/cassettes/gid_2007_10_01_sdnmlb_colmlb_1/innings.yml +135 -0
- data/spec/cassettes/gid_2015_04_18_balmlb_bos_mlb_1/players_xml.yml +292 -0
- data/spec/cassettes/gid_2015_04_18_balmlb_bos_mlb_2/players_xml.yml +46 -0
- data/spec/cassettes/mlb/year_2015/month_04/day_18.yml +170 -0
- data/spec/day_spider_spec.rb +80 -0
- data/spec/file_downloader_spec.rb +51 -0
- data/spec/fixtures/aaa_players.xml +70 -0
- data/spec/fixtures/boxscore.xml +1147 -0
- data/spec/fixtures/inning_all.xml +1 -0
- data/spec/fixtures/inning_hit.xml +1 -0
- data/spec/fixtures/linescore.xml +131 -0
- data/spec/fixtures/players.xml +63 -0
- data/spec/game_spider_spec.rb +116 -0
- data/spec/greenmonster_spec.rb +22 -34
- data/spec/innings_downloader_spec.rb +44 -0
- data/spec/spec_helper.rb +13 -21
- data/spec/support/path_helpers.rb +21 -0
- data/spec/support/vcr.rb +11 -0
- metadata +91 -67
- data/doc/Athlete.html +0 -254
- data/doc/Greenmonster/Generators/InstallGenerator.html +0 -253
- data/doc/Greenmonster/Generators.html +0 -147
- data/doc/Greenmonster/Parser.html +0 -263
- data/doc/Greenmonster/Player.html +0 -236
- data/doc/GreenmonsterPlayerTest.html +0 -199
- data/doc/GreenmonsterSpiderTest.html +0 -668
- data/doc/GreenmonsterTest.html +0 -262
- data/doc/GreenmonsterTraversalTest.html +0 -376
- data/doc/InstallGreenmonster.html +0 -260
- data/doc/TestCreatePlayersFromGamedayXMLGame.html +0 -266
- data/doc/TestParsePlayersFromGamedayXMLFiles.html +0 -307
- data/spec/games/tst/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1/blank.txt +0 -0
- data/spec/games/tst/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1_bak/blank.txt +0 -0
- data/spec/games/tst/year_2012/month_03/day_27/not_2012_03_27_aaamlb_aabmlb_1/blank.txt +0 -0
- data/spec/greenmonster/spider_spec.rb +0 -85
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4678752253ce01451b3d56eb3f3b81a05761e47d
|
4
|
+
data.tar.gz: 4cbc4105fe3d8848e56c3aeda09bd27912842fe8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 11f26ac5cf8d7f264eadaffbb9b78e7926f74bf7e33c3db81cf695d47794d987dd676d09ee4a236a931d806b0d82d85efa2e26fd124831df9ae90df26d3606bf
|
7
|
+
data.tar.gz: ba7734d2908004bff1784e1a0ee755b019c388829faec5439a54545d9a0df991bb4a0d6db941a5895283bee69593167e0a6d8f2aac0678191b0530b490434172
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Geoff Harcourt
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -9,51 +9,34 @@ Usage
|
|
9
9
|
Spider
|
10
10
|
------
|
11
11
|
|
12
|
-
|
12
|
+
Set a location where you'll save your local games after downloading.
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
# Set games folder location
|
16
|
-
Greenmonster.
|
16
|
+
Greenmonster.set_local_data_location("/Users/me/gameday")
|
17
17
|
```
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
Spider.pull_game takes a game_id (the folder name of the game on the Gameday server) and the date. The date is necessary because if a game is postponed or (yes, it's happened this decade) preponed, the game ID might have a date different than the actual date on which the game was played.
|
19
|
+
Download a game from MLB.
|
22
20
|
|
23
21
|
```ruby
|
24
22
|
# Pull MLB's 7/4/2011 Toronto @ Boston game
|
25
|
-
Greenmonster::
|
23
|
+
spider = Greenmonster::GameSpider.new(game_id: "gid_2011_07_04_tormlb_bosmlb_1", sport_code: "mlb")
|
24
|
+
spider.pull
|
26
25
|
```
|
27
26
|
|
28
|
-
|
27
|
+
Download games from a given date.
|
29
28
|
|
30
29
|
```ruby
|
31
30
|
# Pull all MLB games for today
|
32
|
-
Greenmonster::
|
31
|
+
Greenmonster::DaySpider.new(date: Date.today, sport_code: "mlb").pull
|
33
32
|
|
34
33
|
# Pull all rookie league games for today
|
35
|
-
Greenmonster::Spider.pull_day(Date.today,
|
36
|
-
|
37
|
-
# Pull all games in all sport codes for today
|
38
|
-
Greenmonster::SPORT_CODES.each do |sport_code|
|
39
|
-
Greenmonster::Spider.pull_day(Date.today, sport_code)
|
40
|
-
end
|
34
|
+
Greenmonster::Spider.pull_day(date: Date.today, sport_code: "rok")
|
41
35
|
```
|
42
36
|
|
43
|
-
|
44
|
-
|
45
|
-
Spider.pull_days takes a range of dates to process as an argument, plus the sport code for the games (MLB.
|
46
|
-
|
47
|
-
```ruby
|
48
|
-
# Pull all MLB games for in April, 2012
|
49
|
-
Greenmonster::Spider.pull_days((Date.new(2012,4,1)..Date.new(2012,4,30)), 'mlb')
|
50
|
-
```
|
51
|
-
|
52
|
-
|
53
|
-
|
54
37
|
Requirements
|
55
38
|
------------
|
56
|
-
- Ruby
|
39
|
+
- Ruby 2.0
|
57
40
|
- Bundler
|
58
41
|
- Nokogiri
|
59
42
|
- HTTParty
|
@@ -61,14 +44,14 @@ Requirements
|
|
61
44
|
Testing
|
62
45
|
-------
|
63
46
|
|
64
|
-
The test suite
|
47
|
+
The test suite uses RSpec.
|
65
48
|
|
66
49
|
|
67
50
|
License
|
68
51
|
-------
|
69
52
|
(The MIT License)
|
70
53
|
|
71
|
-
Copyright © [Geoff Harcourt](http://github.com/geoffharcourt) 2012-
|
54
|
+
Copyright © [Geoff Harcourt](http://github.com/geoffharcourt) 2012-2015
|
72
55
|
|
73
56
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
74
57
|
|
data/Rakefile
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require 'rake/testtask'
|
1
|
+
require 'bundler/gem_tasks'
|
3
2
|
require 'rspec/core/rake_task'
|
4
|
-
|
5
|
-
Rake::TestTask.new do |t|
|
6
|
-
t.libs << 'test'
|
7
|
-
end
|
3
|
+
require File.expand_path("../lib/greenmonster/version", __FILE__)
|
8
4
|
|
9
5
|
RSpec::Core::RakeTask.new('spec')
|
10
6
|
|
11
|
-
|
12
|
-
task :default => :test
|
7
|
+
task default: :spec
|
data/doc/Gemfile.html
CHANGED
@@ -53,6 +53,12 @@
|
|
53
53
|
|
54
54
|
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
55
55
|
|
56
|
+
<li class="file"><a href="./spec/games/tst/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1/blank_txt.html">blank</a>
|
57
|
+
|
58
|
+
<li class="file"><a href="./spec/games/tst/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1_bak/blank_txt.html">blank</a>
|
59
|
+
|
60
|
+
<li class="file"><a href="./spec/games/tst/year_2012/month_03/day_27/not_2012_03_27_aaamlb_aabmlb_1/blank_txt.html">blank</a>
|
61
|
+
|
56
62
|
</ul>
|
57
63
|
</nav>
|
58
64
|
|
@@ -63,32 +69,8 @@
|
|
63
69
|
|
64
70
|
<li><a href="./Greenmonster.html">Greenmonster</a>
|
65
71
|
|
66
|
-
<li><a href="./Greenmonster/Generators.html">Greenmonster::Generators</a>
|
67
|
-
|
68
|
-
<li><a href="./Greenmonster/Generators/InstallGenerator.html">Greenmonster::Generators::InstallGenerator</a>
|
69
|
-
|
70
|
-
<li><a href="./Greenmonster/Parser.html">Greenmonster::Parser</a>
|
71
|
-
|
72
|
-
<li><a href="./Greenmonster/Player.html">Greenmonster::Player</a>
|
73
|
-
|
74
72
|
<li><a href="./Greenmonster/Spider.html">Greenmonster::Spider</a>
|
75
73
|
|
76
|
-
<li><a href="./Athlete.html">Athlete</a>
|
77
|
-
|
78
|
-
<li><a href="./GreenmonsterPlayerTest.html">GreenmonsterPlayerTest</a>
|
79
|
-
|
80
|
-
<li><a href="./GreenmonsterSpiderTest.html">GreenmonsterSpiderTest</a>
|
81
|
-
|
82
|
-
<li><a href="./GreenmonsterTest.html">GreenmonsterTest</a>
|
83
|
-
|
84
|
-
<li><a href="./GreenmonsterTraversalTest.html">GreenmonsterTraversalTest</a>
|
85
|
-
|
86
|
-
<li><a href="./InstallGreenmonster.html">InstallGreenmonster</a>
|
87
|
-
|
88
|
-
<li><a href="./TestCreatePlayersFromGamedayXMLGame.html">TestCreatePlayersFromGamedayXMLGame</a>
|
89
|
-
|
90
|
-
<li><a href="./TestParsePlayersFromGamedayXMLFiles.html">TestParsePlayersFromGamedayXMLFiles</a>
|
91
|
-
|
92
74
|
</ul>
|
93
75
|
</nav>
|
94
76
|
|