Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-08-06 12:46:17 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2019-08-06 12:46:17 +0300
commitc6a8032e1af21da05280c1c01b489a282868af89 (patch)
treeaa16b4efa2cfe752e4f7eeb781166ece7bf3069a
parentb9268c5dd8ab74e0fcbd75046ced98d7b637918d (diff)
Update ruby proto version file during release
-rwxr-xr-x_support/generate-proto-ruby10
-rwxr-xr-x_support/release25
2 files changed, 23 insertions, 12 deletions
diff --git a/_support/generate-proto-ruby b/_support/generate-proto-ruby
index a9ceab7d4..796b6ccb4 100755
--- a/_support/generate-proto-ruby
+++ b/_support/generate-proto-ruby
@@ -39,16 +39,6 @@ def write_ruby_requires
<% end %>
EOT
open(gem_root, 'w') { |f| f.write(gem_root_template.result(binding)) }
-
- version_rb_template = <<~EOT
- # This file was auto-generated by #{$0}
- module Gitaly
- VERSION = "#{File.read('VERSION').chomp}"
- end
- EOT
- version_rb = File.join(RUBY_PREFIX, RUBY_VERSION_FILE)
- open(version_rb, 'w') { |f| f.write(version_rb_template) }
-
end
main
diff --git a/_support/release b/_support/release
index 443f013e8..712fdfc27 100755
--- a/_support/release
+++ b/_support/release
@@ -19,7 +19,7 @@ def main(version)
run!(%w[git diff --quiet --cached --exit-code])
tag_name = "v#{version}"
- write_version_file(version)
+ write_version_files(version)
run!(%W[_support/generate_changelog #{version}])
run!(%w[git add changelogs CHANGELOG.md])
@@ -35,10 +35,31 @@ def main(version)
puts "If this is not a security release you can now publish this tag to gitlab.com:\n\n\t_support/publish #{tag_name}\n\n"
end
-def write_version_file(version)
+def write_version_files(version)
version_file = 'VERSION'
open(version_file, 'w') { |f| f.puts version }
run!(%W[git add #{version_file}])
+
+ ruby_proto_version_file = 'ruby/proto/gitaly/version.rb'
+ open(ruby_proto_version_file, 'w') do |f|
+ f.puts <<~PROTO_VERSION
+ # This file was auto-generated by #{$0}
+ module Gitaly
+ VERSION = '#{version}'
+ end
+ PROTO_VERSION
+ end
+
+ # Generating code is tricky. Let's actually load the gem, and inspect
+ # the version constant.
+ check = capture!(%W[ruby -Iruby/proto -rgitaly -e #{'print Gitaly::VERSION'}])
+ unless check == version
+ puts "fatal: ruby proto version check failed. \n\n"
+ puts capture!(%w[git diff])
+ abort
+ end
+
+ run!(%W[git add #{ruby_proto_version_file}])
end
def error(msg)