class GitCopy
Public Class Methods
copyRepo(repoPath, destPath = ".")
click to toggle source
# File lib/gitcopy.rb, line 6 def self.copyRepo(repoPath, destPath = ".") if destPath == "" || destPath == nil destPath = "." end ensureValidRepo(repoPath) `git clone #{repoPath} #{@tempDir}` `rm -rf #{@tempDir}/.git` `mkdir -p #{destPath}` `mv #{@tempDir}/* #{destPath}` `mv #{@tempDir}/.[!.]* #{destPath}` `rm -rf #{@tempDir}` end
ensureValidRepo(repoPath)
click to toggle source
# File lib/gitcopy.rb, line 20 def self.ensureValidRepo(repoPath) if !repoPath fatalError("Please provide a valid github repo") end repoProtocol = GitProperties.repoProtocol(repoPath) repoExtension = GitProperties.repoExtension(repoPath) if (repoProtocol != "http" || repoProtocol != "git@") && repoExtension != ".git" fatalError("Please provide a valid github repo") end end
fatalError(error)
click to toggle source
# File lib/gitcopy.rb, line 33 def self.fatalError(error) puts "Error: #{error}" exit(false) end