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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91c1d7dfb1bb819b342dc96de7c5ef191fd75d0a
4
- data.tar.gz: d751fceb08ae3876d8c2e1a2fbee5a977c356e23
3
+ metadata.gz: 8ebdfcb117df8f4fe78aba18570093bca3b31889
4
+ data.tar.gz: 73b88fc7bcdd14a3841514c849028f4383fda0b4
5
5
  SHA512:
6
- metadata.gz: 971c732b11e5781aa8f319c1b03510800c1caf6f0c808320a81f66f207ad578554262fc2d86e4ac9c43478127ac4aa2a54c890449ec0d0428622f24e2625e73f
7
- data.tar.gz: daeaf6f74a5d5a6a962d7418b70ea649dada4a63642fdf65e7ed0e92e9707a2081b06b321582e7929bcc5e0c1779bea24c656564e46e840c5b2598014a847282
6
+ metadata.gz: a319534c7da09c458a6ed0224bfc1fb2da0e74fb44ee191d96a6cc1690563f2fbbfff94849e7893193b3a2f400b5dbf62d191b47c4e454870ba62b9321e1fc98
7
+ data.tar.gz: 5588efc46e16b89723bda4b58a62a71d787dd3bf760f890ba1f5493eb99853a87241e765e084e85297a2f806d402855649f977e2a3100a213528b90f76828b0b
data/CONTRIBUTING.md CHANGED
@@ -1,14 +1,41 @@
1
- # Notes
1
+ ## Development Setup
2
2
 
3
- When running the gem from a git checkout, you'll need to unzip the CTA database yourself.
3
+ 1. Fork and clone the repo
4
4
 
5
- ````cd data && gunzip cta-gtfs.db.gz````
5
+ 2. ```bundle install```
6
6
 
7
- # How to reload CTA GTFS data
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
- Note that this will take a long time - there are several million stop_time records.
10
+ 4. Make changes, and submit a pull request. Open issues as needed.
10
11
 
11
- 1. cd data && curl 'http://www.transitchicago.com/downloads/sch_data/<latest file>' > gtfs.zip && unzip gtfs.zip
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
@@ -1,3 +1,3 @@
1
1
  module CTA
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cta_redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hayworth