diff options
Diffstat (limited to 'lib/tasks/route_sections.rake')
| -rw-r--r-- | lib/tasks/route_sections.rake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tasks/route_sections.rake b/lib/tasks/route_sections.rake new file mode 100644 index 000000000..d48ddbba4 --- /dev/null +++ b/lib/tasks/route_sections.rake @@ -0,0 +1,17 @@ +namespace :route_sections do + + def find_referential(id_or_slug) + if id_or_slug.to_s =~ /\A\d+\Z/ + Referential.find id_or_slug.to_i + else + Referential.find_by slug: id_or_slug + end + end + + desc "Generate all RouteSections for a given Referential" + task :create_all, [:referential] => [:environment] do |t, args| + find_referential(args[:referential]).switch + OsrmRouteSectionProcessor.create_all + end + +end |
