Class: GitReview::Provider::Base
- Inherits:
-
Object
- Object
- GitReview::Provider::Base
- Defined in:
- lib/git-review/provider/base.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#source_repo ⇒ String
Source repo name.
Class Method Summary collapse
Instance Method Summary collapse
-
#get_request_by_number(request_number) ⇒ Object
Ensure we find the right request.
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#login ⇒ String
Current username.
- #method_missing(method, *args) ⇒ Object
-
#repo_info_from_config ⇒ Array(String, String)
User and repo name from git.
- #respond_to?(method) ⇒ Boolean
- #update ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
14 15 16 |
# File 'lib/git-review/provider/base.rb', line 14 def initialize configure_access end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/git-review/provider/base.rb', line 59 def method_missing(method, *args) if client.respond_to?(method) client.send(method, *args) else super end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/git-review/provider/base.rb', line 7 def client @client end |
#source_repo ⇒ String
Returns Source repo name.
23 24 25 |
# File 'lib/git-review/provider/base.rb', line 23 def source_repo @source_repo end |
Class Method Details
.instance ⇒ Object
10 11 12 |
# File 'lib/git-review/provider/base.rb', line 10 def self.instance @instance ||= new end |
Instance Method Details
#get_request_by_number(request_number) ⇒ Object
Ensure we find the right request
55 56 57 |
# File 'lib/git-review/provider/base.rb', line 55 def get_request_by_number(request_number) request_exists?(request_number) || (raise ::GitReview::InvalidRequestIDError) end |
#login ⇒ String
Returns Current username.
31 32 33 |
# File 'lib/git-review/provider/base.rb', line 31 def login settings.username end |
#repo_info_from_config ⇒ Array(String, String)
Returns User and repo name from git.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/git-review/provider/base.rb', line 36 def repo_info_from_config url = local.config['remote.origin.url'] raise ::GitReview::InvalidGitRepositoryError if url.nil? user, project = url_matching(url) unless user && project insteadof_url, true_url = insteadof_matching(local.config, url) if insteadof_url and true_url url = url.sub(insteadof_url, true_url) user, project = url_matching(url) end end [user, project] end |
#respond_to?(method) ⇒ Boolean
67 68 69 |
# File 'lib/git-review/provider/base.rb', line 67 def respond_to?(method) client.respond_to?(method) || super end |
#update ⇒ Object
18 19 20 |
# File 'lib/git-review/provider/base.rb', line 18 def update git_call('fetch origin') end |