Class: RightScraper::Repositories::Svn

Inherits:
Base show all
Defined in:
lib/right_scraper/repositories/svn.rb

Overview

A repository that is stored in a Subversion server.

Instance Attribute Summary collapse

Attributes inherited from Base

#display_name, #resources_path, #url

Instance Method Summary collapse

Methods inherited from Base

#==, #equal_repo?, from_hash, register_url_schemas, registered_url_schemas, registration_module, #repository_hash, #to_s

Methods inherited from RightScraper::RegisteredBase

query_registered_type, register_class, register_self, registered_types, registration_module

Constructor Details

#initialize(*args) ⇒ Svn

Create a new SvnRepository. If the tag is not specified, defaults to HEAD.



46
47
48
49
# File 'lib/right_scraper/repositories/svn.rb', line 46

def initialize(*args)
  super
  @tag = "HEAD" if @tag.nil?
end

Instance Attribute Details

#first_credentialObject Also known as: username

(String) Optional, SVN username



37
38
39
# File 'lib/right_scraper/repositories/svn.rb', line 37

def first_credential
  @first_credential
end

#second_credentialObject Also known as: password

(String) Optional, SVN password



41
42
43
# File 'lib/right_scraper/repositories/svn.rb', line 41

def second_credential
  @second_credential
end

#tagObject Also known as: revision

(String) Optional, tag or branch of repository that should be downloaded



33
34
35
# File 'lib/right_scraper/repositories/svn.rb', line 33

def tag
  @tag
end

Instance Method Details

#checkout_hashObject

Return a unique identifier for this revision in this repository.

Returns

String

opaque unique ID for this revision in this repository



60
61
62
# File 'lib/right_scraper/repositories/svn.rb', line 60

def checkout_hash
  digest("#{PROTOCOL_VERSION}\000#{repo_type}\000#{url}\000#{tag}")
end

#repo_typeObject

(String) Type of the repository, here ‘svn’.



52
53
54
# File 'lib/right_scraper/repositories/svn.rb', line 52

def repo_type
  :svn
end

#retriever(options) ⇒ Object

Instantiate retriever for this kind of repository

Options

:max_bytes

Maximum number of bytes to read

:max_seconds

Maximum number of seconds to spend reading

:basedir

Destination directory, use temp dir if not specified

:logger

Logger to use

Return

retriever(Retrivers::Svn)

Retriever for this repository



87
88
89
# File 'lib/right_scraper/repositories/svn.rb', line 87

def retriever(options)
  RightScraper::Retrievers::Svn.new(self, options)
end

#to_urlObject

Convert this repository to a URL in the style of resource URLs.

Returns

URI

URL representing this repository



68
69
70
71
72
73
74
75
# File 'lib/right_scraper/repositories/svn.rb', line 68

def to_url
  if first_credential
    uri = add_users_to(url, first_credential, second_credential)
  else
    uri = URI.parse(url)
  end
  uri
end