transitland / gtfs

Ruby library for dealing with GTFS. Used by Transitland's FeedEater import pipeline.
8 stars 6 forks source link

Feature request: simplify nested gtfs source loading #65

Closed slvlirnoff closed 7 years ago

slvlirnoff commented 7 years ago

In order to improve workflow with sources that have a permalink but might contains subfolders or nested zip with different names (the date for instance) it'd be good if the source within the zip is automatically detected and loaded.

In short, when only one gtfs_source is detected and no fragment provided, load the gtfs source directly. This should work for nested zip and nested subfolder.

Potentially if multiple sources are detected and none specified as a fragment reject it with a AmbiguousSourceException < InvalidSourceException or similar instead of simply InvalidSourceException. for easier debugging.

slvlirnoff commented 7 years ago

would fix #64

irees commented 7 years ago

Thanks for the idea, @slvlirnoff

slvlirnoff commented 7 years ago

I'm happy to make a initial pull request, I've a spare hour now.

irees commented 7 years ago

@slvlirnoff Sure, that would be great! Please make it an option, e.g. similar to strict: true.

slvlirnoff commented 7 years ago

@irees Shoul I add a systematic check if no source specified and multiple roots exists (none being "") to return an AmbiguousSourceException?

irees commented 7 years ago

@slvlirnoff That sounds like a good addition; auto should only work if there's a single unambiguous answer.