Class: R2OAS::Deploy::Client

Inherits:
Schema::Base show all
Defined in:
lib/r2-oas/deploy/client.rb

Constant Summary collapse

SWAGGER_UI_DIST_URL =
'https://github.com/swagger-api/swagger-ui/trunk/dist'

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
# File 'lib/r2-oas/deploy/client.rb', line 11

def initialize(options = {})
  super(options)
  @download_dir = "#{SecureRandom.uuid[0..7]}/dist"
  @dist_path = File.expand_path(Rails.root.join(@download_dir), __FILE__)
end

Instance Method Details

#deployObject



21
22
23
24
25
26
27
# File 'lib/r2-oas/deploy/client.rb', line 21

def deploy
  copy_swagger_ui_dist
  copy_swagger_ui_index
  copy_oas_doc_file
ensure
  remove_download_dist
end

#download_swagger_ui_distObject



17
18
19
# File 'lib/r2-oas/deploy/client.rb', line 17

def download_swagger_ui_dist
  system("svn export #{SWAGGER_UI_DIST_URL} #{@dist_path}")
end