greenmonster 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.markdown +6 -0
- data/README.markdown +37 -2
- data/doc/Athlete.html +254 -0
- data/doc/Gemfile.html +20 -0
- data/doc/Greenmonster/Generators/InstallGenerator.html +253 -0
- data/doc/Greenmonster/Generators.html +147 -0
- data/doc/Greenmonster/Parser.html +263 -0
- data/doc/Greenmonster/Player.html +236 -0
- data/doc/Greenmonster/Spider.html +169 -21
- data/doc/Greenmonster.html +139 -2
- data/doc/GreenmonsterPlayerTest.html +199 -0
- data/doc/GreenmonsterSpiderTest.html +57 -4
- data/doc/GreenmonsterTest.html +20 -0
- data/doc/GreenmonsterTraversalTest.html +376 -0
- data/doc/InstallGreenmonster.html +260 -0
- data/doc/Rakefile.html +20 -0
- data/doc/TestCreatePlayersFromGamedayXMLGame.html +266 -0
- data/doc/TestParsePlayersFromGamedayXMLFiles.html +307 -0
- data/doc/created.rid +18 -9
- data/doc/index.html +20 -0
- data/doc/js/search_index.js +1 -1
- data/doc/table_of_contents.html +93 -1
- data/greenmonster.gemspec +4 -2
- data/lib/generators/greenmonster/install_mlb_games_generator.rb +20 -0
- data/lib/generators/greenmonster/install_players_generator.rb +20 -0
- data/lib/generators/templates/install_greenmonster_mlb_games_migration.rb +54 -0
- data/lib/generators/templates/install_greenmonster_players_migration.rb +37 -0
- data/lib/greenmonster/model_extensions/mlb_game.rb +106 -0
- data/lib/greenmonster/model_extensions/mlb_probable_pitcher.rb +11 -0
- data/lib/greenmonster/model_extensions/player.rb +16 -0
- data/lib/greenmonster/parser.rb +27 -0
- data/lib/greenmonster/spider.rb +7 -6
- data/lib/greenmonster/version.rb +1 -1
- data/lib/greenmonster.rb +46 -0
- data/test/games/mlb/year_2011/month_07/day_04/gid_2011_07_04_tormlb_bosmlb_1/boxscore.xml +5 -0
- data/test/games/mlb/year_2011/month_07/day_04/gid_2011_07_04_tormlb_bosmlb_1/eventLog.xml +1 -0
- data/test/games/mlb/year_2011/month_07/day_04/gid_2011_07_04_tormlb_bosmlb_1/inning/inning_all.xml +1 -0
- data/test/games/mlb/year_2011/month_07/day_04/gid_2011_07_04_tormlb_bosmlb_1/inning/inning_hit.xml +1 -0
- data/test/games/mlb/year_2011/month_07/day_04/gid_2011_07_04_tormlb_bosmlb_1/linescore.xml +117 -0
- data/test/games/mlb/year_2011/month_07/day_04/gid_2011_07_04_tormlb_bosmlb_1/players.xml +56 -0
- data/test/games/mlb/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1/blank.txt +0 -0
- data/test/games/tst/year_2012/month_03/day_27/gid_2012_03_27_aaamlb_aabmlb_1/blank.txt +0 -0
- data/test/test_create_mlb_game_from_gameday_xml_game.rb +12 -0
- data/test/test_create_players_from_gameday_xml_game.rb +8 -0
- data/test/test_greenmonster.rb +3 -6
- data/test/test_greenmonster_player.rb +7 -0
- data/test/test_greenmonster_spider.rb +24 -18
- data/test/test_greenmonster_traversal.rb +31 -0
- data/test/test_helper.rb +78 -0
- data/test/test_line_score.rb +12 -0
- data/test/test_parse_mlb_probable_pitchers_from_linescore_data.rb +14 -0
- data/test/test_parse_players_from_gameday_xml_files.rb +21 -0
- data/test/test_update_mlb_game_with_linescore_data.rb +23 -0
- metadata +103 -7
data/.gitignore
CHANGED
data/CHANGELOG.markdown
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.4.0 / 2012-03-19
|
2
|
+
------------------
|
3
|
+
* Added Greenmonster::Player module for mixing in player-specific methods.
|
4
|
+
* Added greenmonster:install generator to install player table.
|
5
|
+
* Added Greenmonster::Parser module for parsing data out of Gameday XML files after download
|
6
|
+
|
1
7
|
0.3.1 / 2012-03-17
|
2
8
|
------------------
|
3
9
|
* Fixed sport codes as array for scenarios where not all sport codes are used.
|
data/README.markdown
CHANGED
@@ -3,10 +3,16 @@ Greenmonster
|
|
3
3
|
|
4
4
|
Greenmonster is a toolkit for baseball stat enthusiasts or sabermetricians to build a database of play-by-play stats from MLB's [Gameday XML data](http://gd.mlb.com/components/game/).
|
5
5
|
|
6
|
-
The
|
6
|
+
The provides three tools:
|
7
|
+
* Spidering of MLB/MiLB games
|
8
|
+
* Parsing of Gameday XML
|
9
|
+
* Mixin methods you can use to extend your own classes
|
7
10
|
|
8
11
|
Usage
|
9
|
-
|
12
|
+
=====
|
13
|
+
|
14
|
+
Spider
|
15
|
+
------
|
10
16
|
|
11
17
|
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
18
|
|
@@ -49,12 +55,41 @@ Spider.pull_days takes a range of dates to process as an argument, plus a hash o
|
|
49
55
|
Greenmonster::Spider.pull_days((Date.new(2012,4,1)..Date.new(2012,4,30)), {:games_folder => './home/geoff/games'})
|
50
56
|
```
|
51
57
|
|
58
|
+
Mixins (ALPHA)
|
59
|
+
--------------
|
60
|
+
(Under development.)
|
61
|
+
|
62
|
+
As of version 0.4.0, Greenmonster provides the Greenmonster::Player module which can be used to extend any Ruby class you use that represents players. Include the module in your class to get Greenmonster-specific functionality like parsing players out of games.
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
class MlbPlayer < ActiveRecord::Base
|
66
|
+
include Greenmonster::Player
|
67
|
+
end
|
68
|
+
|
69
|
+
>> MlbPlayer.create_from_gameday_xml_game('gid_2011_07_04_tormlb_bosmlb_1')
|
70
|
+
```
|
71
|
+
|
72
|
+
Migrations (ALPHA)
|
73
|
+
------------------
|
74
|
+
|
75
|
+
WARNING: THIS FEATURE IS UNDER DEVELOPMENT. USE AT YOUR OWN RISK.
|
76
|
+
ANOTHER WARNING: Using migrations on alpha/beta/pre versions of Greenmonster may not be compatible with formal releases that come later.
|
77
|
+
|
78
|
+
If you use ActiveRecord, Greenmonster provides a generator that can generate tables for Greenmonster data. Add Greenmonster to your Gemfile:
|
79
|
+
```ruby
|
80
|
+
gem 'greenmonster', '~> 0.4.0'
|
81
|
+
```
|
82
|
+
|
83
|
+
After you pull the gem in with Bundler, you will have access to Greenmonster generators. The Install generator attempts to install a set of standard name tables that correspond to Greenmonster data.
|
84
|
+
|
85
|
+
|
52
86
|
Requirements
|
53
87
|
------------
|
54
88
|
- Ruby 1.9
|
55
89
|
- Bundler
|
56
90
|
- Nokogiri
|
57
91
|
- HTTParty
|
92
|
+
- ActiveRecord (if you want to use migration generators or any mixins that involve AR saves)
|
58
93
|
|
59
94
|
Testing
|
60
95
|
-------
|
data/doc/Athlete.html
ADDED
@@ -0,0 +1,254 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class Athlete - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>test/test_create_players_from_gameday_xml_game.rb
|
51
|
+
<li>test/test_greenmonster_player.rb
|
52
|
+
</ul>
|
53
|
+
</nav>
|
54
|
+
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
<nav id="parent-class-section" class="section">
|
61
|
+
<h3 class="section-header">Parent</h3>
|
62
|
+
|
63
|
+
<p class="link">SuperModel::Base
|
64
|
+
|
65
|
+
</nav>
|
66
|
+
|
67
|
+
<!-- Included Modules -->
|
68
|
+
<nav id="includes-section" class="section">
|
69
|
+
<h3 class="section-header">Included Modules</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
|
74
|
+
<li><a class="include" href="Greenmonster/Player.html">Greenmonster::Player</a>
|
75
|
+
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</nav>
|
79
|
+
|
80
|
+
<!-- Method Quickref -->
|
81
|
+
<nav id="method-list-section" class="section">
|
82
|
+
<h3 class="section-header">Methods</h3>
|
83
|
+
|
84
|
+
<ul class="link-list">
|
85
|
+
|
86
|
+
<li><a href="#method-c-find_or_initialize_by_id">::find_or_initialize_by_id</a>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</nav>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="project-metadata">
|
94
|
+
<nav id="fileindex-section" class="section project-section">
|
95
|
+
<h3 class="section-header">Pages</h3>
|
96
|
+
|
97
|
+
<ul>
|
98
|
+
|
99
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
100
|
+
|
101
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
102
|
+
|
103
|
+
</ul>
|
104
|
+
</nav>
|
105
|
+
|
106
|
+
<nav id="classindex-section" class="section project-section">
|
107
|
+
<h3 class="section-header">Class and Module Index</h3>
|
108
|
+
|
109
|
+
<ul class="link-list">
|
110
|
+
|
111
|
+
<li><a href="./Greenmonster.html">Greenmonster</a>
|
112
|
+
|
113
|
+
<li><a href="./Greenmonster/Generators.html">Greenmonster::Generators</a>
|
114
|
+
|
115
|
+
<li><a href="./Greenmonster/Generators/InstallGenerator.html">Greenmonster::Generators::InstallGenerator</a>
|
116
|
+
|
117
|
+
<li><a href="./Greenmonster/Parser.html">Greenmonster::Parser</a>
|
118
|
+
|
119
|
+
<li><a href="./Greenmonster/Player.html">Greenmonster::Player</a>
|
120
|
+
|
121
|
+
<li><a href="./Greenmonster/Spider.html">Greenmonster::Spider</a>
|
122
|
+
|
123
|
+
<li><a href="./Athlete.html">Athlete</a>
|
124
|
+
|
125
|
+
<li><a href="./GreenmonsterPlayerTest.html">GreenmonsterPlayerTest</a>
|
126
|
+
|
127
|
+
<li><a href="./GreenmonsterSpiderTest.html">GreenmonsterSpiderTest</a>
|
128
|
+
|
129
|
+
<li><a href="./GreenmonsterTest.html">GreenmonsterTest</a>
|
130
|
+
|
131
|
+
<li><a href="./GreenmonsterTraversalTest.html">GreenmonsterTraversalTest</a>
|
132
|
+
|
133
|
+
<li><a href="./InstallGreenmonster.html">InstallGreenmonster</a>
|
134
|
+
|
135
|
+
<li><a href="./TestCreatePlayersFromGamedayXMLGame.html">TestCreatePlayersFromGamedayXMLGame</a>
|
136
|
+
|
137
|
+
<li><a href="./TestParsePlayersFromGamedayXMLFiles.html">TestParsePlayersFromGamedayXMLFiles</a>
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
</nav>
|
141
|
+
|
142
|
+
</div>
|
143
|
+
</nav>
|
144
|
+
|
145
|
+
<div id="documentation">
|
146
|
+
<h1 class="class">class Athlete</h1>
|
147
|
+
|
148
|
+
<div id="description" class="description">
|
149
|
+
|
150
|
+
</div><!-- description -->
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<!-- Attributes -->
|
164
|
+
<section id="attribute-method-details" class="method-section section">
|
165
|
+
<h3 class="section-header">Attributes</h3>
|
166
|
+
|
167
|
+
|
168
|
+
<div id="attribute-i-first" class="method-detail">
|
169
|
+
<div class="method-heading attribute-method-heading">
|
170
|
+
<span class="method-name">first</span><span
|
171
|
+
class="attribute-access-type">[RW]</span>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="method-description">
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div id="attribute-i-last" class="method-detail">
|
182
|
+
<div class="method-heading attribute-method-heading">
|
183
|
+
<span class="method-name">last</span><span
|
184
|
+
class="attribute-access-type">[RW]</span>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div class="method-description">
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
</section><!-- attribute-method-details -->
|
195
|
+
|
196
|
+
|
197
|
+
<!-- Methods -->
|
198
|
+
|
199
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
200
|
+
<h3 class="section-header">Public Class Methods</h3>
|
201
|
+
|
202
|
+
|
203
|
+
<div id="method-c-find_or_initialize_by_id" class="method-detail ">
|
204
|
+
|
205
|
+
<div class="method-heading">
|
206
|
+
<span class="method-name">find_or_initialize_by_id</span><span
|
207
|
+
class="method-args">(id_number)</span>
|
208
|
+
<span class="method-click-advice">click to toggle source</span>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
|
212
|
+
<div class="method-description">
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<div class="method-source-code" id="find_or_initialize_by_id-source">
|
219
|
+
<pre><span class="ruby-comment"># File test/test_create_players_from_gameday_xml_game.rb, line 9</span>
|
220
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find_or_initialize_by_id</span>(<span class="ruby-identifier">id_number</span>)
|
221
|
+
<span class="ruby-keyword">begin</span>
|
222
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">id_number</span>)
|
223
|
+
<span class="ruby-keyword">rescue</span>
|
224
|
+
<span class="ruby-keyword">end</span>
|
225
|
+
|
226
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">nil?</span>
|
227
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find_or_create_by_id</span>(<span class="ruby-identifier">id_number</span>)
|
228
|
+
<span class="ruby-keyword">else</span>
|
229
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">a</span>
|
230
|
+
<span class="ruby-keyword">end</span>
|
231
|
+
<span class="ruby-keyword">end</span></pre>
|
232
|
+
</div><!-- find_or_initialize_by_id-source -->
|
233
|
+
|
234
|
+
</div>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</div><!-- find_or_initialize_by_id-method -->
|
240
|
+
|
241
|
+
|
242
|
+
</section><!-- public-class-method-details -->
|
243
|
+
|
244
|
+
</section><!-- 5Buntitled-5D -->
|
245
|
+
|
246
|
+
</div><!-- documentation -->
|
247
|
+
|
248
|
+
|
249
|
+
<footer id="validator-badges">
|
250
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
251
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
252
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
253
|
+
</footer>
|
254
|
+
|
data/doc/Gemfile.html
CHANGED
@@ -63,12 +63,32 @@
|
|
63
63
|
|
64
64
|
<li><a href="./Greenmonster.html">Greenmonster</a>
|
65
65
|
|
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
|
+
|
66
74
|
<li><a href="./Greenmonster/Spider.html">Greenmonster::Spider</a>
|
67
75
|
|
76
|
+
<li><a href="./Athlete.html">Athlete</a>
|
77
|
+
|
78
|
+
<li><a href="./GreenmonsterPlayerTest.html">GreenmonsterPlayerTest</a>
|
79
|
+
|
68
80
|
<li><a href="./GreenmonsterSpiderTest.html">GreenmonsterSpiderTest</a>
|
69
81
|
|
70
82
|
<li><a href="./GreenmonsterTest.html">GreenmonsterTest</a>
|
71
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
|
+
|
72
92
|
</ul>
|
73
93
|
</nav>
|
74
94
|
|
@@ -0,0 +1,253 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class Greenmonster::Generators::InstallGenerator - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../../index.html">Home</a>
|
28
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/generators/greenmonster/install_generator.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Rails::Generators::Base
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
<!-- Included Modules -->
|
67
|
+
<nav id="includes-section" class="section">
|
68
|
+
<h3 class="section-header">Included Modules</h3>
|
69
|
+
|
70
|
+
<ul class="link-list">
|
71
|
+
|
72
|
+
|
73
|
+
<li><span class="include">Rails::Generators::Migration</span>
|
74
|
+
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
</nav>
|
78
|
+
|
79
|
+
<!-- Method Quickref -->
|
80
|
+
<nav id="method-list-section" class="section">
|
81
|
+
<h3 class="section-header">Methods</h3>
|
82
|
+
|
83
|
+
<ul class="link-list">
|
84
|
+
|
85
|
+
<li><a href="#method-c-next_migration_number">::next_migration_number</a>
|
86
|
+
|
87
|
+
<li><a href="#method-i-create_migration_file">#create_migration_file</a>
|
88
|
+
|
89
|
+
</ul>
|
90
|
+
</nav>
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="project-metadata">
|
95
|
+
<nav id="fileindex-section" class="section project-section">
|
96
|
+
<h3 class="section-header">Pages</h3>
|
97
|
+
|
98
|
+
<ul>
|
99
|
+
|
100
|
+
<li class="file"><a href="../../Gemfile.html">Gemfile</a>
|
101
|
+
|
102
|
+
<li class="file"><a href="../../Rakefile.html">Rakefile</a>
|
103
|
+
|
104
|
+
</ul>
|
105
|
+
</nav>
|
106
|
+
|
107
|
+
<nav id="classindex-section" class="section project-section">
|
108
|
+
<h3 class="section-header">Class and Module Index</h3>
|
109
|
+
|
110
|
+
<ul class="link-list">
|
111
|
+
|
112
|
+
<li><a href="../../Greenmonster.html">Greenmonster</a>
|
113
|
+
|
114
|
+
<li><a href="../../Greenmonster/Generators.html">Greenmonster::Generators</a>
|
115
|
+
|
116
|
+
<li><a href="../../Greenmonster/Generators/InstallGenerator.html">Greenmonster::Generators::InstallGenerator</a>
|
117
|
+
|
118
|
+
<li><a href="../../Greenmonster/Parser.html">Greenmonster::Parser</a>
|
119
|
+
|
120
|
+
<li><a href="../../Greenmonster/Player.html">Greenmonster::Player</a>
|
121
|
+
|
122
|
+
<li><a href="../../Greenmonster/Spider.html">Greenmonster::Spider</a>
|
123
|
+
|
124
|
+
<li><a href="../../Athlete.html">Athlete</a>
|
125
|
+
|
126
|
+
<li><a href="../../GreenmonsterPlayerTest.html">GreenmonsterPlayerTest</a>
|
127
|
+
|
128
|
+
<li><a href="../../GreenmonsterSpiderTest.html">GreenmonsterSpiderTest</a>
|
129
|
+
|
130
|
+
<li><a href="../../GreenmonsterTest.html">GreenmonsterTest</a>
|
131
|
+
|
132
|
+
<li><a href="../../GreenmonsterTraversalTest.html">GreenmonsterTraversalTest</a>
|
133
|
+
|
134
|
+
<li><a href="../../InstallGreenmonster.html">InstallGreenmonster</a>
|
135
|
+
|
136
|
+
<li><a href="../../TestCreatePlayersFromGamedayXMLGame.html">TestCreatePlayersFromGamedayXMLGame</a>
|
137
|
+
|
138
|
+
<li><a href="../../TestParsePlayersFromGamedayXMLFiles.html">TestParsePlayersFromGamedayXMLFiles</a>
|
139
|
+
|
140
|
+
</ul>
|
141
|
+
</nav>
|
142
|
+
|
143
|
+
</div>
|
144
|
+
</nav>
|
145
|
+
|
146
|
+
<div id="documentation">
|
147
|
+
<h1 class="class">class Greenmonster::Generators::InstallGenerator</h1>
|
148
|
+
|
149
|
+
<div id="description" class="description">
|
150
|
+
|
151
|
+
</div><!-- description -->
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<!-- Methods -->
|
166
|
+
|
167
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
168
|
+
<h3 class="section-header">Public Class Methods</h3>
|
169
|
+
|
170
|
+
|
171
|
+
<div id="method-c-next_migration_number" class="method-detail ">
|
172
|
+
|
173
|
+
<div class="method-heading">
|
174
|
+
<span class="method-name">next_migration_number</span><span
|
175
|
+
class="method-args">(dirname)</span>
|
176
|
+
<span class="method-click-advice">click to toggle source</span>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
<div class="method-source-code" id="next_migration_number-source">
|
187
|
+
<pre><span class="ruby-comment"># File lib/generators/greenmonster/install_generator.rb, line 7</span>
|
188
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">next_migration_number</span>(<span class="ruby-identifier">dirname</span>)
|
189
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">timestamped_migrations</span>
|
190
|
+
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">utc</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">"%Y%m%d%H%M%S"</span>)
|
191
|
+
<span class="ruby-keyword">else</span>
|
192
|
+
<span class="ruby-string">"%.3d"</span> <span class="ruby-operator">%</span> (<span class="ruby-identifier">current_migration_number</span>(<span class="ruby-identifier">dirname</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
|
193
|
+
<span class="ruby-keyword">end</span>
|
194
|
+
<span class="ruby-keyword">end</span></pre>
|
195
|
+
</div><!-- next_migration_number-source -->
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</div><!-- next_migration_number-method -->
|
203
|
+
|
204
|
+
|
205
|
+
</section><!-- public-class-method-details -->
|
206
|
+
|
207
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
208
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
209
|
+
|
210
|
+
|
211
|
+
<div id="method-i-create_migration_file" class="method-detail ">
|
212
|
+
|
213
|
+
<div class="method-heading">
|
214
|
+
<span class="method-name">create_migration_file</span><span
|
215
|
+
class="method-args">()</span>
|
216
|
+
<span class="method-click-advice">click to toggle source</span>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
|
220
|
+
<div class="method-description">
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<div class="method-source-code" id="create_migration_file-source">
|
227
|
+
<pre><span class="ruby-comment"># File lib/generators/greenmonster/install_generator.rb, line 15</span>
|
228
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_migration_file</span>
|
229
|
+
<span class="ruby-identifier">migration_template</span> <span class="ruby-string">'migration.rb'</span>, <span class="ruby-string">'db/migrate/install_greenmonster.rb'</span>
|
230
|
+
<span class="ruby-keyword">end</span></pre>
|
231
|
+
</div><!-- create_migration_file-source -->
|
232
|
+
|
233
|
+
</div>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</div><!-- create_migration_file-method -->
|
239
|
+
|
240
|
+
|
241
|
+
</section><!-- public-instance-method-details -->
|
242
|
+
|
243
|
+
</section><!-- 5Buntitled-5D -->
|
244
|
+
|
245
|
+
</div><!-- documentation -->
|
246
|
+
|
247
|
+
|
248
|
+
<footer id="validator-badges">
|
249
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
250
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
251
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
252
|
+
</footer>
|
253
|
+
|