Sha256: 43492f319112a2dd66bac659256639a2794c9db1eae45554421b96bc815d3537

Contents?: true

Size: 1.43 KB

Versions: 115

Compression:

Stored size: 1.43 KB

Contents

module Awspec::Generator
  module Doc
    module Type
      # rubocop:disable Metrics/MethodLength
      def self.generate_doc
        Aws.config[:stub_responses] = true
        types = Awspec::Helper::Type::TYPES
        types.delete('base')
        links = types.sort.map do |type|
          '[' + type + '](#' + type + ')'
        end
        links.push('[account](#account)') # add account
        header = <<-'EOF'
# Resource Types

<%= links.join("\n| ") %>

EOF
        doc = ERB.new(header, nil, '-').result(binding)

        types.sort.map do |type|
          doc += eval "Awspec::Generator::Doc::Type::#{type.camelize}.new.generate_doc"
        end

        # account and attributes
        attributes = Awspec::Helper::Type::ACCOUNT_ATTRIBUTES

        doc += <<-'EOF'
# Account and Attributes

EOF
        doc += Awspec::Generator::Doc::Type::Account.new.generate_doc

        doc += <<-'EOF'
## :unlock: Another way: Test with account_attribute type

EOF

        doc += Awspec::Generator::Doc::Type::AccountAttribute.new.generate_doc

        doc += <<-'EOF'
## :unlock: Another way: Test with separated resource types

EOF

        links = attributes.map do |type|
          '[' + type + '](#' + type + ')'
        end

        doc += links.join("\n| ") + "\n"

        attributes.map do |type|
          doc += eval "Awspec::Generator::Doc::Type::#{type.camelize}.new.generate_doc"
        end

        doc.sub(/\n*\z/, '')
      end
    end
  end
end

Version data entries

115 entries across 115 versions & 4 rubygems

Version Path
awspec-1.25.1 lib/awspec/generator/doc/type.rb
awspec-1.25.0 lib/awspec/generator/doc/type.rb
awspec-1.24.4 lib/awspec/generator/doc/type.rb
awspec-1.24.3 lib/awspec/generator/doc/type.rb
awspec-1.24.2 lib/awspec/generator/doc/type.rb
awspec-1.24.1 lib/awspec/generator/doc/type.rb
awspec-1.24.0 lib/awspec/generator/doc/type.rb
awspec-1.23.0 lib/awspec/generator/doc/type.rb
awspec-1.22.1 lib/awspec/generator/doc/type.rb
awspec-1.22.0 lib/awspec/generator/doc/type.rb
awspec-1.21.1 lib/awspec/generator/doc/type.rb
awspec-1.21.0 lib/awspec/generator/doc/type.rb
awspec-1.20.0 lib/awspec/generator/doc/type.rb
awspec-1.19.2 lib/awspec/generator/doc/type.rb
awspec-1.19.1 lib/awspec/generator/doc/type.rb
awspec-1.19.0 lib/awspec/generator/doc/type.rb
cthiesfork-awspec-1.2.4 lib/awspec/generator/doc/type.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/generator/doc/type.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/generator/doc/type.rb
awspec-1.18.6 lib/awspec/generator/doc/type.rb