lib/r2-oas/tasks/tool.rake in r2-oas-0.1.3 vs lib/r2-oas/tasks/tool.rake in r2-oas-0.2.0

- old
+ new

@@ -6,38 +6,36 @@ require 'r2-oas/task_logging' load File.expand_path('common.rake', __dir__) namespace :routes do namespace :oas do - desc 'Deploy Swagger UI' + desc 'Deploy OAS Document' task deploy: [:common] do - logger.info '[R2-OAS] start' + start do + builder_options = { unit_paths_file_path: unit_paths_file_path } + builder = R2OAS::Schema::Builder.new(builder_options) + builder.build_docs - generator_options = { unit_paths_file_path: unit_paths_file_path, skip_generate_docs: true } - generator = R2OAS::Schema::Generator.new(generator_options) - generator.generate_docs - - client_options = {} - client = R2OAS::Deploy::Client.new(client_options) - client.deploy - - logger.info '[R2-OAS] end' + client_options = {} + client = R2OAS::Deploy::Client.new(client_options) + client.deploy + end end desc 'Display paths list' task paths_ls: [:common] do fd = IO.sysopen('/dev/null', 'w+') $stdout = IO.new(fd) logger.level = :null - logger.info '[R2-OAS] start' - $stdout = StringIO.new - paths_ls_options = {} - paths_ls = R2OAS::Tool::Paths::Ls.new(paths_ls_options) - paths_ls.print + start do + $stdout = StringIO.new - logger.info '[R2-OAS] end' + paths_ls_options = {} + paths_ls = R2OAS::Tool::Paths::Ls.new(paths_ls_options) + paths_ls.print + end result = $stdout.string $stdout = STDOUT puts result end @@ -46,21 +44,20 @@ task paths_stats: [:common] do fd = IO.sysopen('/dev/null', 'w+') $stdout = IO.new(fd) logger.level = :null - logger.info '[R2-OAS] start' - generator_options = { skip_generate_docs: true, skip_load_dot_paths: true } - generator = R2OAS::Schema::Generator.new(generator_options) - generator.generate_docs + start do + builder_options = { skip_load_dot_paths: true } + builder = R2OAS::Schema::Builder.new(builder_options) + builder.build_docs - $stdout = StringIO.new + $stdout = StringIO.new - paths_log_options = {} - paths_log = R2OAS::Tool::Paths::Stats.new(paths_log_options) - paths_log.print - - logger.info '[R2-OAS] end' + paths_log_options = {} + paths_log = R2OAS::Tool::Paths::Stats.new(paths_log_options) + paths_log.print + end result = $stdout.string $stdout = STDOUT puts result end