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 Devops::Api2.register r
end end
Routes.route "/v2.0", Devops::Api2 Routes.route "/v2.0", Devops::Api2
Devops::Api2.routes_list
end end
private private

View File

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

View File

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

View File

@ -94,6 +94,19 @@ module Sinatra
statistic statistic
end end
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 end
# Check request headers # Check request headers