Sha256: c7e9031068bd4ff40a0deaf2d31d3d031cd4668f224722fbae05358464d68505

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require 'pathname'

begin
  require 'dox'

  api_docs_folder = Pathname.pwd.join('docs', 'api')
  api_docs_header = api_docs_folder.join('header.md')

  puts api_docs_folder

  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
rescue LoadError
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rspeckled-2.0.0 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.4.0 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.3.1 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.3.0 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.2.1 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.2.0 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.1.3 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.1.2 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.1.1 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.1.0 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.0.5 lib/rspeckled/plugins/configuration/dox.rb
rspeckled-1.0.4 lib/rspeckled/plugins/configuration/dox.rb