VIVO-272 Create scripts to build a release from GitHub.
This commit is contained in:
parent
1994ab03a1
commit
f72913a2f1
8 changed files with 755 additions and 0 deletions
70
utilities/releaseScripts/5_insert_revision_info.rb
Normal file
70
utilities/releaseScripts/5_insert_revision_info.rb
Normal file
|
@ -0,0 +1,70 @@
|
|||
=begin
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Figure the revision info and store it in the export directory, for both VIVO
|
||||
and Vitro.
|
||||
|
||||
If the tags don't exist in either repository, or if the export directory is not
|
||||
populated, complain.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
=end
|
||||
|
||||
$: << File.dirname(File.expand_path(__FILE__))
|
||||
require '_common'
|
||||
|
||||
#
|
||||
# Get the revision information from Git and store it in the export directory.
|
||||
#
|
||||
def create_revision_info(git_path, info_file_path, tag)
|
||||
Dir.chdir(git_path) do |path|
|
||||
commit = `git show-ref --tags --hash=7 #{tag}`.strip
|
||||
puts "Writing '#{tag} ~ #{commit}' to #{info_file_path}"
|
||||
File.open(info_file_path, "w") do |f|
|
||||
f.puts tag
|
||||
f.puts commit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# ------------------------------------------------------------------------------------
|
||||
# Main method
|
||||
# ------------------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
begin
|
||||
tag = Settings.tag_name
|
||||
vivo_path = Settings.vivo_path
|
||||
vitro_path = Settings.vitro_path
|
||||
export_dir = Settings.export_dir
|
||||
vivo_revision_info_path = Settings.vivo_revision_info_path
|
||||
vitro_revision_info_path = Settings.vitro_revision_info_path
|
||||
|
||||
raise BadState.new("Tag #{tag} doesn't exist in VIVO.") unless tag_exists?(vivo_path, tag)
|
||||
raise BadState.new("Tag #{tag} doesn't exist in Vitro.") unless tag_exists?(vitro_path, tag)
|
||||
raise BadState.new("Files have not been exported to #{export_dir}") unless File.directory?(export_dir)
|
||||
|
||||
if File.exist?(vivo_revision_info_path) || File.exist?(vitro_revision_info_path)
|
||||
p = "OK to overwrite revision_info at these paths? \n #{vivo_revision_info_path} \n #{vitro_revision_info_path} ? (y/n)"
|
||||
else
|
||||
p = "OK to write revision_info at these paths? \n #{vivo_revision_info_path} \n #{vitro_revision_info_path} ? (y/n)"
|
||||
end
|
||||
|
||||
puts
|
||||
yn = prompt(p)
|
||||
if yn.downcase == 'y'
|
||||
puts
|
||||
puts "Building revision info"
|
||||
create_revision_info(vivo_path, vivo_revision_info_path, tag)
|
||||
create_revision_info(vitro_path, vitro_revision_info_path, tag)
|
||||
puts
|
||||
else
|
||||
puts
|
||||
puts "OK - forget it."
|
||||
puts
|
||||
end
|
||||
rescue BadState
|
||||
puts "#{$!.message} - Aborting."
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue