trackerific 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +62 -44
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/changelog +9 -0
- data/lib/trackerific/configuration.rb +2 -2
- data/lib/trackerific/details.rb +36 -10
- data/lib/trackerific/event.rb +9 -7
- data/lib/trackerific/service.rb +22 -6
- data/lib/trackerific/services/fedex.rb +11 -7
- data/lib/trackerific/services/mock_service.rb +23 -14
- data/lib/trackerific/services/ups.rb +12 -8
- data/lib/trackerific/services/usps.rb +114 -21
- data/spec/fixtures/usps_city_state_lookup_response.xml +8 -0
- data/spec/lib/helpers/options_helper_spec.rb +3 -3
- data/spec/lib/trackerific/configuration_spec.rb +35 -0
- data/spec/lib/trackerific/details_spec.rb +71 -11
- data/spec/lib/trackerific/event_spec.rb +34 -19
- data/spec/lib/trackerific/service_spec.rb +3 -3
- data/spec/lib/trackerific/services/fedex_spec.rb +16 -3
- data/spec/lib/trackerific/services/mock_service_spec.rb +19 -4
- data/spec/lib/trackerific/services/ups_spec.rb +17 -2
- data/spec/lib/trackerific/services/usps_spec.rb +60 -11
- data/spec/lib/trackerific_spec.rb +7 -5
- data/trackerific.gemspec +5 -27
- metadata +8 -30
- data/doc/OptionsHelper.html +0 -287
- data/doc/Trackerific/Configuration.html +0 -354
- data/doc/Trackerific/Details.html +0 -565
- data/doc/Trackerific/Error.html +0 -127
- data/doc/Trackerific/Event.html +0 -639
- data/doc/Trackerific/FedEx.html +0 -558
- data/doc/Trackerific/Service.html +0 -579
- data/doc/Trackerific/UPS.html +0 -532
- data/doc/Trackerific/USPS.html +0 -568
- data/doc/Trackerific.html +0 -833
- data/doc/_index.html +0 -226
- data/doc/class_list.html +0 -47
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -53
- data/doc/css/style.css +0 -320
- data/doc/file.README.html +0 -288
- data/doc/file_list.html +0 -49
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -288
- data/doc/js/app.js +0 -205
- data/doc/js/full_list.js +0 -150
- data/doc/js/jquery.js +0 -16
- data/doc/method_list.html +0 -294
- data/doc/top-level-namespace.html +0 -103
data/doc/index.html
DELETED
@@ -1,288 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
-
<title>
|
7
|
-
File: README
|
8
|
-
|
9
|
-
— Documentation by YARD 0.7.1
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
relpath = '';
|
19
|
-
if (relpath != '') relpath += '/';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
-
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
|
-
<div id="header">
|
34
|
-
<div id="menu">
|
35
|
-
|
36
|
-
<a href="_index.html" title="Index">Index</a> »
|
37
|
-
<span class="title">File: README</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a id="class_list_link" href="#">Class List</a>
|
46
|
-
|
47
|
-
<a id="method_list_link" href="#">Method List</a>
|
48
|
-
|
49
|
-
<a id="file_list_link" href="#">File List</a>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
<div class="clear"></div>
|
53
|
-
</div>
|
54
|
-
|
55
|
-
<iframe id="search_frame"></iframe>
|
56
|
-
|
57
|
-
<div id="content"><div id='filecontents'><h2>Installation</h2>
|
58
|
-
<p>
|
59
|
-
To use this gem, add this line to your Gemfile
|
60
|
-
</p>
|
61
|
-
<pre class="code">
|
62
|
-
<span class='id gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>trackerific</span><span class='tstring_end'>'</span></span>
|
63
|
-
</pre>
|
64
|
-
<p>
|
65
|
-
and then run
|
66
|
-
</p>
|
67
|
-
<pre class="code">
|
68
|
-
<span class='id bundle'>bundle</span> <span class='id install'>install</span>
|
69
|
-
</pre>
|
70
|
-
<h2>Usage</h2>
|
71
|
-
<h3>Configuration</h3>
|
72
|
-
<p>
|
73
|
-
To take advantage of Trackerific’s automatic service discovery, you
|
74
|
-
will need to configure your credentials for each service.
|
75
|
-
</p>
|
76
|
-
<pre class="code">
|
77
|
-
<span class='comment'># config/initializers/trackerific.rb
|
78
|
-
</span> <span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>trackerific</span><span class='tstring_end'>'</span></span>
|
79
|
-
<span class='const'>Trackerific</span><span class='period'>.</span><span class='id configure'>configure</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id config'>config</span><span class='op'>|</span>
|
80
|
-
<span class='id config'>config</span><span class='period'>.</span><span class='id fedex'>fedex</span> <span class='symbol'>:account</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>account</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:meter</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123456789</span><span class='tstring_end'>'</span></span>
|
81
|
-
<span class='id config'>config</span><span class='period'>.</span><span class='id ups'>ups</span> <span class='symbol'>:key</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:user_id</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>userid</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:password</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>secret</span><span class='tstring_end'>'</span></span>
|
82
|
-
<span class='id config'>config</span><span class='period'>.</span><span class='id usps'>usps</span> <span class='symbol'>:user_id</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>userid</span><span class='tstring_end'>'</span></span>
|
83
|
-
<span class='kw'>end</span>
|
84
|
-
</pre>
|
85
|
-
<h3>Tracking with Automatic Service Discovery</h3>
|
86
|
-
<p>
|
87
|
-
Once you configured the services, tracking a package is as easy as
|
88
|
-
</p>
|
89
|
-
<pre class="code">
|
90
|
-
<span class='id include'>include</span> <span class='const'>Trackerific</span>
|
91
|
-
<span class='id details'>details</span> <span class='op'>=</span> <span class='id track_package'>track_package</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>package id</span><span class='tstring_end'>"</span></span>
|
92
|
-
</pre>
|
93
|
-
<h3>Finding a Tracking Service Provider</h3>
|
94
|
-
<p>
|
95
|
-
If you do not know the tracking service provider of a package id, or you
|
96
|
-
used track_package, and you need to know which service was used to track
|
97
|
-
it, you can use the tracking_service helper method.
|
98
|
-
</p>
|
99
|
-
<pre class="code">
|
100
|
-
<span class='id include'>include</span> <span class='const'>Trackerific</span>
|
101
|
-
<span class='id tracking_service'>tracking_service</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>183689015000001</span><span class='tstring_end'>"</span></span> <span class='comment'># => Trackerific::FedEx
|
102
|
-
</span> <span class='id tracking_service'>tracking_service</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1Z12345E0291980793</span><span class='tstring_end'>"</span></span> <span class='comment'># => Trackerific::UPS
|
103
|
-
</span> <span class='id tracking_service'>tracking_service</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>EJ958083578US</span><span class='tstring_end'>"</span></span> <span class='comment'># => Trackerific::USPS
|
104
|
-
</span> <span class='id tracking_service'>tracking_service</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>unknown package id</span><span class='tstring_end'>"</span></span> <span class='comment'># => nil
|
105
|
-
</span></pre>
|
106
|
-
<h3>Tracking a Package with a Specific Service</h3>
|
107
|
-
<p>
|
108
|
-
Use this method if you need to specify exactly which service to track a
|
109
|
-
package.
|
110
|
-
</p>
|
111
|
-
<pre class="code">
|
112
|
-
<span class='comment'># Track a FedEx package:
|
113
|
-
</span> <span class='id fedex'>fedex</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>FedEx</span><span class='period'>.</span><span class='id new'>new</span> <span class='symbol'>:account</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123456789</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:meter</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123456789</span><span class='tstring_end'>'</span></span>
|
114
|
-
<span class='id details'>details</span> <span class='op'>=</span> <span class='id fedex'>fedex</span><span class='period'>.</span><span class='id track_package'>track_package</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>183689015000001</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
115
|
-
|
116
|
-
<span class='comment'># Track a USPS package:
|
117
|
-
</span> <span class='id usps'>usps</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>USPS</span><span class='period'>.</span><span class='id new'>new</span> <span class='symbol'>:user_id</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123USERID4567</span><span class='tstring_end'>'</span></span>
|
118
|
-
<span class='id details'>details</span> <span class='op'>=</span> <span class='id usps'>usps</span><span class='period'>.</span><span class='id track_package'>track_package</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>EJ958083578US</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
119
|
-
|
120
|
-
<span class='comment'># Track a UPS package:
|
121
|
-
</span> <span class='id ups'>ups</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>UPS</span><span class='period'>.</span><span class='id new'>new</span> <span class='symbol'>:user_id</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>userid</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:key</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>kQdEJwuHBjtQ7g2</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:password</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>secret</span><span class='tstring_end'>'</span></span>
|
122
|
-
<span class='id details'>details</span> <span class='op'>=</span> <span class='id ups'>ups</span><span class='period'>.</span><span class='id track_package'>track_package</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1Z12345E0291980793</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
123
|
-
</pre>
|
124
|
-
<h3>Tracking Details</h3>
|
125
|
-
<p>
|
126
|
-
The tracking information is returned in a Trackerific::Details instance.
|
127
|
-
</p>
|
128
|
-
<pre class="code">
|
129
|
-
<span class='id details'>details</span><span class='period'>.</span><span class='id summary'>summary</span> <span class='comment'># => a summary of the tracking events
|
130
|
-
</span> <span class='id details'>details</span><span class='period'>.</span><span class='id events'>events</span> <span class='comment'># => an Array of Trackerific::Events
|
131
|
-
</span></pre>
|
132
|
-
<p>
|
133
|
-
You can easily print out the tracking events just by doing:
|
134
|
-
</p>
|
135
|
-
<pre class="code">
|
136
|
-
<span class='id puts'>puts</span> <span class='id details'>details</span><span class='period'>.</span><span class='id events'>events</span> <span class='comment'># for all the events
|
137
|
-
</span> <span class='id puts'>puts</span> <span class='id details'>details</span><span class='period'>.</span><span class='id events'>events</span><span class='period'>.</span><span class='id first'>first</span> <span class='comment'># for just one event
|
138
|
-
</span></pre>
|
139
|
-
<p>
|
140
|
-
Or, if you need specific information about an event:
|
141
|
-
</p>
|
142
|
-
<pre class="code">
|
143
|
-
<span class='id details'>details</span><span class='period'>.</span><span class='id events'>events</span><span class='period'>.</span><span class='id last'>last</span><span class='period'>.</span><span class='id date'>date</span> <span class='comment'># => the date the package was shipped
|
144
|
-
</span> <span class='id details'>details</span><span class='period'>.</span><span class='id events'>events</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id date'>date</span> <span class='comment'># => the last date the package was updated
|
145
|
-
</span> <span class='id details'>details</span><span class='period'>.</span><span class='id events'>events</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id description'>description</span> <span class='comment'># => a description of an event
|
146
|
-
</span> <span class='id details'>details</span><span class='period'>.</span><span class='id events'>events</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id location'>location</span> <span class='comment'># => the location of the package during that event
|
147
|
-
</span></pre>
|
148
|
-
<p>
|
149
|
-
location will not work for USPS packages, because USPS does not provide
|
150
|
-
that information seperately from the description. So for USPS packages, the
|
151
|
-
location will always be at the end of the description.
|
152
|
-
</p>
|
153
|
-
<p>
|
154
|
-
Note that events.last will return the first event the tracking provider
|
155
|
-
supplied. This is because the events are listed in LIFO order, so the most
|
156
|
-
recent events will always be at the top of the list.
|
157
|
-
</p>
|
158
|
-
<h3>Exception handling</h3>
|
159
|
-
<p>
|
160
|
-
Exception handling is esssential for tracking packages. If, for example,
|
161
|
-
you enter the wrong number, or the tracking provider has yet to have added
|
162
|
-
the tracking number to their system, a Trackerific::Error will be raised.
|
163
|
-
Here’s an example on how to handle Trackerific::Errors:
|
164
|
-
</p>
|
165
|
-
<pre class="code">
|
166
|
-
<span class='kw'>begin</span>
|
167
|
-
<span class='id usps'>usps</span><span class='period'>.</span><span class='id track_package'>track_package</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>EJ958083578US</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
168
|
-
<span class='kw'>rescue</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Error</span> <span class='op'>=></span> <span class='id e'>e</span>
|
169
|
-
<span class='id puts'>puts</span> <span class='id e'>e</span><span class='period'>.</span><span class='id message'>message</span>
|
170
|
-
<span class='kw'>end</span>
|
171
|
-
</pre>
|
172
|
-
<h2>Extending</h2>
|
173
|
-
<p>
|
174
|
-
Here is a basic outline of a custom Trackerific service.
|
175
|
-
</p>
|
176
|
-
<p>
|
177
|
-
lib/trackerific/services/my_tracking_service.rb:
|
178
|
-
</p>
|
179
|
-
<pre class="code">
|
180
|
-
<span class='kw'>module</span> <span class='const'>Trackerific</span>
|
181
|
-
<span class='kw'>class</span> <span class='const'>MyTrackingService</span> <span class='op'><</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Base</span>
|
182
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id required_options'>required_options</span>
|
183
|
-
<span class='comment'># any options your service requires. these are usually user credentials
|
184
|
-
</span> <span class='lbracket'>[</span> <span class='symbol'>:some</span><span class='comma'>,</span> <span class='symbol'>:options</span> <span class='rbracket'>]</span>
|
185
|
-
<span class='kw'>end</span>
|
186
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id package_id_matchers'>package_id_matchers</span>
|
187
|
-
<span class='comment'># write some custom regex matchers for your tracking package IDs
|
188
|
-
</span> <span class='lbracket'>[</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[0-9]{15}$</span><span class='regexp_end'>/</span></span> <span class='rbracket'>]</span> <span class='comment'># fedex package matcher
|
189
|
-
</span> <span class='kw'>end</span>
|
190
|
-
<span class='kw'>def</span> <span class='id track_package'>track_package</span><span class='lparen'>(</span><span class='id package_id'>package_id</span><span class='rparen'>)</span>
|
191
|
-
<span class='comment'># implement your tracking code here
|
192
|
-
</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Details</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span>
|
193
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>summary</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
194
|
-
<span class='lbracket'>[</span>
|
195
|
-
<span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Event</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>description</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>location</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span>
|
196
|
-
<span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Event</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>description</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>location</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
197
|
-
<span class='rbracket'>]</span>
|
198
|
-
<span class='rparen'>)</span>
|
199
|
-
<span class='kw'>end</span>
|
200
|
-
<span class='kw'>end</span>
|
201
|
-
<span class='kw'>end</span>
|
202
|
-
</pre>
|
203
|
-
<p>
|
204
|
-
spec/lib/trackerific/services/my_tracking_service_spec.rb:
|
205
|
-
</p>
|
206
|
-
<pre class="code">
|
207
|
-
<span class='id describe'>describe</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Trackerific::MyTrackingService</span><span class='tstring_end'>"</span></span> <span class='kw'>do</span>
|
208
|
-
<span class='id describe'>describe</span> <span class='symbol'>:required_options</span> <span class='kw'>do</span>
|
209
|
-
<span class='id subject'>subject</span> <span class='lbrace'>{</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>MyTrackingService</span><span class='period'>.</span><span class='id required_options'>required_options</span> <span class='rbrace'>}</span>
|
210
|
-
<span class='id it'>it</span> <span class='lbrace'>{</span> <span class='id should'>should</span> <span class='id include'>include</span><span class='lparen'>(</span><span class='symbol'>:some</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
211
|
-
<span class='id it'>it</span> <span class='lbrace'>{</span> <span class='id should'>should</span> <span class='id include'>include</span><span class='lparen'>(</span><span class='symbol'>:options</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
212
|
-
<span class='kw'>end</span>
|
213
|
-
<span class='id describe'>describe</span> <span class='symbol'>:package_id_matchers</span> <span class='kw'>do</span>
|
214
|
-
<span class='id it'>it</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>should be an Array of Regexp</span><span class='tstring_end'>"</span></span> <span class='kw'>do</span>
|
215
|
-
<span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>MyTrackingService</span><span class='period'>.</span><span class='id package_id_matchers'>package_id_matchers</span><span class='period'>.</span><span class='id should'>should</span> <span class='id each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id m'>m</span><span class='op'>|</span> <span class='id m'>m</span><span class='period'>.</span><span class='id should'>should</span> <span class='id be_a'>be_a</span> <span class='const'>Regexp</span> <span class='rbrace'>}</span>
|
216
|
-
<span class='kw'>end</span>
|
217
|
-
<span class='kw'>end</span>
|
218
|
-
<span class='id describe'>describe</span> <span class='symbol'>:track_package</span> <span class='kw'>do</span>
|
219
|
-
<span class='id pending'>pending</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>your track_package specs</span><span class='tstring_end'>"</span></span>
|
220
|
-
<span class='kw'>end</span>
|
221
|
-
<span class='kw'>end</span>
|
222
|
-
</pre>
|
223
|
-
<p>
|
224
|
-
Please make sure to include comments, documentation, and specs for your
|
225
|
-
service. Trackerific uses <a
|
226
|
-
href="https://github.com/dchelimsky/rspec">RSpec</a> for tests, <a
|
227
|
-
href="https://github.com/colszowka/simplecov">simplecov</a> for code
|
228
|
-
coverage, and <a href="http://yardoc.org/">Yardoc</a> for documentation.
|
229
|
-
You can also take advantage of <a
|
230
|
-
href="https://github.com/dkubb/yardstick">yardstick</a> to help verify the
|
231
|
-
coverage of the comments of your code. You can use the rake task:
|
232
|
-
</p>
|
233
|
-
<pre class="code">
|
234
|
-
<span class='id rake'>rake</span> <span class='id yardstick_measure'>yardstick_measure</span>
|
235
|
-
</pre>
|
236
|
-
<p>
|
237
|
-
which will generate a measurement/report.txt file.
|
238
|
-
</p>
|
239
|
-
<h2>Contributing to trackerific</h2>
|
240
|
-
<ul>
|
241
|
-
<li><p>
|
242
|
-
Check out the latest master to make sure the feature hasn’t been
|
243
|
-
implemented or the bug hasn’t been fixed yet
|
244
|
-
</p>
|
245
|
-
</li>
|
246
|
-
<li><p>
|
247
|
-
Check out the issue tracker to make sure someone already hasn’t
|
248
|
-
requested it and/or contributed it
|
249
|
-
</p>
|
250
|
-
</li>
|
251
|
-
<li><p>
|
252
|
-
Fork the project
|
253
|
-
</p>
|
254
|
-
</li>
|
255
|
-
<li><p>
|
256
|
-
Start a feature/bugfix branch
|
257
|
-
</p>
|
258
|
-
</li>
|
259
|
-
<li><p>
|
260
|
-
Commit and push until you are happy with your contribution
|
261
|
-
</p>
|
262
|
-
</li>
|
263
|
-
<li><p>
|
264
|
-
Make sure to add tests for it. This is important so I don’t break it
|
265
|
-
in a future version unintentionally.
|
266
|
-
</p>
|
267
|
-
</li>
|
268
|
-
<li><p>
|
269
|
-
Please try not to mess with the Rakefile, version, or history. If you want
|
270
|
-
to have your own version, or is otherwise necessary, that is fine, but
|
271
|
-
please isolate to its own commit so I can cherry-pick around it.
|
272
|
-
</p>
|
273
|
-
</li>
|
274
|
-
</ul>
|
275
|
-
<h2>Copyright</h2>
|
276
|
-
<p>
|
277
|
-
Copyright © 2011 Travis Haynes. See LICENSE.txt for further details.
|
278
|
-
</p>
|
279
|
-
</div></div>
|
280
|
-
|
281
|
-
<div id="footer">
|
282
|
-
Generated on Wed Jun 15 15:30:26 2011 by
|
283
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
284
|
-
0.7.1 (ruby-1.9.2).
|
285
|
-
</div>
|
286
|
-
|
287
|
-
</body>
|
288
|
-
</html>
|
data/doc/js/app.js
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
function createSourceLinks() {
|
2
|
-
$('.method_details_list .source_code').
|
3
|
-
before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
|
4
|
-
$('.toggleSource').toggle(function() {
|
5
|
-
$(this).parent().next().slideDown(100);
|
6
|
-
$(this).text("Hide source");
|
7
|
-
},
|
8
|
-
function() {
|
9
|
-
$(this).parent().next().slideUp(100);
|
10
|
-
$(this).text("View source");
|
11
|
-
});
|
12
|
-
}
|
13
|
-
|
14
|
-
function createDefineLinks() {
|
15
|
-
var tHeight = 0;
|
16
|
-
$('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
|
17
|
-
$('.toggleDefines').toggle(function() {
|
18
|
-
tHeight = $(this).parent().prev().height();
|
19
|
-
$(this).prev().show();
|
20
|
-
$(this).parent().prev().height($(this).parent().height());
|
21
|
-
$(this).text("(less)");
|
22
|
-
},
|
23
|
-
function() {
|
24
|
-
$(this).prev().hide();
|
25
|
-
$(this).parent().prev().height(tHeight);
|
26
|
-
$(this).text("more...");
|
27
|
-
});
|
28
|
-
}
|
29
|
-
|
30
|
-
function createFullTreeLinks() {
|
31
|
-
var tHeight = 0;
|
32
|
-
$('.inheritanceTree').toggle(function() {
|
33
|
-
tHeight = $(this).parent().prev().height();
|
34
|
-
$(this).parent().toggleClass('showAll');
|
35
|
-
$(this).text("(hide)");
|
36
|
-
$(this).parent().prev().height($(this).parent().height());
|
37
|
-
},
|
38
|
-
function() {
|
39
|
-
$(this).parent().toggleClass('showAll');
|
40
|
-
$(this).parent().prev().height(tHeight);
|
41
|
-
$(this).text("show all");
|
42
|
-
});
|
43
|
-
}
|
44
|
-
|
45
|
-
function fixBoxInfoHeights() {
|
46
|
-
$('dl.box dd.r1, dl.box dd.r2').each(function() {
|
47
|
-
$(this).prev().height($(this).height());
|
48
|
-
});
|
49
|
-
}
|
50
|
-
|
51
|
-
function searchFrameLinks() {
|
52
|
-
$('#method_list_link').click(function() {
|
53
|
-
toggleSearchFrame(this, relpath + 'method_list.html');
|
54
|
-
});
|
55
|
-
|
56
|
-
$('#class_list_link').click(function() {
|
57
|
-
toggleSearchFrame(this, relpath + 'class_list.html');
|
58
|
-
});
|
59
|
-
|
60
|
-
$('#file_list_link').click(function() {
|
61
|
-
toggleSearchFrame(this, relpath + 'file_list.html');
|
62
|
-
});
|
63
|
-
}
|
64
|
-
|
65
|
-
function toggleSearchFrame(id, link) {
|
66
|
-
var frame = $('#search_frame');
|
67
|
-
$('#search a').removeClass('active').addClass('inactive');
|
68
|
-
if (frame.attr('src') == link && frame.css('display') != "none") {
|
69
|
-
frame.slideUp(100);
|
70
|
-
$('#search a').removeClass('active inactive');
|
71
|
-
}
|
72
|
-
else {
|
73
|
-
$(id).addClass('active').removeClass('inactive');
|
74
|
-
frame.attr('src', link).slideDown(100);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
function linkSummaries() {
|
79
|
-
$('.summary_signature').click(function() {
|
80
|
-
document.location = $(this).find('a').attr('href');
|
81
|
-
});
|
82
|
-
}
|
83
|
-
|
84
|
-
function framesInit() {
|
85
|
-
if (window.top.frames.main) {
|
86
|
-
document.body.className = 'frames';
|
87
|
-
$('#menu .noframes a').attr('href', document.location);
|
88
|
-
$('html head title', window.parent.document).text($('html head title').text());
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
function keyboardShortcuts() {
|
93
|
-
if (window.top.frames.main) return;
|
94
|
-
$(document).keypress(function(evt) {
|
95
|
-
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
|
96
|
-
if (typeof evt.target !== "undefined" &&
|
97
|
-
(evt.target.nodeName == "INPUT" ||
|
98
|
-
evt.target.nodeName == "TEXTAREA")) return;
|
99
|
-
switch (evt.charCode) {
|
100
|
-
case 67: case 99: $('#class_list_link').click(); break; // 'c'
|
101
|
-
case 77: case 109: $('#method_list_link').click(); break; // 'm'
|
102
|
-
case 70: case 102: $('#file_list_link').click(); break; // 'f'
|
103
|
-
default: break;
|
104
|
-
}
|
105
|
-
});
|
106
|
-
}
|
107
|
-
|
108
|
-
function summaryToggle() {
|
109
|
-
$('.summary_toggle').click(function() {
|
110
|
-
localStorage.summaryCollapsed = $(this).text();
|
111
|
-
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
112
|
-
var next = $(this).parent().parent().next();
|
113
|
-
if (next.hasClass('compact')) {
|
114
|
-
next.toggle();
|
115
|
-
next.next().toggle();
|
116
|
-
}
|
117
|
-
else if (next.hasClass('summary')) {
|
118
|
-
var list = $('<ul class="summary compact" />');
|
119
|
-
list.html(next.html());
|
120
|
-
list.find('.summary_desc, .note').remove();
|
121
|
-
list.find('a').each(function() {
|
122
|
-
$(this).html($(this).find('strong').html());
|
123
|
-
$(this).parent().html($(this)[0].outerHTML);
|
124
|
-
});
|
125
|
-
next.before(list);
|
126
|
-
next.toggle();
|
127
|
-
}
|
128
|
-
return false;
|
129
|
-
});
|
130
|
-
if (localStorage) {
|
131
|
-
if (localStorage.summaryCollapsed == "collapse") $('.summary_toggle').click();
|
132
|
-
else localStorage.summaryCollapsed = "expand";
|
133
|
-
}
|
134
|
-
}
|
135
|
-
|
136
|
-
function fixOutsideWorldLinks() {
|
137
|
-
$('a').each(function() {
|
138
|
-
if (window.location.host != this.host) this.target = '_parent';
|
139
|
-
});
|
140
|
-
}
|
141
|
-
|
142
|
-
function generateTOC() {
|
143
|
-
if ($('#filecontents').length === 0) return;
|
144
|
-
var _toc = $('<ol class="top"></ol>');
|
145
|
-
var show = false;
|
146
|
-
var toc = _toc;
|
147
|
-
var counter = 0;
|
148
|
-
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
149
|
-
var i;
|
150
|
-
if ($('#filecontents h1').length > 1) tags.unshift('h1');
|
151
|
-
for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
|
152
|
-
var lastTag = parseInt(tags[0][1], 10);
|
153
|
-
$(tags.join(', ')).each(function() {
|
154
|
-
if (this.id == "filecontents") return;
|
155
|
-
show = true;
|
156
|
-
var thisTag = parseInt(this.tagName[1], 10);
|
157
|
-
if (this.id.length === 0) {
|
158
|
-
var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
|
159
|
-
if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
|
160
|
-
this.id = proposedId;
|
161
|
-
}
|
162
|
-
if (thisTag > lastTag) {
|
163
|
-
for (i = 0; i < thisTag - lastTag; i++) {
|
164
|
-
var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
|
165
|
-
}
|
166
|
-
}
|
167
|
-
if (thisTag < lastTag) {
|
168
|
-
for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
|
169
|
-
}
|
170
|
-
toc.append('<li><a href="#' + this.id + '">' + $(this).text() + '</a></li>');
|
171
|
-
lastTag = thisTag;
|
172
|
-
});
|
173
|
-
if (!show) return;
|
174
|
-
html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
|
175
|
-
$('#content').prepend(html);
|
176
|
-
$('#toc').append(_toc);
|
177
|
-
$('#toc .hide_toc').toggle(function() {
|
178
|
-
$('#toc .top').slideUp('fast');
|
179
|
-
$('#toc').toggleClass('hidden');
|
180
|
-
$('#toc .title small').toggle();
|
181
|
-
}, function() {
|
182
|
-
$('#toc .top').slideDown('fast');
|
183
|
-
$('#toc').toggleClass('hidden');
|
184
|
-
$('#toc .title small').toggle();
|
185
|
-
});
|
186
|
-
$('#toc .float_toc').toggle(function() {
|
187
|
-
$(this).text('float');
|
188
|
-
$('#toc').toggleClass('nofloat');
|
189
|
-
}, function() {
|
190
|
-
$(this).text('left');
|
191
|
-
$('#toc').toggleClass('nofloat');
|
192
|
-
});
|
193
|
-
}
|
194
|
-
|
195
|
-
$(framesInit);
|
196
|
-
$(createSourceLinks);
|
197
|
-
$(createDefineLinks);
|
198
|
-
$(createFullTreeLinks);
|
199
|
-
$(fixBoxInfoHeights);
|
200
|
-
$(searchFrameLinks);
|
201
|
-
$(linkSummaries);
|
202
|
-
$(keyboardShortcuts);
|
203
|
-
$(summaryToggle);
|
204
|
-
$(fixOutsideWorldLinks);
|
205
|
-
$(generateTOC);
|