cleanup indentation of ruby files
This commit is contained in:
parent
a178555838
commit
6470838065
@ -23,11 +23,11 @@ Given /^the node map$/ do |table|
|
|||||||
raise "*** node invalid name '#{name}', must be single characters" unless name.size == 1
|
raise "*** node invalid name '#{name}', must be single characters" unless name.size == 1
|
||||||
raise "*** invalid node name '#{name}', must me alphanumeric" unless name.match /[a-z0-9]/
|
raise "*** invalid node name '#{name}', must me alphanumeric" unless name.match /[a-z0-9]/
|
||||||
if name.match /[a-z]/
|
if name.match /[a-z]/
|
||||||
raise "*** duplicate node '#{name}'" if name_node_hash[name]
|
raise "*** duplicate node '#{name}'" if name_node_hash[name]
|
||||||
add_osm_node name, *table_coord_to_lonlat(ci,ri)
|
add_osm_node name, *table_coord_to_lonlat(ci,ri)
|
||||||
else
|
else
|
||||||
raise "*** duplicate node '#{name}'" if location_hash[name]
|
raise "*** duplicate node '#{name}'" if location_hash[name]
|
||||||
add_location name, *table_coord_to_lonlat(ci,ri)
|
add_location name, *table_coord_to_lonlat(ci,ri)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -39,9 +39,9 @@ Given /^the node locations$/ do |table|
|
|||||||
name = row['node']
|
name = row['node']
|
||||||
raise "*** duplicate node '#{name}'" if find_node_by_name name
|
raise "*** duplicate node '#{name}'" if find_node_by_name name
|
||||||
if name.match /[a-z]/
|
if name.match /[a-z]/
|
||||||
add_osm_node name, row['lon'].to_f, row['lat'].to_f
|
add_osm_node name, row['lon'].to_f, row['lat'].to_f
|
||||||
else
|
else
|
||||||
add_location name, row['lon'].to_f, row['lat'].to_f
|
add_location name, row['lon'].to_f, row['lat'].to_f
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,18 +13,18 @@ end
|
|||||||
|
|
||||||
def write_server_ini
|
def write_server_ini
|
||||||
s=<<-EOF
|
s=<<-EOF
|
||||||
Threads = 1
|
Threads = 1
|
||||||
IP = 0.0.0.0
|
IP = 0.0.0.0
|
||||||
Port = #{OSRM_PORT}
|
Port = #{OSRM_PORT}
|
||||||
|
|
||||||
hsgrData=#{@osm_file}.osrm.hsgr
|
hsgrData=#{@osm_file}.osrm.hsgr
|
||||||
nodesData=#{@osm_file}.osrm.nodes
|
nodesData=#{@osm_file}.osrm.nodes
|
||||||
edgesData=#{@osm_file}.osrm.edges
|
edgesData=#{@osm_file}.osrm.edges
|
||||||
ramIndex=#{@osm_file}.osrm.ramIndex
|
ramIndex=#{@osm_file}.osrm.ramIndex
|
||||||
fileIndex=#{@osm_file}.osrm.fileIndex
|
fileIndex=#{@osm_file}.osrm.fileIndex
|
||||||
namesData=#{@osm_file}.osrm.names
|
namesData=#{@osm_file}.osrm.names
|
||||||
timestamp=#{@osm_file}.osrm.timestamp
|
timestamp=#{@osm_file}.osrm.timestamp
|
||||||
EOF
|
EOF
|
||||||
File.open( 'server.ini', 'w') {|f| f.write( s ) }
|
File.open( 'server.ini', 'w') {|f| f.write( s ) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ BIN_PATH = '../build'
|
|||||||
DEFAULT_ORIGIN = [1,1]
|
DEFAULT_ORIGIN = [1,1]
|
||||||
|
|
||||||
class Location
|
class Location
|
||||||
attr_accessor :lon,:lat
|
attr_accessor :lon,:lat
|
||||||
|
|
||||||
def initialize lon,lat
|
def initialize lon,lat
|
||||||
@lat = lat
|
@lat = lat
|
||||||
@lon = lon
|
@lon = lon
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def sanitized_scenario_title
|
def sanitized_scenario_title
|
||||||
@ -125,29 +125,29 @@ def build_ways_from_table table
|
|||||||
end
|
end
|
||||||
|
|
||||||
def table_coord_to_lonlat ci,ri
|
def table_coord_to_lonlat ci,ri
|
||||||
[@origin[0]+ci*@zoom, @origin[1]-ri*@zoom]
|
[@origin[0]+ci*@zoom, @origin[1]-ri*@zoom]
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_osm_node name,lon,lat
|
def add_osm_node name,lon,lat
|
||||||
node = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, lon, lat
|
node = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, lon, lat
|
||||||
node << { :name => name }
|
node << { :name => name }
|
||||||
node.uid = OSM_UID
|
node.uid = OSM_UID
|
||||||
osm_db << node
|
osm_db << node
|
||||||
name_node_hash[name] = node
|
name_node_hash[name] = node
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_location name,lon,lat
|
def add_location name,lon,lat
|
||||||
location_hash[name] = Location.new(lon,lat)
|
location_hash[name] = Location.new(lon,lat)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_node_by_name s
|
def find_node_by_name s
|
||||||
raise "***invalid node name '#{s}', must be single characters" unless s.size == 1
|
raise "***invalid node name '#{s}', must be single characters" unless s.size == 1
|
||||||
raise "*** invalid node name '#{s}', must be alphanumeric" unless s.match /[a-z0-9]/
|
raise "*** invalid node name '#{s}', must be alphanumeric" unless s.match /[a-z0-9]/
|
||||||
if s.match /[a-z]/
|
if s.match /[a-z]/
|
||||||
from_node = name_node_hash[ s.to_s ]
|
from_node = name_node_hash[ s.to_s ]
|
||||||
else
|
else
|
||||||
from_node = location_hash[ s.to_s ]
|
from_node = location_hash[ s.to_s ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_way_by_name s
|
def find_way_by_name s
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
class FuzzyMatch
|
class FuzzyMatch
|
||||||
|
|
||||||
def self.match got, want
|
def self.match got, want
|
||||||
@ -31,4 +30,3 @@ class FuzzyMatch
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,4 +47,3 @@ end
|
|||||||
def fingerprint
|
def fingerprint
|
||||||
@fingerprint ||= Digest::SHA1.hexdigest "#{bin_extract_hash}-#{bin_prepare_hash}-#{bin_routed_hash}-#{profile_hash}-#{lua_lib_hash}-#{osm_hash}"
|
@fingerprint ||= Digest::SHA1.hexdigest "#{bin_extract_hash}-#{bin_prepare_hash}-#{bin_routed_hash}-#{profile_hash}-#{lua_lib_hash}-#{osm_hash}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Before do |scenario|
|
|||||||
end
|
end
|
||||||
|
|
||||||
Around('@stress') do |scenario, block|
|
Around('@stress') do |scenario, block|
|
||||||
Timeout.timeout(STRESS_TIMEOUT) do
|
Timeout.timeout(STRESS_TIMEOUT) do
|
||||||
block.call
|
block.call
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -63,5 +63,3 @@ end
|
|||||||
|
|
||||||
def log_preprocess_done
|
def log_preprocess_done
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user