cta_redux 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +35 -9
- data/lib/cta_redux/models/train.rb +4 -1
- data/lib/cta_redux/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ebdfcb117df8f4fe78aba18570093bca3b31889
|
4
|
+
data.tar.gz: 73b88fc7bcdd14a3841514c849028f4383fda0b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a319534c7da09c458a6ed0224bfc1fb2da0e74fb44ee191d96a6cc1690563f2fbbfff94849e7893193b3a2f400b5dbf62d191b47c4e454870ba62b9321e1fc98
|
7
|
+
data.tar.gz: 5588efc46e16b89723bda4b58a62a71d787dd3bf760f890ba1f5493eb99853a87241e765e084e85297a2f806d402855649f977e2a3100a213528b90f76828b0b
|
data/CONTRIBUTING.md
CHANGED
@@ -1,14 +1,41 @@
|
|
1
|
-
|
1
|
+
## Development Setup
|
2
2
|
|
3
|
-
|
3
|
+
1. Fork and clone the repo
|
4
4
|
|
5
|
-
|
5
|
+
2. ```bundle install```
|
6
6
|
|
7
|
-
|
7
|
+
3. Load your REPL like so: ```TRAVIS=true irb```. This ensures that the embedded SQLite database will be
|
8
|
+
unzipped in the correct location for you. The TRAVIS environment variable is only necessary once for a fresh checkout.
|
8
9
|
|
9
|
-
|
10
|
+
4. Make changes, and submit a pull request. Open issues as needed.
|
10
11
|
|
11
|
-
|
12
|
+
If you make a substantial change to the code base, document your code and write some sort of test. Pull requests may be rejected without
|
13
|
+
at least some sort of smokescreen test.
|
14
|
+
|
15
|
+
Testing framework: rspec, builds set up on [travis-ci](https://travis-ci.org/ahayworth/cta_redux)
|
16
|
+
|
17
|
+
Documentation: yard, hosted on [rubydoc.info](http://www.rubydoc.info/github/ahayworth/cta_redux) and rubygems.org (for releases).
|
18
|
+
|
19
|
+
|
20
|
+
## Testing notes
|
21
|
+
|
22
|
+
Faraday has a stub interface that we use to stub out test data. The workflow usually goes something like:
|
23
|
+
|
24
|
+
1. Figure out what call you're making to the API
|
25
|
+
|
26
|
+
2. `curl 'url for the api call' > spec/stubs/some_response_name.xml`
|
27
|
+
|
28
|
+
3. Add the appropriate stub in spec/{bus,train}_tracker_spec.rb or spec/customer_alerts_spec.rb
|
29
|
+
|
30
|
+
The Faraday stub interface is adequate, but picky - you must set up things with the *exact* URL - see the examples already there.
|
31
|
+
|
32
|
+
|
33
|
+
## How to reload CTA GTFS data
|
34
|
+
|
35
|
+
Note that this will take a long time - there are several million stop_time records. This should only be necessary
|
36
|
+
when the CTA releases new GTFS data, or if a manual correction to the data is needed.
|
37
|
+
|
38
|
+
1. cd data && curl 'http://www.transitchicago.com/downloads/sch_data/filename' > gtfs.zip && unzip gtfs.zip
|
12
39
|
|
13
40
|
2. cd ../script && for i in `ls ../data/*.txt`; do echo $i; ./gtfs_to_sqlite.rb $i ../data/cta-gtfs.db; done
|
14
41
|
|
@@ -20,7 +47,6 @@ Note that this will take a long time - there are several million stop_time recor
|
|
20
47
|
|
21
48
|
6. VACUUM
|
22
49
|
|
23
|
-
7. gzip cta-gtfs.db
|
24
|
-
|
25
|
-
8. Commit / push / create release and gem
|
50
|
+
7. gzip -9 cta-gtfs.db
|
26
51
|
|
52
|
+
8. Commit / bump version / tag release / push / build and push gem
|
@@ -92,8 +92,10 @@ module CTA
|
|
92
92
|
attr_reader :destination
|
93
93
|
# @return [String] A human-readable direction of this train, eg "O'Hare-bound"
|
94
94
|
attr_reader :direction
|
95
|
-
# @return [CTA::Stop] The next {CTA::Stop} of this train
|
95
|
+
# @return [CTA::Stop] The next parent {CTA::Stop} of this train
|
96
96
|
attr_reader :next_station
|
97
|
+
# @return [CTA::Stop] The next {CTA::Stop} of this train
|
98
|
+
attr_reader :next_stop
|
97
99
|
# @return [DateTime] The time this {Prediction} was generated on the TrainTracker servers
|
98
100
|
attr_reader :prediction_generated_at
|
99
101
|
# @return [DateTime] The time this train is predicted to arrive at the next_station
|
@@ -122,6 +124,7 @@ module CTA
|
|
122
124
|
@trip = CTA::Trip.where(:schd_trip_id => "R#{@run}").first
|
123
125
|
@destination = CTA::Stop.where(:stop_id => data["destSt"]).first
|
124
126
|
@next_station = CTA::Stop.where(:stop_id => (data["staId"] || data["nextStaId"])).first
|
127
|
+
@next_stop = CTA::Stop.where(:stop_id => (data["stpId"] || data["nextStpId"])).first
|
125
128
|
@prediction_generated_at = DateTime.parse(data["prdt"])
|
126
129
|
@arrival_time = DateTime.parse(data["arrT"])
|
127
130
|
@seconds = @arrival_time.to_time - @prediction_generated_at.to_time
|
data/lib/cta_redux/version.rb
CHANGED