lib/rspeckled/plugins/dox.rb in rspeckled-0.0.63 vs lib/rspeckled/plugins/dox.rb in rspeckled-0.0.64

- old
+ new

@@ -7,44 +7,51 @@ example.metadata[:request] = request example.metadata[:response] = response end end -api_docs_folder = Pathname.pwd.join('docs', 'api') -api_docs_header = api_docs_folder.join('header.md') +begin + require 'dox' -api_docs_folder.mkpath + api_docs_folder = Pathname.pwd.join('docs', 'api') + api_docs_header = api_docs_folder.join('header.md') -api_docs_folder.glob('**/*.rb').each { |f| require f } + puts api_docs_folder -titleized_application_name = Rails - .application - .class - .name - .split('::')[0] - .titleize + api_docs_folder.mkpath -http_settings_file = Pathname.pwd.join('config', 'settings', 'http.yml') + api_docs_folder.glob('**/*.rb').each { |f| require f } -host = if http_settings_file.exist? - http_settings = YAML.load(http_settings_file.read) # rubocop:disable Security/YAMLLoad + titleized_application_name = Rails + .application + .class + .name + .split('::')[0] + .titleize - http_settings['production']['http']['base_url'] - else - 'http://api.lvh.me:5000' - end + http_settings_file = Pathname.pwd.join('config', 'settings', 'http.yml') -unless api_docs_header.exist? - api_docs_header.write(<<~HEREDOC, :mode => 'w') - FORMAT: 1A - HOST: #{host} + host = if http_settings_file.exist? + http_settings = YAML.load(http_settings_file.read) # rubocop:disable Security/YAMLLoad - # #{titleized_application_name} + http_settings['production']['http']['base_url'] + else + 'http://api.lvh.me:5000' + end - HEREDOC -end + unless api_docs_header.exist? + api_docs_header.write(<<~HEREDOC, :mode => 'w') + FORMAT: 1A + HOST: #{host} -Dox.configure do |config| - config.header_file_path = api_docs_header - config.desc_folder_path = api_docs_folder - # config.headers_whitelist = ['Accept', 'X-Auth-Token'] + # #{titleized_application_name} + + HEREDOC + end + + Dox.configure do |config| + config.header_file_path = api_docs_header + config.desc_folder_path = api_docs_folder + # config.headers_whitelist = ['Accept', 'X-Auth-Token'] + end +rescue LoadError end