summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotherl <lgdmiller@gmail.com>2013-09-29 20:08:38 +0100
committerotherl <lgdmiller@gmail.com>2013-09-29 20:08:38 +0100
commit99a5cb1f207eab17550c301205b05ee505a08a80 (patch)
treefe0a1892a5033f071148bcfaa6965b6256ea87bd
parentc464351f1b76c3e666bcb382bb9be20d3fd9efba (diff)
Removed the cashe for previously run routes as the graph structure change is incompatible with it.
-rw-r--r--blatube.rb10
-rw-r--r--cache/.gitignore4
2 files changed, 3 insertions, 11 deletions
diff --git a/blatube.rb b/blatube.rb
index f82869d..d8e2407 100644
--- a/blatube.rb
+++ b/blatube.rb
@@ -108,13 +108,8 @@ def add_terminals
end
def calculate_routes
- routes,distances = YAML::load(File.open("cache/#{@from_station}_#{@weight == 'distance' ? @weight : "#{@weight}_#{@change_time}"}.yaml", 'r'))
- @distances = Hash.new(INFINITY).merge distances
- @routes = Hash.new(-1).merge routes
-rescue Errno::ENOENT
add_change_time unless @weight == 'distance'
run_algorithm @graph, @graph.keys, @from_station.upcase
- File.new("cache/#{@from_station}_#{@weight == 'distance' ? @weight : "#{@weight}_#{@change_time}"}.yaml", 'w') << [@routes,@distances].to_yaml
end
#TODO: changes on the same line (eg. 'CAMDEN TOWN')
@@ -228,9 +223,10 @@ begin
else
get_line_status
end
- puts @output.join ' '
rescue StandardError => e
- puts (@output << e.message).join ' '
+ @output << e.message
puts e.message
puts e.backtrace
+ensure
+ puts @output.join ' '
end
diff --git a/cache/.gitignore b/cache/.gitignore
deleted file mode 100644
index 5e7d273..0000000
--- a/cache/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-# Ignore everything in this directory
-*
-# Except this file
-!.gitignore