Class: RightScraper::Repositories::Svn

Inherits:
Base
  • Object
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, #repository_hash, #to_s

Constructor Details

#initialize(*args) ⇒ Svn

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



43
44
45
46
# File 'lib/right_scraper/repositories/svn.rb', line 43

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

Instance Attribute Details

#first_credentialObject Also known as: username

(String) Optional, SVN username



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

def first_credential
  @first_credential
end

#second_credentialObject Also known as: password

(String) Optional, SVN password



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

def second_credential
  @second_credential
end

#tagObject Also known as: revision

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



30
31
32
# File 'lib/right_scraper/repositories/svn.rb', line 30

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



57
58
59
# File 'lib/right_scraper/repositories/svn.rb', line 57

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

#repo_typeObject

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



49
50
51
# File 'lib/right_scraper/repositories/svn.rb', line 49

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



84
85
86
# File 'lib/right_scraper/repositories/svn.rb', line 84

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



65
66
67
68
69
70
71
72
# File 'lib/right_scraper/repositories/svn.rb', line 65

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