Skip to content

Commit 6512bac

Browse files
committed
[API] Generator: Set the right version for the generated API code docs url
1 parent 5cbd463 commit 6512bac

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

elasticsearch-api/utils/thor/generator/files_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# See the LICENSE file in the project root for more information
44

55
require 'pathname'
6+
require_relative '../../../lib/elasticsearch/api/version.rb'
67

78
module Elasticsearch
89
module API
@@ -36,6 +37,11 @@ def self.files(api)
3637
File.extname(f) != '.json'
3738
end
3839
end
40+
41+
def self.gem_version
42+
regex = /([0-9]{1,2}\.[0-9x]{1,2})/
43+
Elasticsearch::API::VERSION.match(regex)[0]
44+
end
3945
end
4046
end
4147
end

elasticsearch-api/utils/thor/templates/_documentation_top.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
<% end -%>
2525
<%= ' '*(@namespace_depth+3) -%>#
2626
<%# Documentation link -%>
27-
<%= ' '*(@namespace_depth+3) %># @see <%= @spec['documentation']['url'] ? @spec['documentation']['url'] : "[TODO]" %>
27+
<%= ' '*(@namespace_depth+3) %># @see <%= @spec['documentation']['url'] ? @spec['documentation']['url'].gsub(/\/current|master\//, "#{Elasticsearch::API::FilesHelper.gem_version}/") : "[TODO]" %>
2828
<%= ' '*(@namespace_depth+3) %>#

0 commit comments

Comments
 (0)