Class: RightScraper::Repositories::Mock

Inherits:
Base
  • Object
show all
Defined in:
lib/right_scraper/repositories/mock.rb

Overview

A “repository” that is just there for testing. This class is not loaded by default.

Instance Attribute Summary collapse

Attributes inherited from Base

#display_name, #resources_path, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #checkout_hash, #equal_repo?, from_hash, #repository_hash, #retriever, #revision, #to_url

Constructor Details

#initializeMock

Create a new mock repository.



31
32
33
# File 'lib/right_scraper/repositories/mock.rb', line 31

def initialize
  @repo_type = :mock
end

Instance Attribute Details

#first_credentialObject

(String) Optional, username



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

def first_credential
  @first_credential
end

#repo_typeObject

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



35
36
37
# File 'lib/right_scraper/repositories/mock.rb', line 35

def repo_type
  @repo_type
end

#second_credentialObject

(String) Optional, password



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

def second_credential
  @second_credential
end

#tagObject

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



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

def tag
  @tag
end

Class Method Details

.scraper=(scraper) ⇒ Object

Set the correct sort of scraper to use for mock repositories.



62
63
64
# File 'lib/right_scraper/repositories/mock.rb', line 62

def self.scraper=(scraper)
  @@scraper = scraper
end

Instance Method Details

#scraperObject

(Base class) Appropriate class for scraping this sort of repository.



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

def scraper
  @@scraper || raise("Scraper for mocks isn't defined yet")
end

#to_sObject

Unique representation for this repo, should resolve to the same string for repos that should be cloned in same directory

Returns

res(String)

Unique representation for this repo



51
52
53
# File 'lib/right_scraper/repositories/mock.rb', line 51

def to_s
  res = "mock #{url}:#{tag}"
end