Class: Contextizer::RemoteRepoHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/contextizer/remote_repo_handler.rb

Class Method Summary collapse

Class Method Details

.handle(url) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/contextizer/remote_repo_handler.rb', line 8

def self.handle(url)
  Dir.mktmpdir("contextizer-clone-") do |temp_path|
    puts "Cloning #{url} into temporary directory..."

    success = system("git clone --depth 1 #{url} #{temp_path}")

    if success
      puts "Cloning successful."
      yield(temp_path)
    else
      puts "Error: Failed to clone repository."
    end
  end
end