VIVO-262 Complete the push script. Add more checking to extract_files.
This commit is contained in:
parent
9dcf9d50e1
commit
5b8309bcbc
2 changed files with 62 additions and 2 deletions
|
@ -21,7 +21,23 @@ require '_common'
|
|||
#
|
||||
# Get the VIVO files and the Vitro files, and remove the .git directories.
|
||||
#
|
||||
def export_files(vivo_path, vitro_path, tag, export_dir)
|
||||
def export_files(vivo_path, vitro_path, tag, branch, export_dir)
|
||||
Dir.chdir(vivo_path) do |path|
|
||||
cmds = ["git checkout #{branch}",
|
||||
"git pull",
|
||||
]
|
||||
cmds.delete_at(1) unless is_remote_branch?(branch)
|
||||
approve_and_execute(cmds, "in #{path}")
|
||||
end
|
||||
|
||||
Dir.chdir(vitro_path) do |path|
|
||||
cmds = ["git checkout #{branch}",
|
||||
"git pull",
|
||||
]
|
||||
cmds.delete_at(1) unless is_remote_branch?(branch)
|
||||
approve_and_execute(cmds, "in #{path}")
|
||||
end
|
||||
|
||||
approve_and_execute([
|
||||
"rm -Rf #{File.expand_path("..", export_dir)}",
|
||||
"mkdir -pv #{export_dir}",
|
||||
|
@ -31,6 +47,10 @@ def export_files(vivo_path, vitro_path, tag, export_dir)
|
|||
])
|
||||
end
|
||||
|
||||
def is_remote_branch?(branch)
|
||||
! `git branch --list -a origin/#{branch}`.strip.empty?
|
||||
end
|
||||
|
||||
#
|
||||
# ------------------------------------------------------------------------------------
|
||||
# Main method
|
||||
|
@ -39,6 +59,7 @@ end
|
|||
|
||||
begin
|
||||
tag = Settings.tag_name
|
||||
branch = Settings.branch_name
|
||||
vivo_path = Settings.vivo_path
|
||||
vitro_path = Settings.vitro_path
|
||||
export_dir = Settings.export_dir
|
||||
|
@ -54,7 +75,7 @@ begin
|
|||
|
||||
get_permission_and_go(p) do
|
||||
puts "Building export area"
|
||||
export_files(vivo_path, vitro_path, tag, export_dir)
|
||||
export_files(vivo_path, vitro_path, tag, branch, export_dir)
|
||||
end
|
||||
rescue BadState
|
||||
puts "#{$!.message} - Aborting."
|
||||
|
|
39
utilities/releaseScripts/8_push_changes.rb
Normal file
39
utilities/releaseScripts/8_push_changes.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
=begin
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Push any branches, tags, or merges back to GitHub.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
=end
|
||||
|
||||
$: << File.dirname(File.expand_path(__FILE__))
|
||||
require '_common'
|
||||
|
||||
#
|
||||
# Merge the maintenance branch to the master branch and create the tag.
|
||||
#
|
||||
def push_to_origin(repo_path)
|
||||
Dir.chdir(repo_path) do |path|
|
||||
approve_and_execute(["git push --all", "git push --tags"], "in #{path}")
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# ------------------------------------------------------------------------------------
|
||||
# Main method
|
||||
# ------------------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
begin
|
||||
vivo_path = Settings.vivo_path
|
||||
vitro_path = Settings.vitro_path
|
||||
|
||||
get_permission_and_go("OK to push changes to the origin?") do
|
||||
puts "Merging tags"
|
||||
push_to_origin(vivo_path)
|
||||
push_to_origin(vitro_path)
|
||||
end
|
||||
rescue BadState
|
||||
puts "#{$!.message} - Aborting."
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue