lib/simple/httpd/cli.rb in simple-httpd-0.3.4 vs lib/simple/httpd/cli.rb in simple-httpd-0.3.5
- old
+ new
@@ -53,25 +53,26 @@
::Simple::Httpd.listen!(app, environment: environment,
host: host,
port: port)
end
+ # rubocop:disable Metrics/AbcSize
def routes(*mounts, environment: "development", services: nil)
prepare_environment!(environment: environment)
app = build_app!(mounts: mounts, services: services)
routes = app.route_descriptions
logger.info "Found #{routes.count} routes"
max_verb_len = routes.map(&:verb).map(&:length).max
max_path_len = routes.map(&:path).map(&:length).max
- routes.
- sort_by { |route| [route.path, route.verb] }.
- each { |route|
+ routes
+ .sort_by { |route| [route.path, route.verb] }
+ .each do |route|
puts format("%#{max_verb_len}s %-#{max_path_len}s %s", route.verb, route.path, route.source_location_str)
- }
+ end
end
private
def prepare_environment!(environment:)
@@ -109,15 +110,9 @@
ary.concat Dir.glob("#{service_path}/**/*.rb").sort
else
ary << service_path
end
end
- end
-
- def stderr_logger
- logger = ::Logger.new STDERR
- logger.level = ::Logger::INFO
- logger
end
def start_simplecov
require "simplecov"