Support license in the docgen if they are at the beginning of the document remove the logger statement in the generate file

Fixes #6714
This commit is contained in:
Pier-Hugues Pellerin 2017-02-15 15:35:33 -05:00
parent a7421e590e
commit 2a91e391d0
2 changed files with 9 additions and 2 deletions

View file

@ -26,12 +26,16 @@ module LogStash module Docgen
BUNDLER_CMD = "bundler install --jobs 8 --quiet --path /tmp/vendor"
RAKE_VENDOR_CMD = "bundle exec rake vendor"
RAKE_DOC_ASCIIDOC = "bundle exec rake doc:asciidoc"
DOCUMENT_SEPARATOR = "~~~ASCIIDOC_DOCUMENT~~~\n"
# Content needed to inject to make the generator work
GEMFILE_CHANGES = "gem 'logstash-docgen', :path => \"#{File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))}\""
# require devutils to fix an issue when the logger is not found
RAKEFILE_CHANGES = "require 'logstash/devutils/rspec/spec_helper'; require 'logstash/docgen/plugin_doc'"
RAKEFILE_CHANGES = "
require 'logstash/devutils/rspec/spec_helper'
puts '#{DOCUMENT_SEPARATOR}'
require 'logstash/docgen/plugin_doc'"
attr_reader :path, :full_name
@ -89,7 +93,8 @@ module LogStash module Docgen
output = run_in_directory(RAKE_DOC_ASCIIDOC)
destination = File.join(destination, "#{type}s")
FileUtils.mkdir_p(destination)
IO.write(File.join(destination, "#{name}.asciidoc"), output.read)
content = output.read.split(DOCUMENT_SEPARATOR).last
IO.write(File.join(destination, "#{name}.asciidoc"), content)
end
def bundle_install

View file

@ -18,6 +18,7 @@ module LogStash::Docgen
NEW_CLASS_DEFINITION_RE_ML = /^\s*class\s(.*) < *(::)?LogStash::(Outputs|Filters|Inputs|Codecs)::(\w+)/
CONFIG_OPTION_RE = /^\s*((mod|base).)?config +[^=].*/
CONFIG_NAME_RE = /^ *config_name .*/
RESET_BUFFER_RE = /^require\s("|')\w+("|')/
def initialize(context)
@rules = [
@ -26,6 +27,7 @@ module LogStash::Docgen
[ NEW_CLASS_DEFINITION_RE_ML, :parse_new_class_description ],
[ CONFIG_OPTION_RE, :parse_config ],
[ CONFIG_NAME_RE, :parse_config_name ],
[ RESET_BUFFER_RE, :reset_buffer ]
]
@context = context