Class: RightScraper::Repositories::Mock
- 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
-
#first_credential ⇒ Object
(String) Optional, username.
-
#repo_type ⇒ Object
(String) Type of the repository, here ‘download’.
-
#second_credential ⇒ Object
(String) Optional, password.
-
#tag ⇒ Object
(String) Optional, tag or branch of repository that should be downloaded.
Attributes inherited from Base
#display_name, #resources_path, #url
Class Method Summary collapse
-
.scraper=(scraper) ⇒ Object
Set the correct sort of scraper to use for mock repositories.
Instance Method Summary collapse
-
#initialize ⇒ Mock
constructor
Create a new mock repository.
-
#scraper ⇒ Object
(Base class) Appropriate class for scraping this sort of repository.
-
#to_s ⇒ Object
Unique representation for this repo, should resolve to the same string for repos that should be cloned in same directory.
Methods inherited from Base
#==, #checkout_hash, #equal_repo?, from_hash, #repository_hash, #retriever, #revision, #to_url
Constructor Details
#initialize ⇒ Mock
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_credential ⇒ Object
(String) Optional, username
41 42 43 |
# File 'lib/right_scraper/repositories/mock.rb', line 41 def first_credential @first_credential end |
#repo_type ⇒ Object
(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_credential ⇒ Object
(String) Optional, password
44 45 46 |
# File 'lib/right_scraper/repositories/mock.rb', line 44 def second_credential @second_credential end |
#tag ⇒ Object
(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
#scraper ⇒ Object
(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_s ⇒ Object
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 |