use boost program_options in osrm-prepare/routed
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
When /^I request locate I should get$/ do |table|
|
||||
reprocess
|
||||
actual = []
|
||||
OSRMLauncher.new do
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,ri|
|
||||
in_node = find_node_by_name row['in']
|
||||
raise "*** unknown in-node '#{row['in']}" unless in_node
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
When /^I request nearest I should get$/ do |table|
|
||||
reprocess
|
||||
actual = []
|
||||
OSRMLauncher.new do
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,ri|
|
||||
in_node = find_node_by_name row['in']
|
||||
raise "*** unknown in-node '#{row['in']}" unless in_node
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
When /^I request \/(.*)$/ do |path|
|
||||
reprocess
|
||||
OSRMLauncher.new do
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
@response = request_path path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ Then /^routability should be$/ do |table|
|
||||
if table.headers&["forw","backw","bothw"] == []
|
||||
raise "*** routability tabel must contain either 'forw', 'backw' or 'bothw' column"
|
||||
end
|
||||
OSRMLauncher.new do
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,i|
|
||||
got = row.dup
|
||||
attempts = []
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
When /^I route I should get$/ do |table|
|
||||
reprocess
|
||||
actual = []
|
||||
OSRMLauncher.new do
|
||||
OSRMLauncher.new("#{@osm_file}.osrm") do
|
||||
table.hashes.each_with_index do |row,ri|
|
||||
waypoints = []
|
||||
if row['from'] and row['to']
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user