use boost program_options in osrm-prepare/routed

This commit is contained in:
Emil Tin
2013-08-19 22:41:46 +02:00
parent b80cda66a9
commit 613e38d7f8
24 changed files with 296 additions and 269 deletions
-18
View File
@@ -10,21 +10,3 @@ end
def set_profile profile
@profile = profile
end
def write_server_ini
s=<<-EOF
Threads = 1
IP = 0.0.0.0
Port = #{OSRM_PORT}
hsgrData=#{@osm_file}.osrm.hsgr
nodesData=#{@osm_file}.osrm.nodes
edgesData=#{@osm_file}.osrm.edges
ramIndex=#{@osm_file}.osrm.ramIndex
fileIndex=#{@osm_file}.osrm.fileIndex
namesData=#{@osm_file}.osrm.names
timestamp=#{@osm_file}.osrm.timestamp
EOF
File.open( 'server.ini', 'w') {|f| f.write( s ) }
end
+1 -2
View File
@@ -263,13 +263,12 @@ def reprocess
unless prepared?
log_preprocess_info
log "== Preparing #{@osm_file}.osm...", :preprocess
unless system "#{BIN_PATH}/osrm-prepare #{@osm_file}.osrm #{@osm_file}.osrm.restrictions 1>>#{PREPROCESS_LOG_FILE} 2>>#{PREPROCESS_LOG_FILE} #{PROFILES_PATH}/#{@profile}.lua"
unless system "#{BIN_PATH}/osrm-prepare #{@osm_file}.osrm --profile #{PROFILES_PATH}/#{@profile}.lua 1>>#{PREPROCESS_LOG_FILE} 2>>#{PREPROCESS_LOG_FILE}"
log "*** Exited with code #{$?.exitstatus}.", :preprocess
raise PrepareError.new $?.exitstatus, "osrm-prepare exited with code #{$?.exitstatus}."
end
log '', :preprocess
end
log_preprocess_done
write_server_ini
end
end
+2
View File
@@ -18,5 +18,7 @@ class File
tail_of_file = chunks.join('')
ary = tail_of_file.split(/\n/)
lines_to_return = ary[ ary.size - n, ary.size - 1 ]
rescue
["Cannot read log file!"]
end
end
+3 -2
View File
@@ -6,7 +6,8 @@ SHUTDOWN_TIMEOUT = 2
OSRM_ROUTED_LOG_FILE = 'osrm-routed.log'
class OSRMLauncher
def initialize &block
def initialize input_file, &block
@input_file = input_file
Dir.chdir TEST_FOLDER do
begin
launch
@@ -48,7 +49,7 @@ class OSRMLauncher
def osrm_up
return if osrm_up?
@pid = Process.spawn(["#{BIN_PATH}/osrm-routed",''],:out=>OSRM_ROUTED_LOG_FILE, :err=>OSRM_ROUTED_LOG_FILE)
@pid = Process.spawn("#{BIN_PATH}/osrm-routed #{@input_file} --port #{OSRM_PORT}",:out=>OSRM_ROUTED_LOG_FILE, :err=>OSRM_ROUTED_LOG_FILE)
end
def osrm_down