Module: GitCli::GitCore

Includes:
Antrapol::ToolRack::ConditionUtils
Included in:
Vcs
Defined in:
lib/git_cli/git_core.rb

Instance Method Summary collapse

Instance Method Details

#exe_pathObject

extend Antrapol::ToolRack::ConditionUtils



28
29
30
31
32
33
34
35
# File 'lib/git_cli/git_core.rb', line 28

def exe_path
  if @gitPath.nil? or @gitPath.empty?
    st, path = is_installed?
    @gitPath = path.strip if st
  end

  @gitPath
end

#versionObject

exe_path



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/git_cli/git_core.rb', line 37

def version
  
  if @version.nil? or @version.empty?
    path = exe_path
    cmd = "#{path} version"
    log_debug "version : #{cmd}"
    os_exec(cmd) do |st, res|
      # as current dev version
      if st.success?
        res.strip!
        # based on version 2.25.1
        @version = res.split(" ")[-1]
        [true,@version]
      else
        [false,""]
      end
    end
  else
    [true, @version]
  end

end