@@ -32,7 +32,7 @@ class VersionedPluginDocs < Clamp::Command
3232 "logstash-codec-java_codec_example"
3333 ]
3434
35- VERSIONS_URL = "https://raw.githubusercontent.com/elastic/docs/master/shared/versions/stack/master.asciidoc "
35+ STACK_VERSIONS_BASE_URL = "https://raw.githubusercontent.com/elastic/docs/master/shared/versions/stack/"
3636
3737 def logstash_docs_path
3838 File . join ( output_path , "logstash-docs" )
@@ -416,14 +416,24 @@ def lazy_create_output_folder(file_name)
416416 end
417417
418418 def fetch_stack_versions
419- stack_versions = Net :: HTTP . get ( URI . parse ( VERSIONS_URL ) )
420- @logstash_version = get_logstash_version ( stack_versions )
419+ current_stack_versions = resolve_current_versions
420+ @logstash_version = get_logstash_version ( current_stack_versions )
421421 puts "Logstash version: #{ @logstash_version } \n "
422422
423- @ecs_version = get_ecs_version ( stack_versions )
423+ @ecs_version = get_ecs_version ( current_stack_versions )
424424 puts "ECS version: #{ @ecs_version } \n "
425425 end
426426
427+ def fetch_stack_versions_doc ( version )
428+ Net ::HTTP . get ( URI . parse ( STACK_VERSIONS_BASE_URL + version + ".asciidoc" ) )
429+ end
430+
431+ def resolve_current_versions
432+ current_stack_versions_ref_doc = fetch_stack_versions_doc ( "current" )
433+ current_doc_link = current_stack_versions_ref_doc [ /include::(.*?).asciidoc/m , 1 ]
434+ fetch_stack_versions_doc ( current_doc_link )
435+ end
436+
427437 def get_logstash_version ( stack_versions )
428438 stack_versions [ /\: logstash_version:\s +(.*?)\n / , 1 ]
429439 end
0 commit comments