mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
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:
parent
a7421e590e
commit
2a91e391d0
2 changed files with 9 additions and 2 deletions
|
@ -26,12 +26,16 @@ module LogStash module Docgen
|
||||||
BUNDLER_CMD = "bundler install --jobs 8 --quiet --path /tmp/vendor"
|
BUNDLER_CMD = "bundler install --jobs 8 --quiet --path /tmp/vendor"
|
||||||
RAKE_VENDOR_CMD = "bundle exec rake vendor"
|
RAKE_VENDOR_CMD = "bundle exec rake vendor"
|
||||||
RAKE_DOC_ASCIIDOC = "bundle exec rake doc:asciidoc"
|
RAKE_DOC_ASCIIDOC = "bundle exec rake doc:asciidoc"
|
||||||
|
DOCUMENT_SEPARATOR = "~~~ASCIIDOC_DOCUMENT~~~\n"
|
||||||
|
|
||||||
# Content needed to inject to make the generator work
|
# Content needed to inject to make the generator work
|
||||||
GEMFILE_CHANGES = "gem 'logstash-docgen', :path => \"#{File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))}\""
|
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
|
# 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
|
attr_reader :path, :full_name
|
||||||
|
|
||||||
|
@ -89,7 +93,8 @@ module LogStash module Docgen
|
||||||
output = run_in_directory(RAKE_DOC_ASCIIDOC)
|
output = run_in_directory(RAKE_DOC_ASCIIDOC)
|
||||||
destination = File.join(destination, "#{type}s")
|
destination = File.join(destination, "#{type}s")
|
||||||
FileUtils.mkdir_p(destination)
|
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
|
end
|
||||||
|
|
||||||
def bundle_install
|
def bundle_install
|
||||||
|
|
|
@ -18,6 +18,7 @@ module LogStash::Docgen
|
||||||
NEW_CLASS_DEFINITION_RE_ML = /^\s*class\s(.*) < *(::)?LogStash::(Outputs|Filters|Inputs|Codecs)::(\w+)/
|
NEW_CLASS_DEFINITION_RE_ML = /^\s*class\s(.*) < *(::)?LogStash::(Outputs|Filters|Inputs|Codecs)::(\w+)/
|
||||||
CONFIG_OPTION_RE = /^\s*((mod|base).)?config +[^=].*/
|
CONFIG_OPTION_RE = /^\s*((mod|base).)?config +[^=].*/
|
||||||
CONFIG_NAME_RE = /^ *config_name .*/
|
CONFIG_NAME_RE = /^ *config_name .*/
|
||||||
|
RESET_BUFFER_RE = /^require\s("|')\w+("|')/
|
||||||
|
|
||||||
def initialize(context)
|
def initialize(context)
|
||||||
@rules = [
|
@rules = [
|
||||||
|
@ -26,6 +27,7 @@ module LogStash::Docgen
|
||||||
[ NEW_CLASS_DEFINITION_RE_ML, :parse_new_class_description ],
|
[ NEW_CLASS_DEFINITION_RE_ML, :parse_new_class_description ],
|
||||||
[ CONFIG_OPTION_RE, :parse_config ],
|
[ CONFIG_OPTION_RE, :parse_config ],
|
||||||
[ CONFIG_NAME_RE, :parse_config_name ],
|
[ CONFIG_NAME_RE, :parse_config_name ],
|
||||||
|
[ RESET_BUFFER_RE, :reset_buffer ]
|
||||||
]
|
]
|
||||||
|
|
||||||
@context = context
|
@context = context
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue