routes list

This commit is contained in:
amartynov 2015-08-13 17:43:08 +03:00
parent 1c9277f3c3
commit 511f689414
4 changed files with 18 additions and 9 deletions

View File

@ -79,6 +79,7 @@ module Devops
Devops::Api2.register r
end
Routes.route "/v2.0", Devops::Api2
Devops::Api2.routes_list
end
private

View File

@ -33,12 +33,6 @@ class DevopsService
class << self
def routes
config = DevopsConfig.config
Devops::Routes.preffix = config[:url_prefix]
#require_relative "routes/routes.rb"
end
# steps:
# 1. init db
# 2. load application handlers
@ -48,12 +42,13 @@ class DevopsService
# 6. init all routes classes
# 7. register routes for all classes
def init
KnifeFactory.init
# init database
Devops::Db.init
DevopsLogger.logger = DevopsLogger.create(STDOUT)
routes
config = DevopsConfig.config
Devops::Routes.preffix = config[:url_prefix]
apps = Devops::Application.applications
apps.each do |a|
a.prepare
@ -81,6 +76,7 @@ class DevopsService
# add plugins routes
Devops::Loader.routes
=end
KnifeFactory.init
end
def debug?

View File

@ -132,7 +132,6 @@ module Devops
# all exceptions are handled in @validate! method
def validate_model(model)
DevopsLogger.logger.debug validators.inspect
puts validators.inspect
validators.each do |validator|
validator.new(model).validate!
end

View File

@ -94,6 +94,19 @@ module Sinatra
statistic
end
end
def routes
@routes
end
def routes_list
routes.each do |verb, signature|
signature.each do |s|
puts "#{verb}\t#{s[0]}"
end
end
end
end
# Check request headers