aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
authorBruno Perles2015-12-16 10:02:29 +0100
committerBruno Perles2015-12-16 10:02:29 +0100
commit013f4fa8fe9bb08f3ed1d15f905ca2a8437d6aa7 (patch)
tree426b9c17167c10547da2222517cbd4433ae554fe /lib/tasks
parent2590606c5912a85b8cb1aaa40c57dab67d75e7f7 (diff)
downloadchouette-core-013f4fa8fe9bb08f3ed1d15f905ca2a8437d6aa7.tar.bz2
Add route_sections for traces
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/route_sections.rake17
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