Module: SVN::Downloader

Defined in:
lib/svn/downloader.rb,
lib/svn/downloader/version.rb

Overview

Downloader module for SVN repository downloading

Constant Summary collapse

XML_HEAD =

XML header

'<?xml version="1.0" encoding="utf-8"?>'
DAV_NS =

WebDAV Namespace

'DAV:'
SVN_DAV_PROP_NS_DAV =

WebDAV SVN Namespace

'http://subversion.tigris.org/xmlns/dav/'
NAMESPACES =

XML Namespaces

{ 'D' => DAV_NS }
VERSION =

Version

'0.0.3'

Class Method Summary collapse

Class Method Details

.download(url, path = './tmp/') ⇒ Object

download files from remote repository

Parameters:

  • url (String)

    The URL to the remote repository

  • path (String) (defaults to: './tmp/')

    The local path where to save downloaded repository



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/svn/downloader.rb', line 38

def self.download(url, path = './tmp/')
    uri = URI.parse(url)
    case uri.scheme
    when 'http','https'
        fromHTTP(uri, path)
    when 'svn'
        fromSVN(uri, path)
    else
        raise RuntimeError.new('Unrecognized protocol ' + uri.scheme)
    end
end

.fromHTTP(uri, path) ⇒ Object

download files from remote repository over HTTP protocol

Parameters:

  • uri (String)

    The URI to the remote repository

  • path (String)

    The local path where to save downloaded repository



53
54
55
56
57
# File 'lib/svn/downloader.rb', line 53

def self.fromHTTP(uri, path)
    Net::DAV.start(uri) do |dav|
        downloadFolder(dav, uri.path, path)
    end
end

.fromSVN(uri, path) ⇒ Object

download files from remote repository over SVN protocol

Parameters:

  • uri (String)

    The URI to the remote repository

  • path (String)

    The local path where to save downloaded repository

Raises:

  • (RuntimeError)


62
63
64
65
# File 'lib/svn/downloader.rb', line 62

def self.fromSVN(uri, path)
    # TODO
    raise RuntimeError.new('SVN protocol is not implemented yet')
end