lib/git_cli.rb in git_cli-0.11.4 vs lib/git_cli.rb in git_cli-0.12.0

- old
+ new

@@ -83,13 +83,16 @@ end def dry_run @dry_run.nil? ? false : @dry_run end + end # common operations - class Gvcs::Vcs + #class Gvcs::Vcs + class Vcs + include TR::CondUtils include GitCli::Common include GitCli::GitCore include GitCli::Init include GitCli::Clone @@ -116,11 +119,13 @@ def check_repos raise_if_empty(@repos, "Repository must not be null", GitCliException) end end # WsCommon - class Gvcs::Workspace + #class Gvcs::Workspace + class Workspace + include TR::CondUtils include GitCli::Common include WsCommon include GitCli::AddCommit include GitCli::Delta include GitCli::Push @@ -212,21 +217,24 @@ cmdln = cmd.join(" ") log_debug "Workspace root: #{cmdln}" res = os_exec(cmdln) do |st, res| if st.success? - @wsRoot = [true, res.strip] + @wsRoot = res.strip + #@wsRoot = [true, res.strip] else - @wsRoot = [false, res.strip] + raise GitCliException, "Failure executing : #{cmdln} \nError was : #{res.strip}" + #@wsRoot = [false, res.strip] end end end @wsRoot end # workspace_root + alias_method :root_path, :workspace_root def load_remote_to_repos conf = remote_config conf.each do |k,v| repo = Gvcs::Repository.new(k, v.values.first) @@ -250,15 +258,34 @@ sd, sf = staged_files (nd.length == 0 and nf.length == 0 and md.length == 0 and mf.length == 0 and dd.length == 0 and df.length == 0 and sd.length == 0 and sf.length == 0) end alias_method :clean?, :is_clean? + alias_method :clear?, :is_clean? + def self.args_to_string_array(*args) + res = [] + args.each do |e| + case e + when Delta::VCSItem + res << e.path + when Array + res.concat(args_to_string_array(*e)) + when String + res << e + else + res << e.to_s + end + end + res + end + end # Gvcs::Workspace - class Gvcs::Repository + #class Gvcs::Repository + class Repository attr_reader :sslVerify attr_reader :name, :url #attr_accessor :branches def initialize(name, url) #, branches = []) @@ -292,5 +319,11 @@ alias_method :can_push?, :is_push_supported? end # repository end + +# backward compatibility +Gvcs::Vcs = GitCli::Vcs +Gvcs::Workspace = GitCli::Workspace +Gvcs::Repository = GitCli::Repository +