Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor injection of qualifier according to comments
Browse files Browse the repository at this point in the history
jsvd committed Jan 17, 2025
1 parent 6df88f2 commit 2117e07
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions logstash-core-plugin-api/logstash-core-plugin-api.gemspec
Original file line number Diff line number Diff line change
@@ -11,8 +11,12 @@ if File.exist?(project_versions_yaml_path)
#
# we ignore the copy in git and we overwrite an existing file
# each time we build the logstash-core gem
original_lines = IO.read(project_versions_yaml_path)
original_lines.gsub!(/^logstash: (.+?)\n/, "logstash: \\1-#{ENV['VERSION_QUALIFIER']}\n") if ENV['VERSION_QUALIFIER']
original_lines = IO.readlines(project_versions_yaml_path)
if ENV['VERSION_QUALIFIER']
logstash_version_line = original_lines.find {|line| line.match(/^logstash:/) }
logstash_version_line.chomp!
logstash_version_line << "-#{ENV['VERSION_QUALIFIER']}\n"
end
original_lines << "\n"
original_lines << "# This is a copy the project level versions.yml into this gem's root and it is created when the gemspec is evaluated."
gem_versions_yaml_path = File.expand_path("./versions-gem-copy.yml", File.dirname(__FILE__))
9 changes: 6 additions & 3 deletions logstash-core/logstash-core.gemspec
Original file line number Diff line number Diff line change
@@ -16,9 +16,12 @@ if File.exist?(project_versions_yaml_path)
#
# we ignore the copy in git and we overwrite an existing file
# each time we build the logstash-core gem
original_lines = IO.read(project_versions_yaml_path)
original_lines.gsub!(/^logstash: (.+?)\n/, "logstash: \\1-#{ENV['VERSION_QUALIFIER']}\n") if ENV['VERSION_QUALIFIER']

original_lines = IO.readlines(project_versions_yaml_path)
if ENV['VERSION_QUALIFIER']
logstash_version_line = original_lines.find {|line| line.match(/^logstash:/) }
logstash_version_line.chomp!
logstash_version_line << "-#{ENV['VERSION_QUALIFIER']}\n"
end
original_lines << "\n"
original_lines << "# This is a copy the project level versions.yml into this gem's root and it is created when the gemspec is evaluated."
gem_versions_yaml_path = File.expand_path("./versions-gem-copy.yml", File.dirname(__FILE__))

0 comments on commit 2117e07

Please sign in to comment.