Sha256: a993be7c5744d8a1c81c0cad0dedd3bb99c41dee9dc8c2a89d829fc8b5c54fe9
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal:true require 'fileutils' # Scope Rails module R2OAS module Deploy class Client < Schema::Base def deploy copy_swagger_ui_dist copy_swagger_ui_index copy_oas_doc_file end private def copy_swagger_ui_dist docs_path = File.expand_path(Rails.root.join(deploy_dir_path), __FILE__) return if FileTest.exists?(docs_path) FileUtils.mkdir_p(docs_path) unless FileTest.exists?(docs_path) dist_path = File.expand_path('swagger-ui/dist', __dir__) FileUtils.cp_r(dist_path, docs_path) end def copy_swagger_ui_index index_path = File.expand_path(Rails.root.join(deploy_dir_path, 'index.html'), __FILE__) @schema_file_path = doc_save_file_name template_path = File.expand_path('swagger-ui/index.html.erb', __dir__) template = File.read(template_path) index = ERB.new(template, nil, '%').result(binding) File.write(index_path, index) end def copy_oas_doc_file swagger_file_path = File.expand_path(Rails.root.join(deploy_dir_path, doc_save_file_name), __FILE__) oas_doc_file_path = File.expand_path("#{root_dir_path}/#{doc_save_file_name}") FileUtils.cp_r(oas_doc_file_path, swagger_file_path) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
r2-oas-0.2.0 | lib/r2-oas/deploy/client.rb |
r2-oas-0.1.3 | lib/r2-oas/deploy/client.rb |
r2-oas-0.1.2 | lib/r2-oas/deploy/client.rb |