cleanup indentation of ruby files

This commit is contained in:
Emil Tin 2013-09-18 08:16:19 +02:00
parent a178555838
commit 6470838065
10 changed files with 40 additions and 45 deletions

View File

@ -23,11 +23,11 @@ Given /^the node map$/ do |table|
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]/
if name.match /[a-z]/
raise "*** duplicate node '#{name}'" if name_node_hash[name]
add_osm_node name, *table_coord_to_lonlat(ci,ri)
raise "*** duplicate node '#{name}'" if name_node_hash[name]
add_osm_node name, *table_coord_to_lonlat(ci,ri)
else
raise "*** duplicate node '#{name}'" if location_hash[name]
add_location name, *table_coord_to_lonlat(ci,ri)
raise "*** duplicate node '#{name}'" if location_hash[name]
add_location name, *table_coord_to_lonlat(ci,ri)
end
end
end
@ -39,9 +39,9 @@ Given /^the node locations$/ do |table|
name = row['node']
raise "*** duplicate node '#{name}'" if find_node_by_name name
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
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

View File

@ -48,4 +48,4 @@ When /^I request locate (\d+) times I should get$/ do |n,table|
ok = false unless step "I request locate I should get", table
end
ok
end
end

View File

@ -48,4 +48,4 @@ When /^I request nearest (\d+) times I should get$/ do |n,table|
ok = false unless step "I request nearest I should get", table
end
ok
end
end

View File

@ -13,18 +13,18 @@ end
def write_server_ini
s=<<-EOF
Threads = 1
IP = 0.0.0.0
Port = #{OSRM_PORT}
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
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

View File

@ -19,12 +19,12 @@ BIN_PATH = '../build'
DEFAULT_ORIGIN = [1,1]
class Location
attr_accessor :lon,:lat
attr_accessor :lon,:lat
def initialize lon,lat
@lat = lat
@lon = lon
end
def initialize lon,lat
@lat = lat
@lon = lon
end
end
def sanitized_scenario_title
@ -125,29 +125,29 @@ def build_ways_from_table table
end
def table_coord_to_lonlat ci,ri
[@origin[0]+ci*@zoom, @origin[1]-ri*@zoom]
[@origin[0]+ci*@zoom, @origin[1]-ri*@zoom]
end
def add_osm_node name,lon,lat
node = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, lon, lat
node << { :name => name }
node.uid = OSM_UID
osm_db << node
name_node_hash[name] = node
node = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, lon, lat
node << { :name => name }
node.uid = OSM_UID
osm_db << node
name_node_hash[name] = node
end
def add_location name,lon,lat
location_hash[name] = Location.new(lon,lat)
location_hash[name] = Location.new(lon,lat)
end
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 alphanumeric" unless s.match /[a-z0-9]/
if s.match /[a-z]/
from_node = name_node_hash[ s.to_s ]
else
from_node = location_hash[ s.to_s ]
end
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]/
if s.match /[a-z]/
from_node = name_node_hash[ s.to_s ]
else
from_node = location_hash[ s.to_s ]
end
end
def find_way_by_name s

View File

@ -1,5 +1,5 @@
class File
#read last n lines of a file. useful for getting last part of a big log file.
def tail(n)
buffer = 1024

View File

@ -1,4 +1,3 @@
class FuzzyMatch
def self.match got, want
@ -31,4 +30,3 @@ class FuzzyMatch
end
end

View File

@ -47,4 +47,3 @@ end
def fingerprint
@fingerprint ||= Digest::SHA1.hexdigest "#{bin_extract_hash}-#{bin_prepare_hash}-#{bin_routed_hash}-#{profile_hash}-#{lua_lib_hash}-#{osm_hash}"
end

View File

@ -12,7 +12,7 @@ Before do |scenario|
end
Around('@stress') do |scenario, block|
Timeout.timeout(STRESS_TIMEOUT) do
Timeout.timeout(STRESS_TIMEOUT) do
block.call
end
end

View File

@ -63,5 +63,3 @@ end
def log_preprocess_done
end