module GitCli::Init

Public Instance Methods

init(path) click to toggle source
# File lib/git_cli/init.rb, line 26
def init(path)
  # from Core module
  gpath = exe_path 

  cmd = []
  #cmd << "cd #{File.expand_path(path)}"
  #cmd << "&&"
  cmd << gpath
  cmd << "init"
  cmd << File.expand_path(path)
 
  cmdln = cmd.join(" ")

  log_debug "Init : #{cmdln} " 

  os_exec(cmdln) do |st, res|
    [st.success?, res.strip]
  end
  
end
reset(path) click to toggle source
# File lib/git_cli/init.rb, line 47
def reset(path)
  
  raise_if_empty(path, "Path should not be empty for reset operation", GitCliException)

  if File.exist?(path)
    Dir.entries(path).each do |f|
      if f == ".git"
        log_debug ".git directory found."
        FileUtils.rm_rf(f)
        log_debug ".git directory deleted"
        break
      end
    end
  end 

end