Class: GitCopy
- Inherits:
-
Object
- Object
- GitCopy
- Defined in:
- lib/gitcopy.rb
Class Method Summary collapse
Class Method Details
.copyRepo(repoPath) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/gitcopy.rb', line 6 def self.copyRepo(repoPath) ensureValidRepo(repoPath) `git clone #{repoPath} #{@tempDir}` `rm -rf #{@tempDir}/.git` `mv #{@tempDir}/* .` `rm -rf #{@tempDir}` end |
.ensureValidRepo(repoPath) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gitcopy.rb', line 14 def self.ensureValidRepo(repoPath) if !repoPath fatalError("Please provide a valid github repo") end repoProtocol = GitProperties.repoProtocol(repoPath) repoName = GitProperties.repoName(repoPath) repoExtension = GitProperties.repoExtension(repoPath) repoDirname = GitProperties.repoDirName(repoPath) if repoProtocol != "http" || repoExtension != ".git" fatalError("Please provide a valid github repo") end end |
.fatalError(error) ⇒ Object
29 30 31 32 |
# File 'lib/gitcopy.rb', line 29 def self.fatalError(error) puts "Error: #{error}" exit(false) end |