class GitCli::Gvcs::Workspace
Attributes
repos[RW]
Public Class Methods
new(vcs, path)
click to toggle source
# File lib/git_cli.rb, line 122 def initialize(vcs, path) raise_if_empty(vcs , "VCS cannot be empty", GitCliException) raise_if_empty(path, "Workspace path cannot be empty", GitCliException) @vcs = vcs @givenPath = path @wsPath = File.expand_path(@givenPath) @repos = [] end
Public Instance Methods
add_repos(repos)
click to toggle source
# File lib/git_cli.rb, line 144 def add_repos(repos) @repos << repos if not repos.nil? end
check_repos()
click to toggle source
# File lib/git_cli.rb, line 148 def check_repos raise_if_empty(@repos, "Repositories should not be empty", GitCliException) end
is_repos_exist?(name)
click to toggle source
# File lib/git_cli.rb, line 152 def is_repos_exist?(name) found = false @repos.each do |re| if re.name == name found = true break end end found end
is_workspace?()
click to toggle source
# File lib/git_cli.rb, line 163 def is_workspace? st, res = status st end
path()
click to toggle source
# File lib/git_cli.rb, line 136 def path @wsPath end
vcs()
click to toggle source
# File lib/git_cli.rb, line 140 def vcs @vcs end
workspace_root()
click to toggle source
# File lib/git_cli.rb, line 168 def workspace_root if (@wsRoot.nil? or (@wsRoot[0] == false)) check_vcs cmd = [] cmd << "cd" cmd << @wsPath cmd << "&&" cmd << @vcs.exe_path cmd << "rev-parse --show-toplevel" cmdln = cmd.join(" ") log_debug "Workspace root: #{cmdln}" res = os_exec(cmdln) do |st, res| if st.success? @wsRoot = [true, res] else @wsRoot = [false, res] end end end @wsRoot end