greenmonster 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +13 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.markdown +11 -28
  5. data/Rakefile +3 -8
  6. data/doc/Gemfile.html +6 -24
  7. data/doc/Greenmonster/Spider.html +47 -258
  8. data/doc/Greenmonster.html +25 -86
  9. data/doc/Rakefile.html +10 -25
  10. data/doc/created.rid +12 -18
  11. data/doc/index.html +6 -24
  12. data/doc/js/search_index.js +1 -1
  13. data/doc/table_of_contents.html +12 -129
  14. data/greenmonster.gemspec +16 -13
  15. data/lib/greenmonster/day_spider.rb +61 -0
  16. data/lib/greenmonster/file_downloader.rb +38 -0
  17. data/lib/greenmonster/game_spider.rb +100 -0
  18. data/lib/greenmonster/innings_downloader.rb +41 -0
  19. data/lib/greenmonster/spider.rb +1 -0
  20. data/lib/greenmonster/version.rb +2 -2
  21. data/lib/greenmonster.rb +16 -82
  22. data/spec/cassettes/aaa/year_2015/month_05/day_09.yml +153 -0
  23. data/spec/cassettes/gid_2007_10_01_sdnmlb_colmlb_1/innings.yml +135 -0
  24. data/spec/cassettes/gid_2015_04_18_balmlb_bos_mlb_1/players_xml.yml +292 -0
  25. data/spec/cassettes/gid_2015_04_18_balmlb_bos_mlb_2/players_xml.yml +46 -0
  26. data/spec/cassettes/mlb/year_2015/month_04/day_18.yml +170 -0
  27. data/spec/day_spider_spec.rb +80 -0
  28. data/spec/file_downloader_spec.rb +51 -0
  29. data/spec/fixtures/aaa_players.xml +70 -0
  30. data/spec/fixtures/boxscore.xml +1147 -0
  31. data/spec/fixtures/inning_all.xml +1 -0
  32. data/spec/fixtures/inning_hit.xml +1 -0
  33. data/spec/fixtures/linescore.xml +131 -0
  34. data/spec/fixtures/players.xml +63 -0
  35. data/spec/game_spider_spec.rb +116 -0
  36. data/spec/greenmonster_spec.rb +22 -34
  37. data/spec/innings_downloader_spec.rb +44 -0
  38. data/spec/spec_helper.rb +13 -21
  39. data/spec/support/path_helpers.rb +21 -0
  40. data/spec/support/vcr.rb +11 -0
  41. metadata +91 -67
  42. data/doc/Athlete.html +0 -254
  43. data/doc/Greenmonster/Generators/InstallGenerator.html +0 -253
  44. data/doc/Greenmonster/Generators.html +0 -147
  45. data/doc/Greenmonster/Parser.html +0 -263
  46. data/doc/Greenmonster/Player.html +0 -236
  47. data/doc/GreenmonsterPlayerTest.html +0 -199
  48. data/doc/GreenmonsterSpiderTest.html +0 -668
  49. data/doc/GreenmonsterTest.html +0 -262
  50. data/doc/GreenmonsterTraversalTest.html +0 -376
  51. data/doc/InstallGreenmonster.html +0 -260
  52. data/doc/TestCreatePlayersFromGamedayXMLGame.html +0 -266
  53. data/doc/TestParsePlayersFromGamedayXMLFiles.html +0 -307
  54. data/spec/games/tst/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1/blank.txt +0 -0
  55. data/spec/games/tst/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1_bak/blank.txt +0 -0
  56. data/spec/games/tst/year_2012/month_03/day_27/not_2012_03_27_aaamlb_aabmlb_1/blank.txt +0 -0
  57. 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
@@ -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
- If you don't want to specify a download location every time you run the spider, you can set a default games folder location using Greenmonster.set_games_location:
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.set_games_folder('/Users/geoff/games/')
16
+ Greenmonster.set_local_data_location("/Users/me/gameday")
17
17
  ```
18
18
 
19
- The spider utility has three public class methods: Spider.pull_game, Spider.pull_day, and Spider.pull_days.
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::Spider.pull_game('gid_2011_07_04_tormlb_bosmlb_1', Date.new(2011,7,4))
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
- Spider.pull_day takes an hash of options as an argument. Greenmonster will create subfolders by MLB "sport_code" (MLB games fall under 'mlb', various minor league games and non-MLB/MiLB games fall under other sport code designations), and then children folders for years, months, days, and specific games. Sport code can be a string or an array of sport code strings.
27
+ Download games from a given date.
29
28
 
30
29
  ```ruby
31
30
  # Pull all MLB games for today
32
- Greenmonster::Spider.pull_day(Date.today, 'mlb')
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, 'rok')
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 1.9
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 is being migrated to RSpec, and uses bourne.
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-2013
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 "bundler/gem_tasks"
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
- desc "Run Tests"
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