adapt the release scripts to an older Git client
This commit is contained in:
parent
3df439c4a7
commit
02280e6171
3 changed files with 14 additions and 13 deletions
|
@ -25,15 +25,11 @@ def create_tag(dir, branch, tag, message)
|
||||||
"git pull",
|
"git pull",
|
||||||
"git tag -a #{tag} -m '#{message}'"
|
"git tag -a #{tag} -m '#{message}'"
|
||||||
]
|
]
|
||||||
cmds.delete_at(1) unless is_remote_branch?(branch)
|
cmds.delete_at(1) unless remote_branch_exists?(path, branch)
|
||||||
approve_and_execute(cmds, "in #{path}")
|
approve_and_execute(cmds, "in #{path}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_remote_branch?(branch)
|
|
||||||
! `git branch --list -a origin/#{branch}`.strip.empty?
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------------
|
||||||
# Main method
|
# Main method
|
||||||
|
|
|
@ -26,7 +26,7 @@ def export_files(vivo_path, vitro_path, tag, branch, export_dir)
|
||||||
cmds = ["git checkout #{branch}",
|
cmds = ["git checkout #{branch}",
|
||||||
"git pull",
|
"git pull",
|
||||||
]
|
]
|
||||||
cmds.delete_at(1) unless is_remote_branch?(branch)
|
cmds.delete_at(1) unless remote_branch_exists?(path, branch)
|
||||||
approve_and_execute(cmds, "in #{path}")
|
approve_and_execute(cmds, "in #{path}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ def export_files(vivo_path, vitro_path, tag, branch, export_dir)
|
||||||
cmds = ["git checkout #{branch}",
|
cmds = ["git checkout #{branch}",
|
||||||
"git pull",
|
"git pull",
|
||||||
]
|
]
|
||||||
cmds.delete_at(1) unless is_remote_branch?(branch)
|
cmds.delete_at(1) unless remote_branch_exists?(path, branch)
|
||||||
approve_and_execute(cmds, "in #{path}")
|
approve_and_execute(cmds, "in #{path}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,10 +47,6 @@ def export_files(vivo_path, vitro_path, tag, branch, export_dir)
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_remote_branch?(branch)
|
|
||||||
! `git branch --list -a origin/#{branch}`.strip.empty?
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------------
|
||||||
# Main method
|
# Main method
|
||||||
|
|
|
@ -239,13 +239,22 @@ end
|
||||||
|
|
||||||
def branch_exists?(dir, branch)
|
def branch_exists?(dir, branch)
|
||||||
Dir.chdir(dir) do |path|
|
Dir.chdir(dir) do |path|
|
||||||
! `git branch --list #{branch}`.strip.empty?
|
re = Regexp.new("\\b#{branch}\\b")
|
||||||
|
`git branch`.index(re)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def remote_branch_exists?(dir, branch)
|
||||||
|
Dir.chdir(dir) do |path|
|
||||||
|
re = Regexp.new("remotes/origin/#{branch}\\b")
|
||||||
|
`git branch -a`.index(re)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_exists?(dir, tag)
|
def tag_exists?(dir, tag)
|
||||||
Dir.chdir(dir) do |path|
|
Dir.chdir(dir) do |path|
|
||||||
!`git tag --list #{tag}`.strip.empty?
|
re = Regexp.new("\\b#{tag}\\b")
|
||||||
|
`git tag`.index(re)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue