class Teapot::Command::Clone

Public Instance Methods

call() click to toggle source
# File lib/teapot/command/clone.rb, line 36
def call
        logger = parent.logger
        
        name = File.basename(::Build::URI[@source].path, ".git")
        
        nested = parent['--root', parent.options[:root] || name]
        root = nested.root
        
        if root.exist?
                raise ArgumentError.new("#{root} already exists!")
        end
        
        logger.info "Cloning #{@source} to #{root}..."
        _repository = Rugged::Repository.clone_at(@source, root.to_s, credentials: self.method(:credentials))
        
        # Fetch the initial packages:
        Fetch[parent: nested].call
end
credentials(url, username, types) click to toggle source
# File lib/teapot/command/clone.rb, line 55
def credentials(url, username, types)
        # We should prompt for username/password if required...
        return Rugged::Credentials::SshKeyFromAgent.new(username: username)
end