Sha256: fd00664b382896645c4731c738789093250801b7ef6214e2bc8212f9c0ba1a79

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require 'pathname'

RSpec.configure do |config|
  config.after(:each, :dox) do |example|
    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')

api_docs_folder.mkpath

api_docs_folder.glob('**/*.rb').each { |f| require f }

titleized_application_name = Rails
                               .application
                               .class
                               .name
                               .split('::')[0]
                               .titleize

http_settings_file = Pathname.pwd.join('config', 'settings', 'http.yml')

host = if http_settings_file.exist?
          http_settings = YAML.load(http_settings_file.read) # rubocop:disable Security/YAMLLoad

          http_settings['production']['http']['base_url']
       else
          'http://api.lvh.me:5000'
       end

unless api_docs_header.exist?
  api_docs_header.write(<<~HEREDOC, :mode => 'w')
    FORMAT: 1A
    HOST:   #{host}

    # #{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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rspeckled-0.0.63 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.62 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.61 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.60 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.59 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.58 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.57 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.56 lib/rspeckled/plugins/dox.rb
rspeckled-0.0.55 lib/rspeckled/plugins/dox.rb